Implementierung des Versands der Header ergänzt spring/rest-producer--json spring/rest-producer--json---2023-10-signal
authorKai Moritz <kai@juplo.de>
Thu, 15 Jun 2023 20:54:54 +0000 (22:54 +0200)
committerKai Moritz <kai@juplo.de>
Sat, 17 Jun 2023 16:27:04 +0000 (18:27 +0200)
src/main/java/de/juplo/kafka/RestProducer.java

index 0158774..e68fe66 100644 (file)
@@ -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();