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

Let user register callback and get acknowledgement result #18702

Merged
merged 26 commits into from
Jul 20, 2022

Conversation

NivedhaSenthil
Copy link
Member

@NivedhaSenthil NivedhaSenthil commented Jul 6, 2022

Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:

  • Make sure to open an issue as a bug/issue before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea.
  • Follow the instructions in CONTRIBUTING. Most importantly, ensure the tests and linter pass by running bundle exec rake ci in the gem subdirectory.
  • Update code documentation if necessary.

closes: #18236
closes: #18237

@NivedhaSenthil NivedhaSenthil requested a review from a team as a code owner July 6, 2022 09:45
@NivedhaSenthil NivedhaSenthil added the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 6, 2022
@NivedhaSenthil
Copy link
Member Author

This PR is in draft stage, to be reviewed once #18395 is reviewed and merged.

Copy link

@maheshgattani maheshgattani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have not looked at most of the PR. But I want to understand are we changing behavior or usage for non exactly once delivery subs? I expect no, but I am not skilled enough in Ruby to know that automatically.

@@ -179,9 +181,9 @@ def published_at
# # Shut down the subscriber when ready to stop receiving messages.
# subscriber.stop!
#
def acknowledge!
def acknowledge! &block

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is my lack of ruby skills: Is this change impacting existing usage of acknowledge? Same question for the rest of the changes in this class.

I see we have changes in the usage comments. Do we need to provide example for previous usage?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a usage change. The & "argument" is just a syntax for capturing any passed block as an argument.

@@ -255,11 +255,7 @@ def streaming_pull request_enum
##
# Acknowledges receipt of a message.
def acknowledge subscription, *ack_ids
begin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing the try catch as part of this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This try catch was added when we had to ignore all the GRPC errors earlier when we were yet to add support for exactly once delivery. As we will be now propagating the error and take action based on it like retry or constructing AcknowledgementResult we no longer need to catch it and ignore here.

@@ -179,9 +181,9 @@ def published_at
# # Shut down the subscriber when ready to stop receiving messages.
# subscriber.stop!
#
def acknowledge!
def acknowledge! &block
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not a usage change. The & "argument" is just a syntax for capturing any passed block as an argument.

@NivedhaSenthil NivedhaSenthil removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Jul 15, 2022
@NivedhaSenthil NivedhaSenthil merged commit f2f90c3 into googleapis:main Jul 20, 2022
@NivedhaSenthil NivedhaSenthil deleted the register_callback branch July 20, 2022 06:24
@ack_callback_register = {}
@modack_callback_register = {}

@retry_thread_pool = Concurrent::ThreadPoolExecutor.new max_threads: @subscriber.callback_threads
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be @subscriber.push_threads?

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