-
Notifications
You must be signed in to change notification settings - Fork 247
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
feat: default aggregate lifespan configuration #548
feat: default aggregate lifespan configuration #548
Conversation
The feature is NOT finished (draft), but I would like to understand the expectations from the API perspective. Opening the conversation to the public! Due to the multi-tenancy architecture, I like the idea of having a way to control the global configuration as well as routing. When it comes to the routing, I am not sure if use I am not sure, I opened to gather feedback about the direction of the feature. |
The two changes we want to make are to modify the default aggregate lifespan behaviour defined by Commanded to not keep aggregate processes running indefinitely and to allow this default to be configured per Commanded Application. We can do this by changing the Secondly, we want to make the default aggregate timeout configurable per Commanded Application. This configuration could be set either in the # Configured by `use` macro
defmodule MyApp.Application do
use Commanded.Application,
otp_app: :my_app,
aggregate_default_lifespan: MyDefaultAggregateLifespan
end # Configured by config file (config/config.exs)
config :my_app, MyApp.Application, aggregate_default_lifespan: MyDefaultAggregateLifespan # Configured at runtime
defmodule MyApp.Application do
use Commanded.Application, otp_app: :my_app
def init(config) do
config = Keyword.put(config, :aggregate_default_lifespan, MyDefaultAggregateLifespan)
{:ok, config}
end
end |
f9fa176
to
1626250
Compare
The following, use Commanded.Application,
otp_app: :my_app,
aggregate_default_lifespan: MyDefaultAggregateLifespan That could be done using use Commanded.Application,
otp_app: :my_app,
default_dispatch_opts: [lifespan: MyDefaultAggregateLifespan] |
config :my_app, MyApp.Application, aggregate_default_lifespan: MyDefaultAggregateLifespan This is done, fallback to |
5311eb1
to
72f9c6f
Compare
Runtime (init) should be handle by the same def init(config) do
config =
Keyword.update(
config,
:default_dispatch_opts,
[],
&Keyword.put(&1, :lifespan, MyDefaultAggregateLifespan)
)
{:ok, config}
end No?! |
I think that such Regardless, do we really need to add every possible combination or should we be pragmatic about it until somebody ask to add more things? |
Signed-off-by: Yordis Prieto <[email protected]>
72f9c6f
to
c6167da
Compare
No description provided.