Reputation: 369
With Spring JMS 4.3.19 as well as with 5.2.5 I am trying to set up a JMSListener
for durable subscriptions:
@JmsListener(destination = "test", subscription = "Consumer.Test", connectionFactory = "factory")
public void receiveFromDurableSub(String message) {
System.out.println("receiveFromTest: " + message);
}
But it ends up in Consumer\\.Test
. For addresses it works somehow.
How can I avoid those backslashes?
Upvotes: 0
Views: 401
Reputation: 35152
JMS topic subscriptions are implemented on ActiveMQ Artemis as queues. Each subscription gets it own queue.
The name of the queue depends on how the subscription is configured. The broker will take the JMS client ID (if one is configured), the JMS subscription name (if one is configured), and the JMS subscription's durability to construct the name of the underlying subscription queue. The broker uses the .
character to concatenate all these piece of information together to compose the final name. See the related source code for more details on that bit.
In order to be able to decompose this name into its constituent parts later any uses of the .
character in the client ID or subscription name have to be escaped.
Since you're using Consumer.Test
for the JMS subscription's name this will ultimately be escaped to Consumer\\.Test
for use in the underlying subscription queue's name. The broker's use of the .
character is not configurable in this case.
If you don't want your subscription's name to be escaped then I recommend you don't use a name with a .
character in it (e.g. Consumer-Test
).
Upvotes: 0