Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Latest commit

 

History

History
64 lines (53 loc) · 2.53 KB

README.md

File metadata and controls

64 lines (53 loc) · 2.53 KB

Lamoda Tactician Queue Middleware

Build Status Scrutinizer Code Quality Code Coverage Build Status

Library provides middleware that gives you ability to execute commands via Tactician in async or delayed way

Installation

Composer

composer require lamoda/tactician-queue-bundle

Configuration

Before usage, please read the documentation for lamoda/queue-bundle

Bundle provides special middleware for tactician integration. This middleware add supports of async command execution, event with scheduling.

To enable this feature do the following:

  1. Add extra configuration:
    lamoda_tactician_queue:
        tactician_id: tactician.commandbus # Command bus service id
        command_serializer_id: lamoda_tactician_queue.default_command_serializer # Symfony serializer
    
  2. Add at least one strategy, that will convert commands into jobs:
    services:
        # ...
        several_domain_commands_strategy:
            class: Lamoda\TacticianQueue\Middleware\QueueProducerStrategy\CommandsListToCommandJobStrategy
            arguments:
                - async_command_queue
                - async_command_exchange
                - [ My\AsyncCommandInterface, My\SecondCommand ]
                - 15 # optional delay
            tags:
                - { name: tactician_queue.job_producing_strategy }
  3. Add queue middleware to the list of tactician middlewares:
    tactician:
        commandbus:
            default:
                middleware:
                    - tactician.middleware.locking
                    - lamoda_tactician_queue.middleware # Here it is
                    - tactician.middleware.command_handler
  4. Now every time you call
    <?php
    $commandBus->handle(new My\SecondCommand());
    this command will be published into the queue.