-
Notifications
You must be signed in to change notification settings - Fork 207
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 acknowledgement support to aggregate processor #5139
base: main
Are you sure you want to change the base?
Conversation
@@ -62,6 +82,7 @@ boolean shouldConcludeGroup(final Duration groupDuration) { | |||
|
|||
void resetGroup() { | |||
groupStart = Instant.now(); | |||
this.eventHandle = new AggregateEventHandle(groupStart); |
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.
Should this do something with the old eventHandle
? Release it? Something else?
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.
No. The previous event handle was sent with the concluded event and will be released after the event is sent to Sink. Every "aggregate duration" ONE aggregated event is created and one aggregate event handle is created. The aggregate event handle is attached to the aggregated event and the group will create a new handle for the new duration. If the event handle is not attached to any event, then it will be freed (by garbage collector) when a new event handle is created in resetGroup.
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 the explanation. This is clear. To be sure, are there any paths that could lead to resetting a group where we do need to handle the aggregate event?
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.
It doesn't look like it. It looks like resetGroup() is called only in closeGroup() which is called only when the group is concluded.
@@ -26,6 +26,14 @@ public interface Processor<InputRecord extends Record<?>, OutputRecord extends R | |||
*/ | |||
Collection<OutputRecord> execute(Collection<InputRecord> records); | |||
|
|||
/** | |||
* indicates if the processor holds the events or not |
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.
Update this to be a little clear on what it means to hold events.
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.
This looks good overall. I'm good once you make a few small tweaks such as documentation improvements and add tests.
Signed-off-by: Krishna Kondaka <krishkdk@amazon.com>
Description
Add acknowledgement support to aggregate processor
Issues Resolved
Resolves #[Issue number to be closed when this PR is merged]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.