Legal characters for routing and binding keys

2,350 views
Skip to first unread message

James Gardner

unread,
Oct 28, 2014, 1:22:22 PM10/28/14
to rabbitm...@googlegroups.com

Hi,

I looked at the AMQP 0-9-1 reference, and Googled, but I cannot find any definitive list of legal/illegal characters for routing keys, or topic binding keys.
Obviously the '.', '*', and '#' are special characters and I can rule them out for use in keys, but what other restrictions are there, if any?

I am planning on using a query-string-like KV pair arrangement for one of the words in a routing key, so the routing key would end up looking something like:

someword.fm=png&pu=ztf&pve=noaa&vs=1;fm=jpeg&pve=nids%20dept.someotherword.etc


Please let me know what is acceptable, both from the perspective of the specification, and RabbitMQ in particular if it differs from the spec in any way.
Many thanks,

James Gardner (NIDS- NOAA)

Simon MacMullen

unread,
Oct 28, 2014, 1:40:54 PM10/28/14
to James Gardner, rabbitm...@googlegroups.com
As far as I can see there is no limit in the spec other than "valid
UTF-8 byte sequence with no null character". That's what we allow.

That's opposed to the situation with exchange and queue names, which in
the spec are confined to [a-zA-Z0-9-_.:]* (although again we allow the
same as for routing keys).

Cheers, Simon

On 28/10/14 17:22, James Gardner wrote:
>
> Hi,
>
> I looked at the AMQP 0-9-1 reference, and Googled, but I cannot find any
> definitive list of legal/illegal characters for routing keys, or topic
> binding keys.
> Obviously the '.', '*', and '#' are special characters and I can rule
> them out for use in keys, but what other restrictions are there, if any?
>
> I am planning on using a query-string-like KV pair arrangement for one
> of the words in a routing key, so the routing key would end up looking
> something like:
>
> someword.*fm=png&pu=ztf&pve=noaa&vs=1;fm=jpeg&pve=nids%20dept*.someotherword.etc
>
>
> Please let me know what is acceptable, both from the perspective of the
> specification, and RabbitMQ in particular if it differs from the spec in
> any way.
> Many thanks,
>
> James Gardner (NIDS- NOAA)
>
> --
> You received this message because you are subscribed to the Google
> Groups "rabbitmq-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to rabbitmq-user...@googlegroups.com
> <mailto:rabbitmq-user...@googlegroups.com>.
> To post to this group, send email to rabbitm...@googlegroups.com
> <mailto:rabbitm...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Laing, Michael

unread,
Oct 28, 2014, 1:42:35 PM10/28/14
to James Gardner, rabbitm...@googlegroups.com
I believe I chased this down and UTF8 is acceptable. Routing keys are limited to 256 octets however.
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.

Laing, Michael

unread,
Oct 28, 2014, 1:43:50 PM10/28/14
to James Gardner, rabbitm...@googlegroups.com
Or maybe it is 255...

James Gardner

unread,
Oct 28, 2014, 2:35:59 PM10/28/14
to Simon MacMullen, rabbitm...@googlegroups.com

Awesome, I appreciate the confirmation. Thanks Simon, and Michael!
Cheers,
James

Behrang

unread,
Jul 23, 2018, 2:24:51 AM7/23/18
to rabbitmq-users
Where in the spec is the valid characters for an exchange name specified? Couldn't find anything related to exchanges in the spec: http://www.amqp.org/sites/amqp.org/files/amqp.pdf

Michael Klishin

unread,
Jul 23, 2018, 6:36:44 PM7/23/18
to rabbitm...@googlegroups.com
See section 1.1, the exchange-name and shortstr domains (data types) [1].


> To post to this group, send email to rabbitm...@googlegroups.com
> <mailto:rabbitm...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-users+unsubscribe@googlegroups.com.
To post to this group, send email to rabbitmq-users@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
MK

Staff Software Engineer, Pivotal/RabbitMQ
Reply all
Reply to author
Forward
0 new messages