Extending Message Buses (Gateways)
Extending Command, Event, and Query Buses with custom Gateways
Last updated
Was this helpful?
Was this helpful?
#[CommandHandler]
public function placeOrder(PlaceOrder $command, AuditableEventBus $eventBus)
{
// place order
$eventBus->publish(new OrderWasPlaced());
}class Audit
{
#[Before(pointcut: AuditableEventBus::class)]
public function log(object $event, array $metadata) : void
{
// store audit
}
}#[Auditable]
interface AuditableEventBus extends EventBus {}class Audit
{
#[Before(pointcut: Auditable::class)]
public function log(object $event, array $metadata) : void
{
// store audit
}
}#[Asynchronous("async")]
interface OutboxCommandBus extends CommandBus
{
}