Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add an example of reliable consumer #109

Merged
merged 1 commit into from
Aug 18, 2022
Merged

Conversation

Zerpet
Copy link
Contributor

@Zerpet Zerpet commented Aug 18, 2022

The example function func Example_consume() shows how to write a consumer with reconnection support.

This PR also changes the notification channels to be buffered with capacity of 1. This is important to avoid potential deadlocks during an abnormal disconnection. See #32 and #18 for more details.

Both example functions now have a context with timeout, so that they don't run forever. The QoS of 1 is set to slowdown the consumption; this is helpful to test the reconnection capabilities, by giving enough time to close the connection via the Management UI (or any other means).

Fixes #40

The example function Example_consume() shows how to write a consumer
with reconnection support.

This commit also changes the notification channels to be buffered with
capacity of 1. This is important to avoid potential deadlocks during an
abnormal disconnection. See #32 and #18 for more details.

Both example functions now have a context with timeout, so that they
don't run forever. The QoS of 1 is set to slowdown the consumption; this
is helpful to test the reconnection capabilities, by giving enough time
to close the connection via the Management UI (or any other means).

Signed-off-by: Aitor Perez Cedres <[email protected]>
@Zerpet Zerpet added the documentation Improvements or additions to documentation label Aug 18, 2022
@michaelklishin michaelklishin merged commit 36aa49d into main Aug 18, 2022
@michaelklishin michaelklishin deleted the example-reliable-consumer branch August 18, 2022 22:52
@lukebakken
Copy link
Contributor

Thanks a lot @Zerpet !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Example Client: Implementation of a Consumer with reconnection support
3 participants