commanded / commanded

Use Commanded to build Elixir CQRS/ES applications

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

please support multiple commanded application with one eventstore

taverngoal opened this issue · comments

I found the eventstore will be spawned by event_store_child_spec of Commanded.Application.Supervisor#init

is there any way let eventstore spawned by myself, just pass it to Commanded.Application config?

so, I can have multiple Commanded Application in different modules, but the same event source. I want module A listen events of module B, and module A dependency B. module A and B have the same eventstore, the same database connection.

thanks 😊

If that is the case, what is the motivation to have multiple Apps instead of Routers per Module and a single App?

Based on the information shared, it doesn’t sound proper to me.

Thanks for reply

I have a multi-module in an umbrella project, modules have some dependencies with each other. such as Notification Module, Order Module and Payment Module. Notification will listen event of Order and Payment, and notify users. three modules have it owned Commanded Application and eventstore. if so, they can't listen events each other(different eventstore).
but, the three Commanded Application with the same eventstore,it works. (I can put eventstore application to a common dependency module.)

I know, this is not best practice of commanded probably. or there is any way could let Notification Module listen events from difference event source by eventstore? I could avoid building message queue service 😊

Perhaps I could use eventstore Subscription separately, but I really like EventHandler of Commanded, especially the whole moduels have Commanded Application.

Are you deploying 3 different apps or just one?

Just one app. modules in same deploying. Notification Module, Order Module and Payment Module have different projection db but prefer the same eventstore.

Then I do not see why you would want a different Commanded.Application for each module.

For this particular situation, it sounds like an anti-pattern that I would probably recommend removing, personally speaking, and composing the routers into a single Commanded.Application module.

Being said, maybe they would take your suggestion 🤷🏻‍♂️; just trying to help you based on my experience.

Thanks for your suggest 😄