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_server
s 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:
- All the children are of the same type
- You want to add children dynamically
Which appears to be your case.
精彩评论