Introducing A Streaming AMQP Transport for Symfony Messenger


Symfony's Messenger component makes it easy to build message-driven
applications. However, developers using symfony/amqp-messenger have long
faced a limitation: it relies on polling (get()), which can lead to high
server load and doesn't scale well with a high number of workers.
Today, we're excited to introduce a new Messenger transport based on
php-amqplib/php-amqplib instead of the php-amqp C extension. The result?
A high-performance, streaming AMQP transport that solves many long-standing
issues with the default AMQP transport.

Why This Bundle Exists
We needed a Messenger transport that supports streaming (consume())
instead of polling (get()), especially for high-throughput applications.
Polling-based solutions generate unnecessary load on RabbitMQ servers and waste
compute cycles on idle workers. With this new transport, RabbitMQ pushes
messages to consumers over long-lived TCP connections, reducing both latency and
resource usage.

Key Benefits

  • Compatibility: Supports Symfony 5.4, 6.4 and 7.x versions.
  • Streaming instead of polling: Efficient, low-latency message delivery.
  • No C extension required: Uses php-amqplib, making it compatible with
    environments where the php-amqp extension isn't available.
  • Better header-based routing: Improved support for message routing via
    headers.
  • Batch message publishing: Send many messages in one go.
  • Retry logic: Full support for Symfony Messenger's failure transport and
    retry strategies.
  • Delayed messages: Built-in support for delay queues.

Getting Started
First, run this command to install the new transport:

$ composer require jwage/phpamqplib-messenger

Then, add the following configuration:

# config/packages/messenger.yaml
framework:
messenger:
transports:
async:
dsn: 'phpamqplib://localhost/myvhost/messages'
options:
exchange:
name: async_exchange
queues:
async_messages: ~

To migrate from symfony/amqp-messenger, update your DSN from amqp:// or
amqps:// to phpamqplib:// or phpamqplibs://, and adjust the
configuration as shown above.

Feedback Wanted!
This bundle is still under active development but is getting close to a stable
release. We need your help testing it in real-world applications. If you're
currently using Symfony Messenger with RabbitMQ, this bundle should work as a
drop-in replacement with minimal configuration changes.
We're especially interested in feedback from:

  • Applications with complex routing setups
  • High-throughput systems
  • Apps with many message handlers and real-world logic

Report issues, feature requests, or success stories on the GitHub
repository:
https://github.com/jwage/phpamqplib-messenger
Thanks for giving it a try!

Sponsor the Symfony project.