[rabbitmq-discuss] Custom Exchange Implementation

Levi Greenspan greenspan.levi at googlemail.com
Wed Mar 25 15:34:06 GMT 2009


Sorry, forgot to attach the patch.

Regards,
Levi

On Wed, 2009-03-25 at 16:31 +0100, Levi Greenspan wrote:
> 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
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: srand-exchange-hack.diff
Type: text/x-patch
Size: 2366 bytes
Desc: not available
Url : http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20090325/3a15051f/attachment.bin 


More information about the rabbitmq-discuss mailing list