【问题标题】:How to cache producer in outbound-channel-adapter when it uses session from upstream message-driven-channel-adapter使用上游消息驱动通道适配器的会话时如何在出站通道适配器中缓存生产者
【发布时间】:2014-12-04 07:21:45
【问题描述】:

我设计了以下消息流

            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="transacted at message-driven-channel-adapter。我不觉得 message-driven-channel-adapter 会是一个问题。我觉得性能问题是由于 jmstemplate 用于出站通道适配器,因为每次它从消息驱动通道适配器下游提供的会话创建生产者。

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

【问题讨论】:

    标签: spring-integration spring-jms


    【解决方案1】:

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

    【讨论】:

    • 我实现了您的建议,并且能够毫无问题地缓存生产者和消费者。谢谢。
    猜你喜欢
    • 1970-01-01
    • 2014-01-23
    • 2011-04-29
    • 1970-01-01
    • 1970-01-01
    • 2016-03-25
    • 2021-03-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多