-
Notifications
You must be signed in to change notification settings - Fork 237
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
Add initialize/1 handler callback #526
base: master
Are you sure you want to change the base?
Conversation
Is there any particular reason why it can not be |
Because there is already an init/1 😅😅 |
It's rather confusing, init/1 is called to get the config (outside the handler process) and init/0 is called inside the handlers process |
So you can not use the existing Also, confusing, I agree! |
Yes but then that would be a breaking change, because the meaning (and where the function is called) would have to change. So I thought it would be better to have a new callback, where we get rid of init/0 in the future. |
Maybe use a completely different name, like |
Having three similarly named functions is too confusing ( The The We could deprecate the @callback after_start() :: :ok | {:stop, reason :: any()}
@callback after_start(state :: any()) :: :ok | {:stop, reason :: any()} For backwards compatibility we could call the |
That sounds like a good idea! But do we need |
This PR replaces the
init/0
callback withinitialize/1
(using the old callback still works). In this way, you can for example use ecto dynamic repos withCommanded.Projections.Ecto
, e.g.