[rabbitmq-discuss] STOMP plugin - durable subscription limitation
Michael Justin
michael.justin at gmx.net
Thu Oct 18 17:11:52 BST 2012
Hello,
there is a limitation in the STOMP plugin when using durable subscriptions.
With normal topic destinations, the SUBSCRIBE command can use different
'id' frame headers to create concurrent subscriptions for the same
topic. This can be achieved by assigning a unique identifier per
consumer, so that incoming messages can be routed to the consumer based
on the value of the subscription id header. Example:
1. RabbitMQ with a normal (non-durable) subscription
SUBSCRIBE
destination:/topic/ExampleTopic
ack:auto
id:{F09BD8A4-0C7B-4830-B4B5-B3F5D76E5A7C}
MESSAGE
message-id:id123
destination:/topic/ExampleTopic
subscription:{F09BD8A4-0C7B-4830-B4B5-B3F5D76E5A7C}
However, RabbitMQ uses the id header differently for topic
subscriptions. Sending and receiving requires to set the same value, so
that consumers are not able to assign any random identifier in the
SUBSCRIBE frame. Is this correct so far and as designed?
This has the effect that a client can not handle more than one consumer
for the same durable subscription because a SUBSCRIBE frame can not use
a client-side assigned identifier in the same way and use it to route
incoming messages based on this id between internal 'consumers'.
Example:
2. RabbitMQ with durable subscription
SUBSCRIBE
destination:/topic/TOOL.DEFAULT
receipt:yes
ack:auto
id:durable-subscription-name
persistent:true
received:
MESSAGE
receipt:receipt
persistent:true
content-type:text/plain
subscription:durable-subscription-name
destination:/topic/TOOL.DEFAULT
message-id:T_durable-subscription-name@@session-whuoJn95NxH3Ic-lQIr-Wl@@1
content-length:9
In ActiveMQ and other brokers with STOMP support, a durable topic
subscription uses a special header for the subscription id
(activemq.subscriptionName), which leaves the id header still available
for a client-assigned unique identifer.
3. ActiveMQ example
SUBSCRIBE
destination:/topic/TEST.DEFAULT
ack:auto
id:{F09BD8A4-0C7B-4830-B4B5-B3F5D76E5A7C}
activemq.subscriptionName:test
MESSAGE
message-id:ID:mj-PC-49312-1350574103726-4:2:-1:1:1
destination:/topic/TEST.DEFAULT
timestamp:1350574179240
expires:0
subscription:{F09BD8A4-0C7B-4830-B4B5-B3F5D76E5A7C}
persistent:true
priority:4
The STOMP 1.0 specification says:
"You can also specify an id header which can then later on be used to
UNSUBSCRIBE from the specific subscription as you may end up with
overlapping subscriptions using selectors with the same destination."
In RabbitMQ however, overlapping subscriptions seem to be impossible for
a durable topic, as there is no way to specify unique values for the id.
Is this correct?
Many thanks in advance
--
Michael Justin
habarisoft - Enterprise Messaging Software for Delphi
http://www.habarisoft.com/
More information about the rabbitmq-discuss
mailing list