Last active
October 1, 2022 05:52
-
-
Save dgafka/7122ace92ea9d8e37c56bc876ea71480 to your computer and use it in GitHub Desktop.
loosely-coupled-microservices-03.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 | |
# For simplicity example of routing within single service. | |
# Next examples will show integration between services. | |
class OrderController | |
{ | |
public function placeOrder(Request $request, CommandBus $commandBus): void | |
{ | |
$commandBus->sendWithRouting("place_order", $request->getBody(), "application/json"); | |
} | |
} | |
class OrderService | |
{ | |
#[CommandHandler("place_order")] | |
public function placeOrder(PlaceOrder $command): void | |
{ | |
// place order | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment