-
Notifications
You must be signed in to change notification settings - Fork 137
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
Added Support and Handling For Generic Headers #931
Added Support and Handling For Generic Headers #931
Conversation
@@ -112,7 +112,7 @@ private ProducerRecord<byte[], byte[]> convertToProducerRecord(String topicName, | |||
Headers headers = null; | |||
if (event instanceof BrooklinEnvelope) { | |||
BrooklinEnvelope envelope = (BrooklinEnvelope) event; | |||
headers = envelope.getHeaders(); | |||
headers = envelope.getHeaders() instanceof Headers ? (Headers) envelope.getHeaders() : null; |
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.
Do we expect a non Kafka Headers object here? If no, is it worth throwing an exception or logging an error here?
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.
logging would be costly as it would do it for every record, I instead added an exception path which will resist in moving further if something other than kafka type is encountered.
datastream-common/src/main/java/com/linkedin/datastream/common/BrooklinEnvelope.java
Show resolved
Hide resolved
35c47ed
to
cd62178
Compare
cd62178
to
0a40645
Compare
datastream-common/src/main/java/com/linkedin/datastream/common/BrooklinEnvelope.java
Outdated
Show resolved
Hide resolved
8dc2a67
to
31009f4
Compare
Summary
BrooklinEnvelope supports transporting the source header data to the destination, but is currently bounded to Kafka's header type. This change replaces that with generic header to let any other publisher-subscriber transfer events & headers via brooklin.
Testing
Added a unit test comparing the source and destination event's headers.