Comments (5)
Sorry to add this here: is there some forum/discord/... to ask questions? Like for RabbitMQ transport, I see that a dead-letter queue is created and associated. But I could not figure out what would trigger a message to be moved here like some maximum number of retries or anything.
For a test I adjusted the rabbitmq-transport.ts with the following code to send a message to the dead letter queue after the first retry which would do that:
async returnMessage(
message: TransportMessage<RabbitMqMessage>,
): Promise<void> {
if (message.raw.fields.redelivered) {
// Message retries exhausted, send to DLQ
this.logger.info(
'Message retry limit exceeded, sending to dead letter queue',
{ rawMessage: message.raw },
);
this.channel.nack(message.raw, undefined, false);
} else {
this.logger.debug('Returning message', { rawMessage: message.raw });
this.channel.nack(message.raw);
}
}
But are there any other configurations on the RabbitMQ setup level maybe to configure something?
from bus.
Hey @Zehelein, I tried this today and confirmed there is no DLQ routing using RabbitMQ. I've just added this in now and have released it in @node-ts/bus-rabbitmq:0.5.0
so if you upgrade your local package you should see this failing dead letters after the default 10 attempts.
The number of attempts is configurable as per RabbitMqTransportConfiguration.maxRetries
(https://node-ts.github.io/bus/packages/bus-rabbitmq/#configuration-options), and I've set up a quick demo of it working at node-ts/bus-starter#18 which is based of your other example.
Let me know how it goes, and thanks for letting me know!
from bus.
Hi, thanks for looking so fast into it and providing a fix! But I am not sure - I fear this fix is not working. I also checked this message.raw.fields.deliveryTag
but when I debugged/logged this tag then it would continue to increment. Meaning if I started with one message it was "1", and then the next failed had "2". It was not counting per message but per channel according to https://www.rabbitmq.com/confirms.html
This article seems to provide a few solutions - the ones with a bit of a delay in between would likely be nicer for transient errors.
from bus.
I think you're right, that delivery tag is what you describe. I had more of a read into how rabbit/amqp deals with retries and they all seem to defer this to the client (ie: they don't track retries themselves). There has been ongoing work in rabbit to support this, but there's only been a small amount of progress in the last couple of years and looks like it's currently just a feature for quorum queues.
Adding this to rabbitmq-transport.ts
means that a header should be incremented ("x-redelivery-count") on each receive, but this isn't possible without ack
the original message and publish a new message with the amendments. It feels quite hacky, and sends the message to the back of the queue (this can be good or bad depending on the use case).
I'm working on this implementation on https://github.com/node-ts/bus/compare/rabbitmq-message-receives but this seems to break the DLQ routing.
from bus.
Sorry I totally missed to provide the link to the article I was referring to:
https://engineering.nanit.com/rabbitmq-retries-the-full-story-ca4cc6c5b493
Maybe option 2 or 3 would be doable? Option 4 would depend on a plugin - not sure if that would be available in every setup.
from bus.
Related Issues (20)
- Construct workflows using container during mapping
- Port middleware over to master HOT 1
- RabbitMQ queue and exchange setup HOT 8
- The memory-queue is inappropriately deleting messages HOT 1
- Broken links in docs HOT 1
- Delay a retry by X seconds HOT 1
- Vulnerability in url-parse - dependency of amqplib HOT 1
- Rabbitmq transport polling HOT 2
- IoC with loopback HOT 4
- Named export <nameExport> not found HOT 2
- [bus-class-serializer]: package.json missing attributes HOT 1
- [Bug] Rabbitmq-transport.ts does not have reconnection if channel gets disconnected by some reasons
- How to setup DI container, when workflow needs the bus instance HOT 2
- Open to update `bus-sqs` to aws-sdk v3?
- Support Mognodb Persistence for Workflows
- RabbitMQ transport doesn't allow custom message headers. HOT 4
- Problem with lodash and persisting workflow state
- Stuck workflows with error: "No existing workflow state found for message. Ignoring"
- [Feat] Support passing message and message context to Container Adapter HOT 1
- Persistent messages are not supported. HOT 2
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 bus.