From: Kai Moritz Date: Mon, 12 Jun 2023 18:48:27 +0000 (+0200) Subject: Implementierung zum Anfügen der Header wiederhergestellt X-Git-Tag: producer/rest-producer--headers---2023-10-signal~1 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=de51ade3e8f722f0dcc1bcb8feaf81ce00ac5baf;p=demos%2Fkafka%2Ftraining Implementierung zum Anfügen der Header wiederhergestellt --- diff --git a/src/main/java/de/juplo/kafka/RestProducer.java b/src/main/java/de/juplo/kafka/RestProducer.java index 73bec5b..cecb980 100644 --- a/src/main/java/de/juplo/kafka/RestProducer.java +++ b/src/main/java/de/juplo/kafka/RestProducer.java @@ -42,6 +42,12 @@ public class RestProducer value // Value ); + record.headers().add("source", id.getBytes()); + if (correlationId != null) + { + record.headers().add("id", BigInteger.valueOf(correlationId).toByteArray()); + } + producer.send(record, (metadata, e) -> { long now = System.currentTimeMillis();