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 thephp-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:
1
$ composer require jwage/phpamqplib-messenger
Then, add the following configuration:
1 2 3 4 5 6 7 8 9 10 11
# 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!
Very cool, thanks! typo: and 7.4 versions should probably be 7.x or ^7.2 or ^7.0.
@Tac you are right. Symfony 7.4 is not ready yet (it will be released at the end of November 2025) but the intention of this package is to support that too alongside 5.4 and 6.4.
@javier this bundle actually supports all 7.x version, not just 7.4 (you can use it with Symfony 7.2 today). It think it would be good to change the blog post to say "Supports Symfony 5.4, 6.4 and 7.x versions" (which would reflect the actual compatibility defined in the composer constraint)
So beautiful. I saw the tweet you were announcing to build this. And I have been seeing the evolution on Github. So so awesome. I'll give it a try.
OK, I updated the post to mention "7.x" support. Thanks!
Will the documentation be updated with sending a batch of messages? I dont think any other transports supports that
@Martin it is mentioned in the documentation here https://github.com/jwage/phpamqplib-messenger/blob/main/docs/index.md