Search code examples
spring-integrationspring-jmsspring-integration-dsl

Spring Integration DSL equivalent for 'int-jms:message-driven-channel-adapter' with 'subscription-shared' option


we have a configuration from a MessageDrivenChannelAdapter like this

<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"/>

I have been able to replicate most of the configuration:

 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);

But I can't find in the DSL how to mark the subscription as shared

How this should be achieved?

Thanks for your help


Solution

  • Huh! I think we have just missed to expose an option for the public void setSubscriptionShared(boolean subscriptionShared) {.

    Please, raise a JIRA ASAP and we will fix it in the release today.

    As a workaround I suggest to use fallback to the AbstractMessageListenerContainer:

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