Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Concurrent, Isolated commanded apps #117
This is a very hard thing to implement, but lets discuss it
One of the biggest problems of commanded right now (to me at least) is the "global" nature of it. Right now we configure an app using configs and that means that we can have only one instance per app (including umbrella apps).
This also makes testing very hard since we cannot run tests concurrently and we have to always reset the event store to ensure tests doesn't interfere with one another.
Another thing, as pointed by #113 is that we may want to have different EventStores per app.
Right now, the only way of having "different applications" is to use multiple routers, however, they all use the same eventstore, then the applications are not isolated (although it may be a good idea to have them connected through the same eventstore so we can have shared subscriptions to allow event-collaboration workflows, otherwise people would need some kind of integration middleware to propagate events)
Summing up, my goals are (in no specific order):
Just a fast overview so we know where we need to make changes
@slashdotdash please correct me where I'm wrong, which is probably in a lot of places since this is my fast overview over the code
A commanded application can be said to be composed by (and some other pieces):
The processes involved are generaly
Right now, the entrypoint for the application is the router.
defmodule MyApplication use Commanded, router: MyRouter, event_store: MyEventStore end
There would be three modus operandis:
my_app = MyApp.start_link MyApp.dispatch(cmd, application: my_app)
As it is
The way it works is as follows:
MyApp.dispatch is the same thing as the router, however, it looks up for the global application scoping by application module name (MyApp, MyOtherApp, etc) but also accepts the myapp pid.
There a lot of places in the codebase where we use global registries. We may need to allow scoping these registries using Module names and pids. This includes:
There is also a require a change on how the commanded application is started.
We may want to have a look at how
referenced this issue
Mar 3, 2018
@bamorim Just want to clarify that I run http://eventstore.org - which provides tcp or http endpoints. The language I use has an adapter for it. I use docker-compose for configuration. Manually hooking things up was a nightmare.
Something you said didn't sit right with me - different EventStores per app. I'm not sure I understand how this would work in the case of, for example, absolute event ordering requirements. If no such requirement exists - sounds like you just have different systems altogether, that should not even be part of the same codebase/repo. Sorry, maybe I misunderstood something.