ostinelli / syn

A scalable global Process Registry and Process Group manager for Erlang and Elixir.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Callback for on process enter

cjimison opened this issue · comments

It would be nice to have a local callback for when a progress has been added to the registry in the same way there is an exit and on conflict. This way I don't have to poll the group/etc for new membership, etc.

registry_process_enter_callback, [my_callback, callback_on_process_enter]

Hi @cjimison,
Contrary to exit callbacks, it is actually easy to do what you desire without the additional complication of callbacks.

A process that adds itself just has to publish to the group the fact that it joined, which is way simpler for me. This is all there's to it:

ok = syn:join(my_group, self()),
{ok, _} = syn:publish(my_group, {joined, self()}).

Totally. Just thinking about symmetry of the API is all.

-Chris

On May 3, 2016, at 9:52 AM, Roberto Ostinelli notifications@github.com wrote:

Hi @cjimison https://github.com/cjimison,
Contrary to exit callbacks, it is actually easy to do what you desire without the additional complication of callbacks.

A process that adds itself just has to publish to the group the fact that it joined, which is way simpler for me. This is all there's to it:

ok = syn:join(my_group, self()),
{ok, _} = syn:publish(my_group, {joined, self()}).

You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub #13 (comment)

Callbacks for process exits are necessary, simply because there isn't another way to do that (unless you start monitoring processes independently which would be silly since Syn does this already).

On the contrary, callbacks for process enter can easily be solved with alternative solutions, which in my opinion will all be more readable than callbacks in a config file.

Hence, I'll close this issue for now since it hasn't had any additional traffic / comments since May.

@cjimison thank you again for your feedback :)