jegesh / python-sqs-listener

A simple wrapper for boto3 for listening, and sending, to an AWS SQS queue
Other
154 stars 71 forks source link

Message delete optional at runtime #46

Closed davidcsi closed 3 years ago

davidcsi commented 3 years ago

Is it possible to decide at run-time wether i want to delete a message or not?

i.e.: in my SQS, events are injected that should be process after a given timestamp (this is how it works). When i listen for messages, all messages get deleted if i use force_delete=True. By contrast, if I use force_delete=False, no message is ever deleted.

ps: I tried returning False on the message_handler when i do NOT want the message deleted, but it doesn't seem to change the behaviour.

Thanks for your help!

jegesh commented 3 years ago

You need to set force_delete=False and handle the deletion yourself using the message id and boto commands