Search code examples
apacheactivemq-classicstomp

ActiveMQ Durable consumer is in use for client and subscriptionName via STOMP


I have an iOS client that connects to several ActiveMQ topics and queues via STOMP protocol. When I connect to the server, I send the following message:

2012-10-30 10:19:29,757 [MQ NIO Worker 2] TRACE StompIO 
CONNECT
passcode:*****
login:system

2012-10-30 10:19:29,758 [MQ NIO Worker 2] DEBUG ProtocolConverter
2012-10-30 10:19:29,775 [MQ NIO Worker 2] TRACE StompIO
CONNECTED
heart-beat:0,0
session:ID:mbp.local-0123456789
server:ActiveMQ/5.6.0
version:1.0

And then, I subscribe to several topics using the following message:

2012-10-30 10:19:31,028 [MQ NIO Worker 2] TRACE StompIO 
SUBSCRIBE
activemq.subscriptionName:user@mail.com-/topic/SPOT.SPOTCODE
activemq.prefetchSize:1
activemq.dispatchAsync:true
destination:/topic/SPOT.SPOTCODE
client-id:1234
activemq.retroactive:true

I'm facing two problems with the ActiveMQ server. Each time I connect, the Number of Consumers column in the web interface gets incremented, so I have just one real consumer but the count is around 50 consumers. But the most problematic issue is that when I plug another iOS device into my laptop to test the messaging environment, i get the following error when connecting to ActiveMQ:

WARN | Async error occurred: javax.jms.JMSException: Durable consumer is in use for client: ID:mbp.local-0123456789 and subscriptionName: user@mail.com-/topic/SPOT.SPOTCODE

This seems to be that disconnecting from ActiveMQ via STOMP is not working propertly, because this logging attempt is made when the other device is not running the app. I've tried the following things in order to solve the issue:

  • Always logoff when attempting to subscribe to the topics.
  • Subscribe

I'm currently using v5.6.0 executing the server on my laptop.


Solution

  • IF you read the STOMP page on the ActiveMQ site you will notice that client-id and activemq-subscriptionName must match in order to use STOMP durable subscribers. These value should be different for each of you client's otherwise you will see the same errors because of the name clashes.