Skip to content

The TransactionalMessenger component allows make messenger transactional

License

Notifications You must be signed in to change notification settings

fractalzombie/frzb-transactional-messenger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Transactional Messenger Component

Workflow Build Status Scrutinizer Code Quality Code Intelligence Status Build Status Coverage Status Quality Gate Status Bugs Security Rating Maintainability Rating Code Smells Lines of Code Coverage Technical Debt Reliability Rating Duplicated Lines (%) Vulnerabilities

The Transactional Messenger component allows make messenger transactional

Installation

The recommended way to install is through Composer:

composer require frzb/transactional-messenger

It requires PHP version 8.2 and higher.

Usage #[Transactional]

#[Transactional] will automatically create and close transaction for your messages, By default CommitType is CommitType::OnTerminate

CommitTypes

  • CommitType::OnTerminate for requests, executes when response is sent without exceptions
  • CommitType::OnResponse for requests, executes when request end without exceptions
  • CommitType::onHandled for consumers, executes when message successfully handled

Events

  • FRZB\Component\TransactionalMessenger\Event\DispatchSucceedEvent executes when message is dispatched
  • FRZB\Component\TransactionalMessenger\Event\DispatchFailedEvent executes when message is failure

Example

<?php

use \FRZB\Component\TransactionalMessenger\Attribute\Transactional;

#[Transactional]
final class CreateUserMessage {
    public function __construct(
        public readonly string $id,
        public readonly string $name,
    ) {
    }
}

Resources

Contributions

Alt

About

The TransactionalMessenger component allows make messenger transactional

Resources

License

Stars

Watchers

Forks

Packages

No packages published