-
Notifications
You must be signed in to change notification settings - Fork 22
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
Allow ProcessingResult to wrap record with headers #317
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.
@FredLive Here is my review
public static <K, V, V2> Record<K, ProcessingResult<V, V2>> wrapRecordSuccess(K key, | ||
V value, | ||
long timestamp, | ||
Headers header) { |
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.
We should set headers
as it is a list
@@ -106,6 +107,47 @@ public static <K, V, V2> Record<K, ProcessingResult<V, V2>> wrapRecordSuccess(K | |||
return new Record<>(key, ProcessingResult.success(value), timestamp); | |||
} | |||
|
|||
/** | |||
* Wraps a key, value, timestamp and header in a Record with ProcessingResult#success(V value) as value. |
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.
headers
instead of header
} | ||
|
||
/** | ||
* Wraps a record's value and the header with ProcessingResult.success(V value). |
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.
headers
instead of header
*/ | ||
public static <K, V, V2> Record<K, ProcessingResult<V, V2>> wrapRecordSuccessWithHeader(Record<K, V> message) { | ||
return new Record<>( | ||
message.key(), |
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.
You have additional tabs here
@@ -56,6 +61,65 @@ void shouldCreateWrappedProcessingResult() { | |||
assertEquals(message.timestamp(), wrappedRecord.timestamp()); | |||
} | |||
|
|||
@Test | |||
void shouldCreateWrappedProcessingResultWithHeader() { |
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.
shouldCreateWrappedProcessingResultWithHeaderS
} | ||
|
||
@Test | ||
void shouldCreateWrappedProcessingResultWithHeaderV2() { |
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.
shouldWrapRecordSuccessWithHeadersFromParameters
would be more convenient and compliant with the previous test
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.
@FredLive LGTM
Regarding the issue #313, I updated the code to be able to forward the header in case of success.