开发者

Add a dynamic supervisor to ejabberd

Is it possible to start a supervisor module in ejabberd which I can add a gen_fsm module to, per connection?

Specifically, I want to create a supervisor which I start when the server starts (or when connections come in). And I have开发者_开发知识库 a couple of gen_servers which I want to start, but the part I'm looking for some guidance on is how to dynamically add a gen_fsm module to my supervisor when I see this user's presence become available?


You might want to have a look to the Simple one for on supervisor, which:

is a simplified one_for_one supervisor, where all child processes are dynamically added instances of the same process

...

When started, the supervisor will not start any child processes. Instead, all child processes are added dynamically by calling:

supervisor:start_child(Sup, List)

...

Basically, you use this kind of supervisors when:

  1. All the children are of the same type
  2. You want to add children dynamically

Which appears to be your case.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜