[rabbitmq-discuss] Custom Exchange Implementation

Levi Greenspan greenspan.levi at googlemail.com
Wed Mar 25 15:31:51 GMT 2009


Dear list members,

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?

Maybe someone can give me a little help with this. I should add - what
is certainly obvious already - that I am in no way a competent Erlang
programmer or that I know much about RabbitMQ's internals. I would just
like to get a second opinion about this issue before I run into trouble
in production ;-)

Many thanks,
Levi






More information about the rabbitmq-discuss mailing list