[rabbitmq-discuss] question on custom exchanges
simon at rabbitmq.com
Fri Apr 1 10:31:10 BST 2011
On 31/03/11 20:21, Jon Brisbin wrote:
> Sorry for the bang-bang, scatter-shot nature of these questions,
> How would I go about creating resources that are unique to a given
> custom exchange? For example, if I have hostname and port parameters
> as arguments to my custom exchange, how can I manage a process that
> is unique to that exchange (because it connects to a possibly-unique
> combo of hostname and port) from my module?
> Do I construct some key based on vhost and exchange name and store a
> Pid in an ets table or something?
I don't know whether you still need answers based on your tweets last
night, but here goes. I've been working through some of the same issues
with the federation plugin. Also I hope I'm understanding your questions
correctly - let me know if not.
You should start your process up when the create() or recover()
callbacks are invoked. (create() means a new exchange was created while
Rabbit was running; recover() means Rabbit started up and found your
exchange in Mnesia).
In terms of associating a PID with your exchange, you could use ETS or
DETS but that won't be very wise around clusters. You could create an
Mnesia table or use process groups (pg2) and create a process group per
exchange. That's what I'm doing, but I have more than one process per
> What is the lifecycle of a custom exchange module? Does it even have
The module itself doesn't, it's just callbacks.
Finally, I'm working on changing some of these APIs to fix some edge
cases that we're encountering, mostly around bindings. Once it's merged
I'll mail you again to let know where we ended up.
Staff Engineer, RabbitMQ
SpringSource, a division of VMware
More information about the rabbitmq-discuss