-
Notifications
You must be signed in to change notification settings - Fork 527
Add configurable ackDeadline to GCP Pub/Sub component #3422
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 configurable ackDeadline to GCP Pub/Sub component #3422
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this PR!
Also, please fix the DCO: https://github.com/dapr/dapr/blob/master/CONTRIBUTING.md#developer-certificate-of-origin-signing-your-work
063057d
to
3637c71
Compare
Updated the AckDeadline field in the metadata struct to use time.Duration instead of int. This change allows Dapr to interpret the acknowledgment deadline as either seconds or Go duration strings, providing greater flexibility and usability for configuring message acknowledgment timeouts. Signed-off-by: [email protected] <[email protected]>
3637c71
to
6ba1293
Compare
@mahparaashley please resolve the conflict |
This PR is in rough shape. Why was the I'll try to fix it up. Please be more conscious of compiler / linter errors. You can run |
berndverst Thank you for your feedback. This was my first time working with Go, and I am still learning. I will take a look at it over the weekend. |
Signed-off-by: Bernd Verst <[email protected]>
It's ok I understand. We are now beyond code freeze. I pushed the fixes to your PR so I can merge the PR into the release. Otherwise you would have to wait 3 months for this feature! |
Signed-off-by: Bernd Verst <[email protected]>
@mahparaashley for the changes I made primarily look at this commit. 8f214c8 Since you used Those were the main changes besides some incorrect instantiation of types or declarations of properties. I pushed my changes to your PR and will merge it. This way you can get credit for the contribution, but unfortunately I cannot wait for you to fix it up at this point given our code freeze. |
@berndverst Thank you so much! |
@holopin-bot @mahparaashley Thank you! |
Congratulations @mahparaashley, the maintainer of this repository has issued you a badge! Here it is: https://holopin.io/claim/clzv9qhjj22650cl54pn9wle5 This badge can only be claimed by you, so make sure that your GitHub account is linked to your Holopin account. You can manage those preferences here: https://holopin.io/account. |
Description
(
ackDeadline
) for the GCP Pub/Sub component within Dapr's components-contrib repository. Previously, the acknowledgment deadline was hardcoded to 20 seconds. This change allows users to specify a custom acknowledgment deadline through the component's metadata, thus providing greater flexibility to tailor behavior to specific workload requirements.Motivation
In many scenarios, the hardcoded 20-second deadline may not be optimal. Applications with varying processing times may require longer deadlines to prevent premature message redelivery, which can lead to increased costs and workload on services. Making this value configurable allows users to optimize their systems based on actual performance and needs.
Changes
Metadata Structure: Added an AckDeadline field to the metadata struct to hold the user-defined acknowledgment deadline.
Default Value: Set a default acknowledgment deadline (defaultAckDeadline) to 20 seconds to maintain backward compatibility.
Metadata Parsing: Updated the createMetadata function to parse the ackDeadline from the component's metadata, with validation to ensure it is a positive integer.
Subscription Configuration: Modified the subscription configuration logic in the ensureSubscription method to utilize the user-configured ackDeadline.
Testing: Enhanced the test suite to include tests for validating the behavior with a specified ackDeadline, handling of invalid values, and default behavior when not specified.
Testing
Comprehensive tests were added to validate:
The correct parsing and application of a valid ackDeadline.
Proper error handling when an invalid ackDeadline is provided.
The use of the default ackDeadline when none is specified.
These tests ensure that the new functionality behaves as expected and that existing functionalities remain unaffected.
Impact
This change is backward compatible. Existing configurations without a specified ackDeadline will use the default value, ensuring that current implementations will operate without modifications. New users can specify an ackDeadline to suit their specific needs.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #[issue number]
#3421
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: