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

pubsub: retry settings #7040

Closed
enumag opened this issue Nov 15, 2022 · 4 comments · Fixed by GoogleCloudPlatform/golang-samples#3189
Closed

pubsub: retry settings #7040

enumag opened this issue Nov 15, 2022 · 4 comments · Fixed by GoogleCloudPlatform/golang-samples#3189
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. type: docs Improvement to the documentation for an API.

Comments

@enumag
Copy link

enumag commented Nov 15, 2022

Is your feature request related to a problem? Please describe.

I'd like to have better control over the retry policies for my pubsub messages. I found this documentation:

https://cloud.google.com/pubsub/docs/publisher#retry

However it's notably lacking an example for Go and I was unable to find anything similar in the source code of your Go library. The documentation even notes:

note that not all client libraries support custom retry settings

It seems Go is one of those that don't have this feature?

Describe the solution you'd like

Retry settings should be implemented in the pubsub library for Go and code sample should be available in the documentation.

Describe alternatives you've considered

No alternative seems to be available for Go.

Additional context

Screenshot from documentation:

Screenshot from 2022-11-15 10-02-15

@enumag enumag added the triage me I really want to be triaged. label Nov 15, 2022
@product-auto-label product-auto-label bot added the api: pubsub Issues related to the Pub/Sub API. label Nov 15, 2022
@hongalex hongalex added status: investigating The issue is under investigation, which is determined to be non-trivial. and removed triage me I really want to be triaged. labels Dec 6, 2022
@hongalex
Copy link
Member

hongalex commented Dec 6, 2022

Apologies as this seemed to have fallen under the radar. Could you describe the use case for wanting custom retry settings for Publish?

You are able to specify a custom Publish retryer by using NewClientWithConfig. Here's a brief snippet on how to set that up

config := &ClientConfig{
	PublisherCallOptions: &vkit.PublisherCallOptions{
		Publish: []gax.CallOption{
			gax.WithRetry(func() gax.Retryer {
				return gax.OnCodes([]codes.Code{
					codes.Aborted,
					codes.Canceled,
					codes.Internal,
					codes.ResourceExhausted,
					codes.Unknown,
					codes.Unavailable,
					codes.DeadlineExceeded,
				}, gax.Backoff{
					Initial:    100 * time.Millisecond,
					Max:        60000 * time.Millisecond,
					Multiplier: 1.30,
				})
			}),
		},
	},
}
client, err := NewClientWithConfig(ctx, projID, config, opts...)```

@enumag
Copy link
Author

enumag commented Dec 6, 2022

If it's already possible then great. But the documentation should be updated to include a go example.

@hongalex hongalex added the type: docs Improvement to the documentation for an API. label Dec 6, 2022
@hongalex
Copy link
Member

hongalex commented Dec 6, 2022

Sure, I'll use this issue around as a docs request to add this sample to our docs.

@hongalex
Copy link
Member

hongalex commented Feb 27, 2023

Apologies, I believe my last example is incorrect as of #5728 since we started using a custom retrier at the Publish level which overrides the retrier defined at the client construction level.

I'll track this as a bug for now since I need to discuss with other client lib owners whether or not we want to collectively support custom retries.

Edit: disregard the above. The custom retrier does use the retrier defined at client instantiation when the custom path is not met (specific codes.Internal error). We can still add this as a sample.

@hongalex hongalex added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed status: investigating The issue is under investigation, which is determined to be non-trivial. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. labels Feb 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. type: docs Improvement to the documentation for an API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants