Closed heroic closed 3 years ago
Hi @heroic ,
Can you share the code you are using to ackOrNack with the error please?
Also can you set the DEBUG
environment variable to rascal:SubscriberError
and share the output.
Hi @cressie176
Logs:
a9102727-cf5c-4641-bea6-cbde38c662c6 Error Processing
rascal:SubscriberError Handling subscriber error for message: a9102727-cf5c-4641-bea6-cbde38c662c6 +0ms
rascal:SubscriberError Attempting to recover message: a9102727-cf5c-4641-bea6-cbde38c662c6 using strategy: fallback-nack +3ms
rascal:SubscriberError Message: a9102727-cf5c-4641-bea6-cbde38c662c6 was recovered using stragegy: fallback-nack +8ms
Code:
broker.subscribe('consumer').then(subscription => subscription.on('message', async (message, content, ackOrNack) => {
console.log(message.properties.messageId, 'Got data', content);
return handler(content.name, content.args).then(result => {
if (result === true) {
console.log(message.properties.messageId, 'Finished Processing', result);
return ackOrNack()
} else {
throw new Error(result)
}
}).catch((e) => {
console.log(message.properties.messageId, 'Error Processing', e.message);
return ackOrNack(e)
});
}).on('error', console.error))
Hi @heroic, you need to specify the recovery strategy when rejecting a message. Because you aren't doing this, rascal is using the default "fallback" recovery strategy, which is a nack. See here.
aah ok! I assumed it will follow the recovery strategies as in the configuration in the order they were added. got it!
I agree it's odd that they are not really part of the rascal configuration. I could consider overloading ackOrNack so it accepted a recovery strategy profile name, which it attempted to find in config.
ackOrNack(err, 'dead_letter');
I tried to follow the advanced example to setup rascal. However it seems, the failed messages are being directly sent to dead letter without retries.
Tried to follow the example to see if if I missed anything, but doesn't appear so.