[rabbitmq-discuss] Consistent Hash Exchange

Simon MacMullen simon at rabbitmq.com
Fri Jan 4 17:14:43 GMT 2013

So some of this comes down to "it depends what you want to do". If you 
are doing some routing based on the routing key (before?) the messages 
hit the CHX then you presumably are using e2e bindings like so:

                 /> Q1
          > CHX1 -> Q2
         /       \> Q3
        /        /> Q4
P -> X --> CHX2 -> Q5
        \        \> Q6
         \       /> Q7
          > CHX3 -> Q8
                 \> Q9

with routing for message type at X and then load balancing at CHX{1,2,3}.

So if the X in question is a topic exchange then option i) should work 
fine in the scenario above. Putting the hash at either end is fine, the 
key becomes a tree structure for routing anyway.

I don't know what exchange type you are currently using although I guess 
topic; if you are using a direct exchange you would either have to 
switch to topic or change your publishers to publish to one of several 
CHXs rather than to one DX with one of several routing keys.

Options ii) and iii) struggle with the fact that the CHX doesn't 
currently support hashing on anything other than the routing key.

Cheers, Simon

On 04/01/13 15:13, matthew.collinge at comparethemarket.com wrote:
> We are looking at using your consistent hash exchange for partitioning
> messages that we need to be processes synchronously based on a partition
> key (GUID in our case). The issue we currently face is that we are
> already using the routing key for subscriptions based on message type.
> As there will be messages of multiple types for the same partition key
> this will result in different routing keys and therefore different
> hashes of those keys for message that we want partitioned into the same
> destination queue.
> What would be the best way to go about trying to achieve this? I have
> thought of the following options but do not know the relative merits
> with respect to performance and the inner workings of RabbitMQ:
> i)Hash based on the first or last portion of a routing key
> (<HashME>.Iamused.For.Other.Routing)
> ii)Hash based on a Message Header
> iii)Hash based on a Message Property
> Is there any approach that you would advocate or indeed strongly advise
> against?
> Thank you in advance.
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss

Simon MacMullen
RabbitMQ, VMware

More information about the rabbitmq-discuss mailing list