liferoad commented on PR #35377: URL: https://github.com/apache/beam/pull/35377#issuecomment-2989150209
The job failed due to two Java compilation errors: --- ### 1. Error in KafkaUnboundedReader.java **Error:** `error: incompatible types: long cannot be converted to Duration` At: ```java records = consumer.poll(KAFKA_POLL_TIMEOUT.getMillis()); ``` - File: [KafkaUnboundedReader.java](https://github.com/apache/beam/blob/cd78b1476100b7003b1cc8f3ee328c7ba3d1da0a/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaUnboundedReader.java#L583) (ref: cd78b1476100b7003b1cc8f3ee328c7ba3d1da0a) **Root cause:** In recent Kafka client versions, `consumer.poll()` expects a `Duration` (java.time.Duration), not a `long` (millis). **Solution:** Change: ```java records = consumer.poll(KAFKA_POLL_TIMEOUT.getMillis()); ``` to: ```java records = consumer.poll(java.time.Duration.ofMillis(KAFKA_POLL_TIMEOUT.getMillis())); ``` --- ### 2. Error in KafkaExactlyOnceSink.java **Error:** `error: incompatible types: TopicPartition cannot be converted to Set<TopicPartition>` At: ```java committed = consumer.committed(new TopicPartition(topic, shard)); ``` - File: [KafkaExactlyOnceSink.java](https://github.com/apache/beam/blob/cd78b1476100b7003b1cc8f3ee328c7ba3d1da0a/sdks/java/io/kafka/src/main/java/org/apache/beam/sdk/io/kafka/KafkaExactlyOnceSink.java#L570) (ref: cd78b1476100b7003b1cc8f3ee328c7ba3d1da0a) **Root cause:** The `consumer.committed()` method now expects a `Set<TopicPartition>` as an argument, not a single `TopicPartition`. **Solution:** Change: ```java committed = consumer.committed(new TopicPartition(topic, shard)); ``` to: ```java committed = consumer.committed(Collections.singleton(new TopicPartition(topic, shard))).get(new TopicPartition(topic, shard)); ``` You may need to import `java.util.Collections`. --- ## Summary of Fixes - Replace calls to `consumer.poll(long)` with `consumer.poll(Duration)`. - Replace calls to `consumer.committed(TopicPartition)` with `consumer.committed(Set<TopicPartition>)` and extract the result for the needed partition. Apply these changes and rerun the build. This will resolve the compilation failures caused by updates in the Kafka Java client API. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org