Message Router
Message Router PHP
class OrderRouter
{
#[Router("make.order")]
public function orderSpecificType(string $orderType) : string
{
return $orderType === 'coffee' ? "orderInCoffeeShop" : "orderInGeneralShop";
}
}Possible options
Routing to multiple Message Channels
class OrderRouter
{
#[Router("order.bought")]
public function distribute(string $order) : array
{
// list of Channel names to distribute Message too
return [
'audit.store',
'notification.send',
'order.close'
];
}
}What can be Router used for?
Own Bus implementation
Last updated
Was this helpful?