Thanks. I've been trying to set up Phoenix.PubSub.Redis as the adapter. but no luck so far.
It works locally but on heroku its throwing this error everytime:
Mon Apr 26 2021 16:19:54 unable to establish initial redis connection. Attempting to reconnect... metadata
Mon Apr 26 2021 16:19:57 failed to publish broadcast due to closed redis connection metadata
Its coming from this process:
pubsub: [ phoenix_pubsub: [ url: System.fetch_env!("REDIS_URL"), node_name: System.get_env("HEROKU_DYNO_ID", "default"), pool_size: String.to_integer(System.get_env("REDIS_POOL_SIZE", "10")) ] ]
Thanks in advance :smile:
defmodule MyApp.App do use Commanded.Application, otp_app: :my_app, event_store: [ adapter: Commanded.EventStore.Adapters.EventStore, event_store: MyApp.EventStore ] router(MyApp.ContextA.Router) router(MyApp.ContextB.Router) router(MyApp.ContextC.Router) # … etc end
It’s difficult to give guidance without knowing exactly what your domain is. Usually you want to design small, short lived aggregates with few events in their lifetime.
You can partition your application by service, context, tenant, etc. to improve performance by using a separate Commanded Application and EventStore for each. This will help to distribute load, processing, and event store read/writes.
I’ve written up the various architectural choices available.
process_statefunction on it but it might be easier to use the telemetry for it. Maybe that is a useful pointer and the better way to go for it:
test/process_managers/process_manager_telemetry_test.exsI think I would follow the telemetry path for debugging purposes.
Aggregate instances persist in memory indefinitely unless you implement the
An instance is started and its state is rebuilt from either a state snapshot + new events or all historical events on demand when a command is dispatched to it.
# config/test.exs config :my_app, env: :test