Skip to content

Commit

Permalink
fix: error converting from int to base64 for KafkaWorker (#79)
Browse files Browse the repository at this point in the history
* fix: Kafka source worker file

converting the variable into a string64 causes errors in certain case

* fix: change key from a string to bye[]
  • Loading branch information
Michaelg22 authored Oct 28, 2022
1 parent 3ca4613 commit 49b820f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.time.OffsetDateTime;

public record KafkaData(String topic, String key, byte[] value, String KAFKA_SERVER_URL, OffsetDateTime timeStamp) {
public record KafkaData(String topic, byte[] key, byte[] value, String KAFKA_SERVER_URL, OffsetDateTime timeStamp) {


}
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ public void doWork() {

for (ConsumerRecord<byte[], byte[]> record : partitionRecords) {
OffsetDateTime timeStamp = new Date(record.timestamp()).toInstant().atOffset( ZoneOffset.UTC );
String key64 = Base64.getEncoder().encodeToString(record.key());
KafkaData kafkaData = new KafkaData(record.topic(), key64, record.value(), KAFKA_SERVER_URL, timeStamp);
KafkaData kafkaData = new KafkaData(record.topic(), record.key(), record.value(), KAFKA_SERVER_URL, timeStamp);
CloudEvent event = adapter.adapt(kafkaData);
String sink = ConfigUtil.getVanceSink();
System.out.println("message: " + Arrays.toString(record.value()));
Expand Down

0 comments on commit 49b820f

Please sign in to comment.