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

Steve Powell steve at rabbitmq.com
Mon Feb 20 17:04:33 GMT 2012

Hi Tony,

Sorry I was so long in replying.

When you say 'no longer propagated', you imply that we used to do this. I guess
that was in the original implementation? :-) I don't think leaving this out was
an 'oversight' exactly, but more a desire to hide the implementation from the
pure STOMP user.

There is really no limit to the amount of information we could include in the
MESSAGE headers gleaned from the underlying implementation. We could easily
provide the AMQP exchange-name, consumer-tag and delivery-tag.

Of course, the more we include the more we reveal about the particular mapping
we have decided to use between the STOMP and AMQP protocols. This would inhibit
changes to that mapping, for future enhancements. For example, the routingKey you
extract in your patch might be a queue name generated by the server, a recast of
the destination information, or empty. The meaning and content of the header
value might change as we change our mapping.

So, I'm reluctant to include this information unless there is a compelling STOMP
reason for doing so. Is your application a pure STOMP one?
Steve Powell  (a happy bunny)
----------some more definitions from the SPD----------
vermin (v.) Treating the dachshund for roundworm.
chinchilla (n.) Cooling device for the lower jaw.
socialcast (n.) Someone to whom everyone is speaking but nobody likes.

On 14 Feb 2012, at 17:13, Tony Garnock-Jones wrote:

No comments on this?

On 10 February 2012 10:56, Tony Garnock-Jones
<tonygarnockjones+rabbitmq at gmail.com> wrote:
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

Tony Garnock-Jones
tonygarnockjones at gmail.com
rabbitmq-discuss mailing list
rabbitmq-discuss at lists.rabbitmq.com

More information about the rabbitmq-discuss mailing list