weyoss / redis-smq

A simple high-performance Redis message queue for Node.js.
MIT License
588 stars 64 forks source link

How to delete message in consumer #96

Closed meawadhesh closed 1 year ago

meawadhesh commented 1 year ago

Hi, thanks for the amazing library. I scheduled message at particular time and i would like to delete after 1 execution of scheduled time in consumer consumer.consume here i have message with dynamic data. how to delete a particular message?

weyoss commented 1 year ago

@meawadhesh Hey! Thank you for opening this issue.

Hi, thanks for the amazing library.

I am glad that you are using it.

I scheduled message at particular time and i would like to delete after 1 execution of scheduled time in consumer consumer.consume here i have message with dynamic data. how to delete a particular message?

There are 2 types of scheduled messages:

A one time scheduled message is deleted from the scheduled messages queue once its scheduled timestamp expires. So there is no need to manually delete it.

A periodic scheduled message can be deleted from scheduled messages queue by its ID using MessageManager.prototype.scheduledMessages.delete().

weyoss commented 1 year ago

A one time scheduled message is deleted from the scheduled messages queue once its scheduled timestamp expires. So there is no need to manually delete it.

it is worth to mention that a one time scheduled message can also be manually deleted, given that at the deletion time the message is still in the scheduled messages queue.

weyoss commented 1 year ago

Closing as resolved.

meawadhesh commented 1 year ago

Hi, Thanks for the reply. I'll implement this asap.