Spring integration 当生产者使用来自上游消息驱动通道适配器的会话时,如何在出站通道适配器中缓存生产者

Spring integration 当生产者使用来自上游消息驱动通道适配器的会话时,如何在出站通道适配器中缓存生产者,spring-integration,spring-jms,Spring Integration,Spring Jms,我设计了以下消息流 1) message-driven-channel-adapter -> 1.1) service-activator -> outbound-channel-adapter (for sending response) 1.2) in a chain - transformer -> outbound-channel-adapter (for se

我设计了以下消息流

            1) message-driven-channel-adapter -> 
                     1.1) service-activator -> outbound-channel-adapter (for sending response)
                     1.2) in a chain - transformer -> outbound-channel-adapter (for sending error)
消息驱动通道适配器从websphere MQ拾取消息,并使用DefaultMessageListenercontainer对其进行配置。出站通道适配器将消息发送到websphere MQ,并为此配置了JMS模板

问题是,性能看起来很低。我已使用cache_consumer和acknowledge=“在消息驱动的通道适配器上进行交易。我不认为消息驱动的通道适配器会是一个问题。我觉得性能问题是由于出站通道适配器中使用了jmstemplate,因为每次它都从消息驱动通道适配器下游提供的会话中创建生产者


有没有办法缓存jmstemplate使用的生产者。有人能告诉我如何提高性能吗?

如果使用
CachingConnectionFactory
,生产者将默认缓存在连接工厂中。注意:如果在入站适配器中使用变量并发,请确保在连接工厂中将
cacheConsumers
设置为
false
;我们不希望消费者缓存在那里(可以放在容器中)。

我实现了您的建议,能够缓存生产者和消费者而不会出现问题。谢谢