Messenger - компонент для асинхронной обработки сообщений (аналог Laravel Queues):
// Message
class SendNotification {
public function __construct(public int $userId, public string $text) {}
}
// Handler
#[AsMessageHandler]
class SendNotificationHandler {
public function __invoke(SendNotification $msg): void {
$this->notifier->send($msg->userId, $msg->text);
}
}
// Dispatch
$bus->dispatch(new SendNotification(42, 'Hello'));Транспорты: AMQP (RabbitMQ), Redis, Doctrine, Amazon SQS, Kafka. Поддерживает middleware, retry, dead letter queue.