Skip to content

Instantly share code, notes, and snippets.

@dgafka
Last active October 1, 2022 05:52
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/7122ace92ea9d8e37c56bc876ea71480 to your computer and use it in GitHub Desktop.
Save dgafka/7122ace92ea9d8e37c56bc876ea71480 to your computer and use it in GitHub Desktop.
loosely-coupled-microservices-03.php
<?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