The Transactional Messenger
component allows make messenger transactional
The recommended way to install is through Composer:
composer require frzb/transactional-messenger
It requires PHP version 8.2 and higher.
#[Transactional]
will automatically create and close transaction for your messages,
By default CommitType
is CommitType::OnTerminate
CommitType::OnTerminate
for requests, executes when response is sent without exceptionsCommitType::OnResponse
for requests, executes when request end without exceptionsCommitType::onHandled
for consumers, executes when message successfully handled
FRZB\Component\TransactionalMessenger\Event\DispatchSucceedEvent
executes when message is dispatchedFRZB\Component\TransactionalMessenger\Event\DispatchFailedEvent
executes when message is failure
<?php
use \FRZB\Component\TransactionalMessenger\Attribute\Transactional;
#[Transactional]
final class CreateUserMessage {
public function __construct(
public readonly string $id,
public readonly string $name,
) {
}
}