[rabbitmq-discuss] STOMP doesn't include the routing-key on MESSAGE frames

Tony Garnock-Jones tonygarnockjones+rabbitmq at gmail.com
Fri Feb 10 15:56:33 GMT 2012

Hi all,

Attempting to use the STOMP adapter the other day I discovered an
oversight in the new design: the AMQP routing key is no longer
propagated into outgoing MESSAGE frames. This stopped my application
from working.

Here's a patch (obviously crude, e.g. doesn't define a
?HEADER_ROUTING_KEY macro or anything) that causes the routing_key to
be sent along:

diff -r 3be0091c6401 src/rabbit_stomp_util.erl
--- a/src/rabbit_stomp_util.erl Wed Feb 08 15:53:59 2012 +0000
+++ b/src/rabbit_stomp_util.erl Fri Feb 10 10:53:21 2012 -0500
@@ -78,9 +78,11 @@

 message_headers(Destination, SessionId,
                 #'basic.deliver'{consumer_tag = ConsumerTag,
-                                 delivery_tag = DeliveryTag},
+                                 delivery_tag = DeliveryTag,
+                                 routing_key = RoutingKey},
                 Props = #'P_basic'{headers       = Headers}) ->
     Basic = [{?HEADER_DESTINATION, Destination},
+             {"amqp-routing-key", binary_to_list(RoutingKey)},
               create_message_id(ConsumerTag, SessionId, DeliveryTag)}],

I'd be very happy to see this included into the master branch of the
STOMP adapter.

Tony Garnock-Jones
tonygarnockjones at gmail.com

More information about the rabbitmq-discuss mailing list