Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring integration 如何在包含入站适配器、出站适配器和错误通道的流中处理jms会话,并使用相同的CachingConnectionfactory进行配置_Spring Integration_Spring Jms - Fatal编程技术网

Spring integration 如何在包含入站适配器、出站适配器和错误通道的流中处理jms会话,并使用相同的CachingConnectionfactory进行配置

Spring integration 如何在包含入站适配器、出站适配器和错误通道的流中处理jms会话,并使用相同的CachingConnectionfactory进行配置,spring-integration,spring-jms,Spring Integration,Spring Jms,我有以下流程: 1) message-driven-channel-adapter -> 1.1) output-channel connected to -> service-activator -> outbound-channel-adapter (for sending response) 1.2) error-channel connected to -> exception-type-router

我有以下流程:

   1) message-driven-channel-adapter -> 
             1.1) output-channel connected to -> service-activator -> outbound-channel-adapter (for sending response)
             1.2) error-channel connected to -> exception-type-router 
                        1.2.1) message is sent to different queues depending on the exception type using outbound-channel-adapter

         MessageDrivenChannelAdapter uses DefaultMessageListenrContainer and OutboundAdapter uses JMSTemplate
         Have used same cachingconnectionfactory for inbound and outbound adapters, 
         set acknowledge="transacted" in messageDrivenChannelAdapter
         set cacheLevel as CACHE_CONSUMER in DefaultMessageListenerContainer
         set cacheProducers=true and cacheConsumers=false in CachingConnectionFactory
在这个流程中如何创建和处理jms会话/生产者/消费者,我感到非常困惑

1) 入站适配器、出站适配器(用于响应和错误队列)使用的使用者和生产者是否从同一会话创建,即线程中使用的生产者和使用者是否从同一会话创建

2) 只是想确认使用cachingconnectionfactory是否存在任何缺点/问题,即使在工厂中将1)cacheconmers设置为false,并将2)缓存级别设置为在DefaultMessageListenerContainer中缓存消费者。因为,读到论坛上说不应该使用cachingconnectionfactory是令人困惑的

3) 另外,对执行流有疑问:在执行流中,service activator方法的执行何时完成?它是否仅在消息发送到输出队列后完成

请告知

  • 在侦听器容器中使用缓存连接工厂是可以的,只要不使用变量并发,或者在工厂中禁用缓存使用者
  • 在您的场景中,应该使用缓存连接工厂,因为出于性能原因,您确实希望缓存生产者
  • 当容器
    acknowledgemode
    被处理时,容器会话被绑定到线程,并将被配置为使用相同连接工厂的任何上游
    JmsTemplate
    使用,只要不存在异步切换(
    QueueChannel
    ExecutorChannel
    );默认的
    DirectChannel
    在容器线程上运行下游端点


    在将消息发送到出站适配器之前,将调用(并“完成”)service activator方法。

    Gary,感谢您的详细解释。