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

Bidirectional streaming for pubsub (async client) #742

Closed
wants to merge 26 commits into from

Conversation

elena-kolevska
Copy link
Contributor

Description

Adds pubsub bidirectional streaming support for the async client, extending the API with the subscribe and subscribe_handler methods.

The subscribe method returns a Subscription object, which allows users to pull messages from the
stream by calling the next_message method. When done, the close method should be called to terminate the subscription and stop receiving messages.

The subscribe_with_handler method accepts a user callback function that is executed for each message
received from the stream. The callback function should return a TopicEventResponseStatus, indicating whether the message was processed successfully, should be retried, or discarded. Users can return these statuses using the Subscription.SUCCESS, Subscription.RETRY, and Subscription.DROP class properties. The method will automatically manage message acknowledgements based on the returned status.
The call to subscribe_with_handler method returns a close function, which should be called to terminate the subscription when done.

Issue reference

#730

Checklist

Please make sure you've completed the relevant tasks for this PR, out of the following list:

  • Code compiles correctly
  • Created/updated tests
  • Extended the documentation

Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>

fixes typing

Signed-off-by: Elena Kolevska <[email protected]>

more readable example

Signed-off-by: Elena Kolevska <[email protected]>

linter

Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Signed-off-by: Elena Kolevska <[email protected]>
Copy link

codecov bot commented Oct 21, 2024

Codecov Report

Attention: Patch coverage is 79.27632% with 63 lines in your changes missing coverage. Please review.

Project coverage is 86.08%. Comparing base (bffb749) to head (8ba8b41).
Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
dapr/aio/clients/grpc/subscription.py 79.26% 17 Missing ⚠️
dapr/aio/clients/grpc/client.py 33.33% 16 Missing ⚠️
dapr/clients/grpc/subscription.py 83.50% 16 Missing ⚠️
dapr/common/pubsub/subscription.py 83.07% 11 Missing ⚠️
dapr/clients/grpc/interceptors.py 50.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #742      +/-   ##
==========================================
- Coverage   86.63%   86.08%   -0.55%     
==========================================
  Files          84       87       +3     
  Lines        4473     4772     +299     
==========================================
+ Hits         3875     4108     +233     
- Misses        598      664      +66     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

Successfully merging this pull request may close these issues.

1 participant