aiosfstream icon indicating copy to clipboard operation
aiosfstream copied to clipboard

Gracefully terminating client message consumer

Open aleksarias opened this issue 6 years ago • 2 comments

I've noticed when I KeyboardInterrupt I can't get the client to gracefully exit when using this setup:

await client.open()

# subscribe to topics
await client.subscribe("/topic/my-topic")

# listen for incoming messages
async for message in client:
    # code to execute on receiving message
    ...

Is there anyway to cancel the client but allow it to continue processing the messages it has pref-etched?

aleksarias avatar Feb 19 '20 15:02 aleksarias

Is there a reason you can't resume where you left off next time using replay storage? There could be a bunch of messages queued up, and an arbitrary amount of time to process each one that depends on your program execution. Adding all that time up means you are delaying a system call to shut down for an undetermined amount of time.

whitespaceninja avatar Apr 29 '20 18:04 whitespaceninja

@whitespaceninja,

I am having issues with reply storage with pulling the replay id and using it in the subsequent invocations.

Can you please take a look at this issue and see what I am doing wrong there? Thanks for any help on this.

https://github.com/robertmrk/aiosfstream/issues/19#issue-1126620196

welcomemat-services avatar Feb 11 '22 02:02 welcomemat-services