Download the PHP package jimphle/messaging without Composer
On this page you can find all versions of the php package jimphle/messaging. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jimphle/messaging
More information about jimphle/messaging
Files in jimphle/messaging
Package messaging
Short Description Jimdo PHP library extraction of messaging component
License MIT
Homepage https://github.com/Jimdo/jimphle-messaging
Informations about the package messaging
Jimphle-messaging
Jimdo PHP library extraction of messaging component.
The Messaging component is base on message-handler which implement the MessageHandler Interface.
Handling commands and events
Let's get started with sending a command say-hello:
Ok what happened here? We passed the Command say-hello and it's payload to the messagingContext. The messagingContext did a lookup for A MessageHandler registered to say-hello.
Something more interesting. If you had a look at the SayHelloHandler you would have seen that the handler itself generated a new Event which is returned with the MessageResponse "to-be-processed-directly" by the calling context. To make our messagingContext to be able to handle this kind of messages we have to add another kind of handler.
As you can see Our said-hello Event is handled by the messagingContext now. Which means the messagingContext handles the SayHelloHandler iterates over the returned "to-be-processed-directly" events and tries to handle them as well. How you may have noticed the order of the printed messages is reversed to the order the printing handlers are called. This happens because the response of the first called message-handler is the one which is returned here.
Message-filter and message-handler annotations
If you add the ApplyFilter MessageHandler to the messagingContext you add the possibility to apply filter to a message before passing it to the next message-handler.
However there are two predefined filter we can use here:
- The Validation filter, based on Symfony-Validation-Component
- The Authorization filter explained here another day
Handling messages in a PDO transaction
To handle the messages in a PDO transaction we can add the TransactionalMessageHandler to the messagingContext.
To execute a message handler in a pdo transaction you just have to add an annotation.