Created
September 30, 2022 18:41
-
-
Save dgafka/c2562c118e27e4036beb230d2e1b980a to your computer and use it in GitHub Desktop.
loosely-coupled-microservices-05.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 | |
{ | |
#[EventHandler] | |
public function placeOrder(OrderWasPlaced $event, DistributedBus $distributedBus, OrderRepository $orderRepository): void | |
{ | |
$order = $orderRepository->get($event->orderId()); | |
$distributedBus->convertAndPublishEvent("order.was_placed",[ | |
"orderId" => $event->orderId(), | |
"hadPromotion" => $order->hasPromotion() | |
]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment