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

Latest commit

 

History

History
50 lines (35 loc) · 1.61 KB

File metadata and controls

50 lines (35 loc) · 1.61 KB

Usage

This page refers to relevant documentation sections of SimpleBus and Enqueue projects.

SimpleBus

To route messages via queue-interop they must be registered in container as asynchronous.

Commands

XML definition example:

<service id="App\Handler\RegisterTransactionHandler" public="true">
    <tag name="asynchronous_command_handler" handles="App\Handler\RegisterTransaction" method="registerTransaction" />
</service>

<!-- Attribute 'method' can be omitted if handler implements __invoke() -->

<service id="App\Handler\RegisterTransactionHandler" public="true">
    <tag name="asynchronous_command_handler" handles="App\Handler\RegisterTransaction" />
</service>

Events

XML definition example:

<service id="App\Listener\MailerListener" public="true">
    <tag name="asynchronous_event_subscriber" subscribes_to="App\Event\UserCreated" method="onUserRegistered" />
</service>

Production

Read Enqueue documentation regarding running queue consumer in production.

Example supervisord config:

[program:domain_events]
command=./bin/console enqueue:transport:consume enqueue.simple_bus.events_processor --queue=domain_events --time-limit=15minutes --idle-timeout=1000
directory = /var/www/project/prod/current
user = symfony
autostart = true
autorestart = true
stderr_logfile = /var/log/supervisor/domain_events-stderr.log
stdout_logfile = /var/log/supervisor/domain_events-stdout.log