[rabbitmq-discuss] queue selection based on a 'feature list'

Emile Joubert emile at rabbitmq.com
Wed Oct 30 14:37:42 GMT 2013


On 30/10/13 13:54, Lawrence Freil wrote:

> Is there a way to accomplish this with the current exchanges?

There may be a way to approximate this with a topic exchange if you
associate features with consumers rather than queues. You could create a
queue for each combination of features and bind so that it received
messages that require exactly those features.

E.g. you could declare queues

____, w___, _x___, __y_, ___z,
wx__, ... , w__z, ..., wxyz.

and bind them:

____ with binding key _._._._
w___ with binding key w._._._
_x__ with binding key _.x._._
__y_ with binding key _._.y._
___z with binding key _._._.z
...
wx__ with binding key w.x._._
w__z with binding key w._._.z
...
wxyz with binding key w.x.y.z

Consumers can then consume from all queues that contain messages that
demand a subset of the features offered by that consumer, e.g. a
consumer that offers

x and y consumes from ____ and _x__ and __y_ and _xy_
only z  consumes from ____ and ___z
w,x,y,z consumes from all queues

Then if you publish a message with routing key _.x.y._ it will arrive at
queue _xy_ and be sent to a consumer that is guaranteed to offer x and y.


If the number of features is large or rapidly changing then this will
become unmanageable. If the features are strictly associated with queues
rather than consumers then it also won't work.



-Emile








More information about the rabbitmq-discuss mailing list