From: Kai Moritz Date: Thu, 15 Jun 2023 20:54:54 +0000 (+0200) Subject: Implementierung des Versands der Header ergänzt X-Git-Tag: spring/rest-producer--json---2023-06-signal X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=2c4050c4868ab9e9aec1974a789d8de517f34e38;p=demos%2Fkafka%2Ftraining Implementierung des Versands der Header ergänzt --- diff --git a/src/main/java/de/juplo/kafka/RestProducer.java b/src/main/java/de/juplo/kafka/RestProducer.java index 0158774..e68fe66 100644 --- a/src/main/java/de/juplo/kafka/RestProducer.java +++ b/src/main/java/de/juplo/kafka/RestProducer.java @@ -57,6 +57,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();