[
https://issues.apache.org/jira/browse/BEAM-4038?focusedWorklogId=91994&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-91994
]
ASF GitHub Bot logged work on BEAM-4038:
----------------------------------------
Author: ASF GitHub Bot
Created on: 17/Apr/18 23:24
Start Date: 17/Apr/18 23:24
Worklog Time Spent: 10m
Work Description: gkumar7 commented on a change in pull request #5111:
[BEAM-4038] Support Kafka Headers in KafkaIO
URL: https://github.com/apache/beam/pull/5111#discussion_r182243015
##########
File path:
sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaRecord.java
##########
@@ -33,6 +34,7 @@
private final String topic;
private final int partition;
private final long offset;
+ private final Headers headers;
Review comment:
Could you explain how this would work? Marking this as ```@Nullable``` would
not help circumvent the issue that ```Headers``` interface would still need to
be on the classpath. To verify, I made the requested changes and I receive the
following runtime error:
```
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/kafka/common/header/Headers
at
org.apache.beam.sdk.io.kafka.KafkaUnboundedSource.getOutputCoder(KafkaUnboundedSource.java:142)
```
When using kafka-clients 0.10.1.0. The ```Headers``` interface is only
available post 0.11.0.0.
Did a few more tests, here is a simple example:
Suppose I have a class with a single *unused* method:
```
public void getHeaders() {
if (!hasHeaders()){ // reflection logic using ConsumerRecord
return;
}
Headers headers = new RecordHeaders();
headers.add(new RecordHeader("hi", "hi".getBytes()));
}
```
and I package this class and use it as a dependency in another application
which simply instantiates this class. Even though the downstream application
did not call ```getHeaders```, it will still throw a runtime exception.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 91994)
Time Spent: 4h 20m (was: 4h 10m)
> Support Kafka Headers in KafkaIO
> --------------------------------
>
> Key: BEAM-4038
> URL: https://issues.apache.org/jira/browse/BEAM-4038
> Project: Beam
> Issue Type: New Feature
> Components: io-java-kafka
> Reporter: Geet Kumar
> Assignee: Raghu Angadi
> Priority: Minor
> Time Spent: 4h 20m
> Remaining Estimate: 0h
>
> Headers have been added to Kafka Consumer/Producer records (KAFKA-4208). The
> purpose of this JIRA is to support this feature in KafkaIO.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)