2

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%

nanaboo
  • 365
  • 4
  • 14

1 Answers1

2

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.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118
  • The selection of DMLC when `transacted` was implemented to resolve [this JIRA Issue](https://jira.spring.io/browse/XD-2767). Use of DMLC without transacted is not recommended. – Gary Russell Feb 04 '16 at 00:44
  • I knew I am missing something simple and that was it. With acknowledge=transacted, I see DMLC was created and subscription is durable. Thanks much Artem & Gary! – nanaboo Feb 04 '16 at 02:45