[rabbitmq-discuss] Delivering to one and only one queue

Simon MacMullen simon at rabbitmq.com
Thu Sep 6 16:43:06 BST 2012


On 06/09/2012 1:44PM, François Beausoleil wrote:
> I replied much too soon :( Does the consistent hash exchange accept
> strings as routing keys, and compute a hash from it?

It has to - routing keys are always strings.

> From the
> example, it appears not:
>
> routing_key =
> list_to_binary(integer_to_list(random:uniform(1000000))

The Erlang client uses the Erlang "binary" type for strings. Erlang is a 
wonderful language in many ways, but its model of strings is not the 
most consistent.

Anyway, that line of code means "generate a random number and convert it 
to a string".

> My routing keys have a consistent format, of the form
> "persona.qualified.UUID". The UUID part is what would trigger the
> consistent hash, because the rest of the routing key is constant.

Should be fine.

Cheers, Simon


More information about the rabbitmq-discuss mailing list