[rabbitmq-discuss] question on custom exchanges
Jon Brisbin
jon at jbrisbin.com
Fri Apr 1 14:34:02 BST 2011
On Apr 1, 2011, at 4:31 AM, Simon MacMullen wrote:
> On 31/03/11 20:21, Jon Brisbin wrote:
>> Sorry for the bang-bang, scatter-shot nature of these questions,
>> but...
>>
>> 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.
Yes, still very much in need of a better answer. For the first cut, I'm not going to try and be too fancy (I just want it to work). But I will absolutely need some better pooling / process management immediately thereafter.
> 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 exchange.
Technically, I only need to store the Pid of the client process. I'm getting errors trying to store or retrieve from my ets table from my module callbacks. I may need to use an mnesia table, but I'd be interested to see what you come up with in the pg2 approach. That sounds better to me than managing mnesia resources for this.
> 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.
Good. Eagerly awaiting... :)
Thanks!
Jon Brisbin
http://jbrisbin.com
Twitter: @j_brisbin
More information about the rabbitmq-discuss
mailing list