Skip to content

Advanced Example w/o filtered_messages available? #177

Answered by frederikaalund
avollkopf asked this question in Q&A
Discussion options

You must be logged in to vote

Hi Alexander, thanks for opening this discussion.

However, it uses also the advanced example of the old readme to cancel tasks on exit.

Will there be something similar like the advanced example in upcoming versions of the documentation?

Yes, in fact it is already there: https://sbtinstruments.github.io/asyncio-mqtt/listening-without-blocking.html#listening-without-blocking
asyncio.TaskGroup replaces asyncio.gather along with all the manual tracking and housekeeping of individual tasks. Basically, asyncio.TaskGroup maintains the tasks list from the advanced example and ensures proper cancellation (I'm simplifying a lot here―there is a lot more to asyncio.TaskGroup behind the scenes).

N…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@avollkopf
Comment options

@avollkopf
Comment options

Answer selected by avollkopf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants