Später benötigten Header zum Postmapping hinzugefügt
authorKai Moritz <kai@juplo.de>
Mon, 25 Jul 2022 15:58:28 +0000 (17:58 +0200)
committerKai Moritz <kai@juplo.de>
Mon, 25 Jul 2022 15:58:28 +0000 (17:58 +0200)
src/main/java/de/juplo/kafka/RestProducer.java

index 7d9bf12..bfea3ca 100644 (file)
@@ -5,14 +5,12 @@ import org.apache.kafka.clients.producer.KafkaProducer;
 import org.apache.kafka.clients.producer.ProducerRecord;
 import org.apache.kafka.common.serialization.StringSerializer;
 import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.context.request.async.DeferredResult;
 
 import javax.annotation.PreDestroy;
 import java.util.Properties;
 import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
 
 
 @Slf4j
@@ -48,6 +46,7 @@ public class RestProducer
   @PostMapping(path = "{key}")
   public DeferredResult<ProduceResult> send(
       @PathVariable String key,
+      @RequestHeader(name = "X-id", required = false) Long correlationId,
       @RequestBody String value)
   {
     DeferredResult<ProduceResult> result = new DeferredResult<>();