Skip to content
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

Process Manager Plugin #181

Closed
oqq opened this issue Jan 31, 2018 · 4 comments
Closed

Process Manager Plugin #181

oqq opened this issue Jan 31, 2018 · 4 comments

Comments

@oqq
Copy link
Member

oqq commented Jan 31, 2018

I would really like it to implement an process manager plugin to the prooph components.
This plugin

  • attaches to the event bus
  • throw events to connected process managers
  • collects commands returned by the manager
  • throws commands in the command bus

Here is a gist with a simplified implementation.
https://gist.github.com/oqq/539de0022ef6f75f7cf4fbc112721b42

There are some open questions.
Maybe we need a CommandCollection which could returned by the process managers instead of an iterable. Also, maybe we need a ProcessManagerInterface.

@prolic @codeliner any thoughts about that?

@codeliner
Copy link
Member

TBH I never had the feeling that we need a process manager plugin. Normally I configure a process manager as event listener and inject the command bus as a dependency. Process maangers are just a few lines of code and if your DI container supports abstract factories you can even reduce boilerplate with your own process manager marker interface and an abstract factory that injects the bus into each manager.

The logic in the gist is more or less the logic from the event router mixed with a command bus dispatch, but what do you doe when you use multiple command buses? How should the generic process manager know which command should be put on which command bus?

I think this abstraction is a good idea for a project specific plugin where you know if only one command bus is in use. But for prooph as a library with many different use cases we just introduce another thing to maintain and I bet that it would not take long until the first one asks in the chat how to combine that with multiple command buses.

Also if we introduce a process manager implementation we would also need to introduce a saga implementation to complete the picture. Again I think both concepts are better placed in project specific plugins.

@oqq
Copy link
Member Author

oqq commented Feb 2, 2018

The main reason why i would not create process managers with an command bus dependency is the hard coupling to prooph components.

Process managers are objects of the domain and I always try to handle domain objects free from any dependencies not part of the domain.

A process manager should not have any addiction to a command bus at all, but only "GET EVENTS, ANSWER WITH COMMANDS".

BTW, i am currently not able to configure a whole application with multiple command, event and query busses.

I see this plugin more in the event bus bridge environment.

@codeliner
Copy link
Member

I think this abstraction is a good idea for a project specific plugin

@prolic
Copy link
Member

prolic commented Feb 3, 2018

Agree with @codeliner, this is nothing prooph should provide itself, but it would be a great blog post on how to do that.

@prolic prolic closed this as completed Feb 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants