This page refers to relevant documentation sections of SimpleBus and Enqueue projects.
To route messages via queue-interop they must be registered in container as asynchronous.
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>
XML definition example:
<service id="App\Listener\MailerListener" public="true">
<tag name="asynchronous_event_subscriber" subscribes_to="App\Event\UserCreated" method="onUserRegistered" />
</service>
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