HandleTrait
Leverages a message bus to expect a single, synchronous message handling and return its result.
Tags
Table of Contents
Properties
- $messageBus : mixed
Methods
- handle() : mixed
- Dispatches the given message, expecting to be handled by a single handler and returns the result from the handler returned value.
Properties
$messageBus
private
mixed
$messageBus
Methods
handle()
Dispatches the given message, expecting to be handled by a single handler and returns the result from the handler returned value.
private
handle(object|Envelope $message) : mixed
This behavior is useful for both synchronous command & query buses, the last one usually returning the handler result.
Parameters
- $message : object|Envelope
-
The message or the message pre-wrapped in an envelope