Event Bus
is special type of Messaging Gateway. Command Handlers,
routed by name and converted using Converter if needed.
Sending events by name instead of class type, may be found useful in integration with external application, when events are in different Media Type than PHP class. class type hinted
in method declaration of Event Handler. You could also use in here simple array
if you have JSON
to array
Converter or a string
, if you like to receive JSON string
.Ecotone
does provide possibility to automatically gather events from Aggregate
and publish them using EventBus.
Ecotone
, which method it should use for retrieving Event objects when using State-Stored Aggregate mark method containing events with annotation @AggregateEvents.
After handling Command
or Event
on Aggregate
events will be published. WithAggregateEvent
If you want to record event for publication just use record
method.Event Bus.
#[NamedEvent("order_was_placed")]
class OrderWasPlaced