[rabbitmq-discuss] gen_server2 ques. and was: Re: clarifying plugin supervision, configuration
Jon Brisbin
jon at jbrisbin.com
Thu Sep 2 15:50:31 BST 2010
Thanks for the info, Simon...comments below...(also question about gen_server2)
On Sep 2, 2010, at 9:34 AM, Simon MacMullen wrote:
> Hi Jon. I don't know if you've found answers to these questions yet, but I'll take a stab at answering anyway.
>
> On 24/08/10 17:11, Jon Brisbin wrote:
>> I'm looking at some of the existing plugins and I just want to make sure
>> I understand how the plugins are supervised in the broker.
>>
>> It looks like it starts the application defined in the plugin's .app
>> file, whose start() function should call my plugin's supervisor's
>> start_link() function, correct?
>
> Yes. It can start more than one supervisor of course, but it needs to return the pid of the top-level one.
Okay, that makes sense. Just put supervisors in your top-level super's worker configs and they can, in turn, start the gen_servers.
>> I'll need to listen on multiple exchanges, so I'm assuming I'll need a
>> gen_server, which starts separate consumers, for each configuration
>> element (akin to what rabbit_shovel is doing by creating a child
>> configuration in the supervisor for each element in the configuration
>> file). How far can I go before I need to worry about resource usage of
>> the "process per consumer" approach?
>
> Pretty far. Erlang processes are in general much cheaper than threads are in other languages precisely so you can do things like that.
>
That's good. It sounds like I've got a ways to go before worrying about that.
What are the advantages to using the gen_server2 module rather than stock erlang gen_server? Would it be better in general for the webhooks plugin to use gen_server2?
Thanks!
J. Brisbin
http://jbrisbin.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100902/774ce729/attachment.htm>
More information about the rabbitmq-discuss
mailing list