-
Notifications
You must be signed in to change notification settings - Fork 10
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 in event-engine #7
Comments
Hi, ProcessManagers listen on events If a process manager should dispatch a new command handled by the same app, you can also use a short cut by returning a command from a static method: final class MyProcessManager
{
public static function onSomethingHappened(Message $somethingHappened): array
{
// Return command tuple (when using PrototypingFlavour or a command instance for other Flavour)
return [
Command::DO_SOEMTHING_AFTER_EVENT,
$somethingHappend->payload(), // Map payload from event to command if needed
[ /* optional metadata array */ ]
];
}
}
// Register the process manager in a Description using callable array syntax
$eventEngine->on(Event::SOMETHING_HAPPENED, [MyProcessManager::class, 'onSomethingHappened']); The short cut is not documented yet as this is a relatively new feature. The way shown in the Tutorial is the preferred way when the process manager requires dependencies. With the short cut you avoid the round trip to the DI container which is nice for simple IF THIS THAN THAT scenarios. |
Thank you very much for the explanation! I forgot that their was a process manager subtitle in the tutorial. |
Hello,
Is it possible to use some sort of process manager for the generated events?
Thx in advance,
Arne
The text was updated successfully, but these errors were encountered: