-
-
Save dgafka/2cdab1d62d34288fe668dfab95fdd2ea to your computer and use it in GitHub Desktop.
outbox-pattern-04.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class OrderService | |
{ | |
#[Asynchronous("asychronous_orders")] | |
#[CommandHandler(endpointId:"handleOrders")] | |
public function (PlaceOrder $command) : void | |
{ | |
// We may decide to keep single consumer to keep ordering | |
} | |
#[Asynchronous("asychronous_emails")] | |
#[EventHandler(endpointId:"notifyEndpoint")] | |
public function notifyWhen(OrderWasPlaced $event) : void | |
{ | |
// Sending notifications can be scaled, as we may not care about ordering of messages | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment