Spring Integration DSL等效于'int-jms:message-driven-channel-adapter'和'subscription-shared'选项

时间:2018-07-27 13:35:30

标签: spring-integration spring-jms spring-integration-dsl

我们从MessageDrivenChannelAdapter获得了这样的配置

<int-jms:message-driven-channel-adapter channel="..."
                                        connection-factory="..."
                                        destination-name="..."
                                        pub-sub-domain="true"
                                        subscription-name="..."
                                        subscription-shared="true"
                                        subscription-durable="true"
                                        auto-startup="..."
                                        error-channel="errorChannel"/>

我已经能够复制大多数配置:

 JmsMessageDrivenChannelAdapterListenerContainerSpec<JmsDefaultListenerContainerSpec, DefaultMessageListenerContainer> destination = Jms
        .messageDrivenChannelAdapter([connection-factory])
        .destination([destination-name])
        .autoStartup([auto-startup])
        .configureListenerContainer(c -> c
           .pubSubDomain(true)
           .subscriptionDurable(true)
           .durableSubscriptionName([subscription-name])
        )
        .errorChannel(errorChannel);

但是我在DSL中找不到如何将订阅标记为共享

应如何实现?

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

呵呵!我认为我们只是错过了公开public void setSubscriptionShared(boolean subscriptionShared) {的选项。

请提出一个JIRA,我们将在今天的发行版中对其进行修复。

作为解决方法,我建议对AbstractMessageListenerContainer使用后备:

.configureListenerContainer(c -> { c
       .pubSubDomain(true)
       .subscriptionDurable(true)
       .durableSubscriptionName([subscription-name]);
        DefaultMessageListenerContainer messageListenerContainer = c.get();
        messageListenerContainer.setSubscriptionShared(true);
        }
     )