Skip to content

Instantly share code, notes, and snippets.

@dgafka
Last active January 15, 2023 10:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgafka/2cdab1d62d34288fe668dfab95fdd2ea to your computer and use it in GitHub Desktop.
Save dgafka/2cdab1d62d34288fe668dfab95fdd2ea to your computer and use it in GitHub Desktop.
outbox-pattern-04.php
<?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