Comments (6)
It supports dead lettering by configuration:
old_sound_rabbit_mq:
producers:
work_producer:
connection: default
exchange_options: {name: work-exchange, type: direct}
consumers:
work_consumer:
connection: default
exchange_options: {name: work-exchange, type: direct}
queue_options: {name: work-queue, arguments: {'x-dead-letter-exchange': ['S', 'error-exchange']}}
callback: work_consumer_callback
error_consumer:
connection: default
exchange_options: {name: error-exchange, type: direct}
queue_options: {name: error-queue}
callback: error_consumer_callback
So if you publish a message with the work consumer and the message gets rejected, RabbitMQ will transfer the message to the error_queue.
Note: Currently you can not reject the message with requeue=false using this bundle. You can configure a TTL for the message but your consumer will redo the message until TTL is reached. An example for the above with a TTL of 5 sec.
queue_options: {name: work-queue, arguments: {'x-dead-letter-exchange': ['S', 'error-exchange'], 'x-message-ttl': ['I', 5000]}}
An improvement to reject messages with requeue=false is in this pull request https://github.com/videlalvaro/RabbitMqBundle/pull/109
from rabbitmqbundle.
Hi, since pull request is closed for about 5 months then is this working? Can you reject message with requeue=false?
EDIT: Just checked this out - it works! Thanks! :)
from rabbitmqbundle.
Hey all,
I'm aware this is a very old issue, but the solution doesn't seem to cover all use-cases.
In the scenario where my route is to publish a message to a fanout exchange, wherein one of a number of consumers fails, I want to dead-letter that message to the DLX - which is of type 'topic' - to a queue of a similar name as the original.
The config format here seems to be restricted to just one queue per DLX. Moreover, the example given, the error_consumer is at the same level of nesting as the 'consumers' key, but it needs to fall under that level of nesting.
Furthermore, there should ideally be more than one error_consumer block allowed as well, so that logical grouping can occur (allowing for multiple DLXs). This example might help explain what I mean:
I have two ways to create an order - the UI and an API. I have two inbound exchanges which are pushed to when an order has been created via either method:
- order.created
- order.api.created
Both of these exchanges are of type fanout, and both have the same three queues bound to them:
- send_email
- send_sms
- add_note
In every scenario, let's assume that the latter two consumers work just fine, but sending an email is broken. After my TTL expires for each of them, they automatically get pushed to their respective DLX, order.created.dead_lettered or order.api.created.dead_lettered.
Both of these exchanges are of type topic, and the messages are dead-lettered with the routing key 'send_email' - the same as the original queue.
In each DLX, there are the following queues, and associated routing keys:
- send_email.failed - send_email
- send_sms.failed - send_sms
- add_note.failed - add_note
So, to summarize, the config would need to allow for:
- Multiple DLXs
- Multiple queues per DLX (to support type of 'topic' and 'fanout')
The reason for two exchanges is to logically separate the two types of message - despite them currently being routed to the same three queues. In future, they may warrant their own queues, or queues which are specific to the order creation source (UI or API) alongside the more generic queues (think if the message format is different between the two).
As it stands, we have to specify one - and only one - DLX and DLX queue per config as I understand it, meaning that the other DLXs, and any additional DLX queues, need to be defined manually and wont be captured in the 'setup-fabric' call.
from rabbitmqbundle.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
from rabbitmqbundle.
This issue was closed because it has been stalled for 10 days with no activity.
from rabbitmqbundle.
It supports dead lettering by configuration:
old_sound_rabbit_mq: producers: work_producer: connection: default exchange_options: {name: work-exchange, type: direct} consumers: work_consumer: connection: default exchange_options: {name: work-exchange, type: direct} queue_options: {name: work-queue, arguments: {'x-dead-letter-exchange': ['S', 'error-exchange']}} callback: work_consumer_callback error_consumer: connection: default exchange_options: {name: error-exchange, type: direct} queue_options: {name: error-queue} callback: error_consumer_callbackSo if you publish a message with the work consumer and the message gets rejected, RabbitMQ will transfer the message to the error_queue.
Note: Currently you can not reject the message with requeue=false using this bundle. You can configure a TTL for the message but your consumer will redo the message until TTL is reached. An example for the above with a TTL of 5 sec.
queue_options: {name: work-queue, arguments: {'x-dead-letter-exchange': ['S', 'error-exchange'], 'x-message-ttl': ['I', 5000]}}An improvement to reject messages with requeue=false is in this pull request https://github.com/videlalvaro/RabbitMqBundle/pull/109
Thanks for the comment. Spent half a day trying to figure out how to make it work with this bundle realising that it doesn't really work as per RabbitMQ documentation.
from rabbitmqbundle.
Related Issues (20)
- Drop unsupported PHP versions HOT 1
- Drop unsupported Symfony versions HOT 1
- Cosumer Argument x-single-active-consumer HOT 6
- Invalid frame type 21 HOT 1
- Feature suggestion: add producer with batch producing capabilities HOT 4
- Update documentation for Symfony 6 HOT 5
- BaseAmqp closing connection in destructor HOT 2
- 1 Request 2 Record HOT 2
- Consumer disconnect event HOT 4
- ConsumerInterface service is not valid value for RPC server callback HOT 2
- How can i overwrite events? HOT 2
- Support to PHP 8.1 and Symfony 6.2 HOT 2
- Invalid signature of OldSound\RabbitMqBundle\RabbitMq\ProducerInterface HOT 2
- Symfony deprecations HOT 4
- Is it possible to use "PhpAmqpLib\Connection\AMQPConnectionFactory" instead of "AMQOldSound\RabbitMqBundle\RabbitMq\AMQPConnectionFactory"
- Symfony 5.2 pcntl_async_signals default changed HOT 2
- Add `--memory-limit` to `rabbitmq:rpc-server` HOT 7
- Has the package lost support? HOT 3
- Add "no_ack" consumer option (feature request) HOT 3
- Symfony 7.0 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rabbitmqbundle.