sonus21 / rqueue

Rqueue aka Redis Queue [Task Queue, Message Broker] for Spring framework
https://sonus21.github.io/rqueue
Apache License 2.0
335 stars 57 forks source link

Procedure for immediate deletion of message from queue. #236

Closed Prachil-MI closed 2 weeks ago

Prachil-MI commented 1 month ago

What's not working?

Used following method to delete a message from queue.

rqueueMessageManager.deleteMessage(Queue.DATA_SOURCE_PROCESSING, QUEUE_PRIORITY_LOW,
                    processingLogId);

The message is marked as deleted. But it is not removed immediately. I am assuming that this is the intended behaviour.

Questions:

  1. What are the steps to achieve its immediate deletion?
  2. If there is no way as of now, can it be achieved via following method? If yes, what are the steps? How the object name and metadata are constructed?
// factory is an instance of `SimpleRqueueListenerContainerFactory`
factory.setManualDeletionMessageProcessor()
  1. If above two methods are not the correct choice, are there any alternatives?

What're application dependencies ?

How to Reproduce (optional)?

Additional Details (optional)

Make sure to use priority while enqueueing the message.

sonus21 commented 1 month ago

@Prachil-MI , if you call a message to be deleted, its deleted it should not be consumed by the application in anyway. Are you observing a different behaviour?

Prachil-MI commented 1 month ago

@sonus21 Correct. That is the expected behaviour. The application does not use the message in any way. But the message is held in Redis for 30 minutes. The metadata and the message has a field deleted: true.

Since the message stays in Redis for 30 minutes, the Redis memory is not usable during that period of time.

sonus21 commented 1 month ago

@Prachil-MI do you've a usecase where you delete large number of messages in short duration? I expected this feature to be used once in a while or on rare occasions.

Prachil-MI commented 1 month ago

@sonus21 do you've a usecase where you delete large number of messages in short duration? Correct. That is the exact use case that I have. I expected this feature to be used once in a while or on rare occasions. Based on the current implementation, are there any alternatives?

sonus21 commented 1 month ago

currently there's no way, but if you want to reduce the Redis memory usage, you can set these properties

Prachil-MI commented 2 weeks ago

Ok. I will try. Thank you very much for your help! Closing the ticket.