[rabbitmq-discuss] Custom Exchange Implementation
Matthias Radestock
matthias at lshift.net
Wed Mar 25 17:09:35 GMT 2009
Levi,
Levi Greenspan wrote:
> I have hacked together a custom exchange type, which supports bindings
> without a routing key similar to the fanout exchange type. When a
> publisher sends a message with routing key R, the message will be send
> to all queues bound to the exchange with key K=R. If no queue is found,
> one is randomly selected and a binding from this queue to the exchange
> with key R is added. Next time a message is send with routing key R, the
> very same queue will be used.
>
> Now, what I have come up with, works reasonably well in testing, however
> from looking at the code I am afraid the way its done is not safe in the
> face of parallel calls of rabbit_exchange:route, because I update the
> shared state (bindings table). Would it be better to create a separate
> process to handle all this?
Just make the updates part of the same mnesia tx as the route lookup.
That should do the trick, I think.
Matthias.
More information about the rabbitmq-discuss
mailing list