Skip to content

Instantly share code, notes, and snippets.

@dgafka
Created January 16, 2022 19:01
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/abaef32ed247c970dc9776d8189254d0 to your computer and use it in GitHub Desktop.
Save dgafka/abaef32ed247c970dc9776d8189254d0 to your computer and use it in GitHub Desktop.
microservices-integration-in-php-08.php
<?php
class UserService
{
public function __construct(private DistributedBus $distributedBus) {}
public function banUser(int $personId, int $executorId): void
{
$this->distributedBus->publishEvent(
"user.was_banned",
\json_encode(["personId" => $personId]),
"application/json",
["executorId" => $executorId]
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment