PruvoNet / squiss-ts

High-volume Amazon SQS Poller for Node.js
Apache License 2.0
48 stars 15 forks source link

Allow more customisation to the polling lifecycle #169

Closed sneljo1 closed 11 months ago

sneljo1 commented 11 months ago

Is your feature request related to a problem? Please describe. I am using this library for a couple of different consumers. I would like to re-use it for another one but it has a special case. Currently when a message is deleted (del), squiss assumes we are ready to receive messages. However, for this special consumer, this is not the case.

Describe the solution you'd like I was looking through the code but currently it does not seem possible. I would like to use del where handleMessage is not called automatically. After I am ready to accept new messages, I would like to tell squiss its ok to continue polling.

Possible implementation could be del(pausePolling?:boolean) and a resume() or maybe start would also do the track although it might not be that clear?

Describe alternatives you've considered Looked at start and stop but handleMessage will override it and don't know if its safe.

regevbr commented 11 months ago

This seems like out of the scope of this tool... What I can suggest is to delete the message manually using the AWS API directly, and then call keep() on the message to release the slot of SQUISS

sneljo1 commented 11 months ago

That would probably solve it 👍