Closed hdiaz-nectia closed 3 years ago
Hi,
I need to know when the queue is empty, I'm trying to do reading the docs at https://github.com/bbc/sqs-consumer#options:
@SqsConsumerEventHandler(`${process.env.QUEUE_NAME}`, 'processing_error') public onProcessingError(error: Error, message: AWS.SQS.Message) { console.error(`Error reading message`, JSON.stringify(error)); } @SqsConsumerEventHandler(`${process.env.QUEUE_NAME}`, 'empty') public onEmpty() { console.log(`The queue is empty!`); }
The problem is that this log message is never printed to console. I've tried to test it adding messages to local queue and waiting for de empty event.
I use softwaremill/elasticmq docker image to run locally my queue.
I debug the library and I think the problem is in file sqs.services.js:
const eventMetadata = eventHandlers.find(({ meta }) => meta.name === name);
The find method get only first event, If I change order, empty event first in my class, the event empty is fired but the second not.
fix in new version
Hi,
I need to know when the queue is empty, I'm trying to do reading the docs at https://github.com/bbc/sqs-consumer#options:
The problem is that this log message is never printed to console. I've tried to test it adding messages to local queue and waiting for de empty event.
I use softwaremill/elasticmq docker image to run locally my queue.
I debug the library and I think the problem is in file sqs.services.js:
const eventMetadata = eventHandlers.find(({ meta }) => meta.name === name);
The find method get only first event, If I change order, empty event first in my class, the event empty is fired but the second not.