Componette

Componette

nepada

nepada / message-bus-nette v2.4.0

Integration of nepada/message-bus into Nette Framework.

download-cloud-line composer require nepada/message-bus-nette

Message Bus integration into Nette Framework

Build Status Coverage Status Downloads this Month Latest stable

Installation

Via Composer:

$ composer require nepada/message-bus-nette

Register the extension in config.neon:

extensions:
    messageBus: Nepada\MessageBusNette\DI\MessageBusExtension

Usage

See nepada/message-bus for the documentation of the core library.

Logging

The extension tries to autowire PSR compatible logger into logging middleware. If this doesn't work for you, specify the logger service in configuration explicitly:

messageBus:
    logger: @myLoggerService

Nested command handling

Nested command handling is not allowed by default, this can be changed in configuration:

messageBus:
    allowNestedCommandHandling: true

Doctrine

Doctrine ORM specific features for message bus are provided by nepada/message-bus-doctrine package. Follow the link for more detailed documentation. Once you install the package, it gets detected by DI extension and all necessary services are set up.

With Doctrine integration:

  • all commands are handled in a transaction and all changes are automatically flushed and commited after the handler successfully finishes, or rolled back on error,
  • database transactions started outside of command bus are forbidden,
  • entity manager is (optionally) cleared before and after the handling of every command.

Change or completely disable the default entity manager clearing logic:

messageBus:
    clearEntityManager
        onStart: false
        onSuccess: false
        onError: false

You can record your domain events inside entities implementing Nepada\Bridges\MessageBusDoctrine\Events\ContainsRecordedEvents and they will be automatically collected and dispatched on flush.

Tip: use SearchExtension to auto-register command handlers and event subscribers

search:
    messageBusHandlers:
        in: %appDir%
        implements:
            - Nepada\MessageBus\Commands\CommandHandler
            - Nepada\MessageBus\Events\EventSubscriber
  • v2.4.0 2.4.0

    • Drop PHP 8.1 support
    • Add support for nepada/message-bus 3.x and symfony/messenger 7.x
    • Compatibility with Doctrine ORM 3.x
  • v2.3.0 2.3.0

    • Drop support for PHP <8.1
    • Add bleedingEdge configuration flag to allow opt-in into extra validation rules of message-bus
    • Drop useless annotations
    • PHP 8.3 compatibility
  • v2.2.3 2.2.3

    • Allow nette/utils 4
  • v2.2.2 2.2.2

    • PHP 8.2 compatibility
  • v2.2.1 2.2.1

    • Symfony 6 support.
  • v2.2.0 2.2.0

    • PHP 8.1 compatibility.
    • Add support for psr/container 2.x.
    • Require at least psr/container 1.1.
    • Improve README examples.
  • v2.1.0 2.1.0

    • PHP 8.0 compatiblity.
  • v2.0.0 2.0.0

    • Initial public release.
price-tag-2-line

Badges

guide-fill

Dependencies

php (>=7.4.0)
nette/di (^3.0.1@dev)
nette/utils (^3.0@dev)
nette/schema (^1.0.2@dev)
psr/container (^1.0@dev)
Componette Componette felix@nette.org