nanaboo
nanaboo

Reputation: 395

How to configure Spring XD JMS source to use DefaultMessageListenerContainer?

To make the JMS topic subscription durable, it seems I need to make sure

  1. DefaultMessageListenerContainer (instead of the default SimpleMessageListenerContainer) is used
  2. stream definition contains "durableSubscription=true acknowledge=transacted subscriptionName=xxxx pubSub=true"

I managed to enable 'dmlc' by specifying spring.profiles.active in xd-singlenode.bat but is there a better way such as using properties or yml?

xd-singlenode.bat

set SPRING_XD_OPTS=-Dspring.profiles.active=singlenode,dmlc -Dspring.application.name=singlenode -Dlogging.config=%XD_CONFIG_LOCATION%/xd-singlenode-logback.groovy -Dxd.home=%XD_HOME%

Upvotes: 2

Views: 92

Answers (1)

Artem Bilan
Artem Bilan

Reputation: 121177

According to the JmsSourceModuleOptionsMetadata source code we have:

public String[] profilesToActivate() {
    if ("transacted".equals(this.acknowledge)) {
        return new String[] { "dmlc" };
    }
    else {
        return new String[] { "smlc" };
    }
}

So, looks like your acknowledge=transacted is enough to go ahead with the

container-class="org.springframework.jms.listener.DefaultMessageListenerContainer"

in the JMS Source.

Upvotes: 2

Related Questions