Comments (7)
Hi @apehead,
Thanks for the feature request. Unfortunately when you nack a message, you can't modify it. Hence it isn't possible to remove the immediateNack header. I'll leave the issue open and have a think about if there's an alternative approach that might work
from rascal.
One option might be for Rascal to optionally ignore the immediateNack header based on a configurable timeout. This would allow the message to be republished until the attempts expired, then immediately nacked. Providing it sits on the DLQ for longer than the timeout, the message could be moved back to the work queue without removing the immediateNack headers. It's not perfect, but could still be useful
from rascal.
A similar idea to explore is whether the x-death header could be used. E.g. immediateNack only works when the current number of x-death records is the same as when the message was republished with the immediateNack header.
from rascal.
@cressie176 thanks a ton for jumping in on this so quickly and offering up these ideas. Truly appreciated!
I've thought about the options you mentioned and they seem like good ideas.
I'm unsure which one offers greater control over message handling with less complexity for Rascal, so I trust your judgment.
I'm all in if you need a hand with testing or contributions.
from rascal.
Hi @apehead,
I took a look at this over the weekend. I think the x-death header is the way to go...
The x-death header is updated automatically when a message is nacked. It holds an array of records similar to the following...
[
{
count: 3,
exchange: '',
queue: 'work_queue',
reason: 'rejected',
'routing-keys': [ 'work_queue' ],
time: { '!': 'timestamp', value: 1715451949 }
},
{
count: 1,
exchange: '',
queue: 'other_queue',
reason: 'rejected',
'routing-keys': [ 'other_queue' ],
time: { '!': 'timestamp', value: 1715452131 }
}
]
The records in the array are keyed using the queue
and reason
fields, so repeated nacks for the same queue and reason will increment the count, rather than inserting a new record. When rascal rejects with an immediate nack, the reason is always "rejected".
Implementing this feature can be achieved by
- copying the relevant count into a new header
rascal.recovery.${queue}.rejected.count
where rascal sets the immediateNack header (or defaulting it to zero) See here. - ignoring and deleting the immediateNack header when the message's relevant x-death count header is greater than the recovery count stored in (1). See here
I think implementation will be straightforward, but the tests slightly cumbersome. I would expect coverage for
- No x-death header
- x-death header less than recovery count
- x-death header count equal to recovery count
- x-death header greater than recovery count
- ignores irrelevant x-death header
Added for both the callback and promise tests
I can't see a downside to this feature so I think it is worth changing the behaviour of the immediateNack option, rather than adding a new option. However the documentation will also need to be updated.
If you want to have a go, please do, otherwise I can probably get to it in the week.
from rascal.
Available in [email protected]
from rascal.
Thanks for the quick fix @cressie176! I really appreciate your dedication.
Sorry I couldn't contribute this time, but if there's another chance in the future, I'd love to help.
from rascal.
Related Issues (20)
- How to update subscriptions after use Broker.create(config) HOT 1
- MaxListenersExceededWarning HOT 4
- Config with only subscribers HOT 11
- Customize consumer tag HOT 2
- Failed to assert vhost: Timeout of 1000ms exceeded HOT 3
- How can I do multi-ack? HOT 6
- Potential messages multiply? HOT 21
- Rascal fatal error - Timed out waiting for broker to confirm publication HOT 3
- withDefaultConfig does not work properly with url connection strings HOT 3
- FEATURE: Consumer prefetch update? HOT 7
- Messages multiply in queues (part II) HOT 13
- No channels left to allocate HOT 3
- No channels left to allocate HOT 5
- Rascal connects to RabbitMQ stop receiving messages under high load HOT 13
- BUG: no way to use passwords in connection url that would make the url invalid HOT 3
- Rascal doesn't reconnect when connection with the broker is dropped HOT 6
- FEATURE: Add support for updatable authentication secrets
- FEATURE: Upgrade dependency superagent to v9.0.0+ to include vulnerability fix HOT 2
- FEATURE: Add NodeJS Streams support to subscriptions 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 rascal.