-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possibility of custom process registration dispatching logic? #27
Comments
It is possible to use via tuple by using private macros ( Your proposal is very interesting, and at first glance I like it. We could support a callback function (e.g. Would you be willing to make a PR? The code is somewhat convoluted, what with all the macro logic, so if you don't feel like it, I could give it a stab. |
Yes, I am willing to give the creation of a PR a go :-). |
Good luck :-) If you get stuck somewhere, feel free to ask. |
I think the cleanest way would be to just define |
Yeah, that's what I thought as well. |
All right. I worked a little bit on this today, as I finally had some spare time. However, I'm still unable to find the proper location to add the new logic. I am guessing it is close to Exactor.Operations.server_ref/2, but I am unsure what |
I pushed a small refactoring commit into a separate branch. With that change, the definition of the interface function for calls/casts is now done in the single place. Roughly speaking, you need to do the following. If
If I didn't try this out, so I might have missed some possible problems or fine-print details :-) You can cherry pick my commit into your branch, and then try to see if my proposal takes off. |
Right now, it is possible to either return a PID, or to register using
:global
or:via
. However, this needs to be given as option whenExActor.GenServer
is included (use
d).This unfortunately which means that it is impossible to build custom logic, to e.g. register at
{:via, Registry, {MyRegistry, "user_#{user_id}"}}
.Maybe, a possibility would be to allow users to write a custom
export
function, which is used for the different functions to transform the first argument into a term like above that could be used to do the actual GenServer dispatching on.The text was updated successfully, but these errors were encountered: