X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fkafka%2Fsumup%2Fgateway%2FApplicationController.java;h=3ae15527a5ddfcf42027cad99c0a3f1b021d98aa;hb=bf22e88ee5c8ca389df91f6879896e59335c8f2d;hp=5fe69adbc6e111b44234c7fc001c35e023f582ef;hpb=9d6c2ef3461546170a0fd9da744efc316b37e1eb;p=demos%2Fkafka%2Fwordcount diff --git a/src/main/java/de/juplo/kafka/sumup/gateway/ApplicationController.java b/src/main/java/de/juplo/kafka/sumup/gateway/ApplicationController.java index 5fe69ad..3ae1552 100644 --- a/src/main/java/de/juplo/kafka/sumup/gateway/ApplicationController.java +++ b/src/main/java/de/juplo/kafka/sumup/gateway/ApplicationController.java @@ -1,4 +1,4 @@ -package de.juplo.kafka.wordcount.recorder; +package de.juplo.kafka.sumup.gateway; import org.apache.kafka.clients.producer.KafkaProducer; import org.apache.kafka.clients.producer.ProducerRecord; @@ -15,13 +15,13 @@ import javax.validation.constraints.NotEmpty; @RestController -public class RecorderController +public class ApplicationController { private final String topic; private final KafkaProducer producer; - public RecorderController(RecorderApplicationProperties properties, KafkaProducer producer) + public ApplicationController(ApplicationProperties properties, KafkaProducer producer) { this.topic = properties.getTopic(); this.producer = producer; @@ -34,7 +34,7 @@ public class RecorderController MimeTypeUtils.APPLICATION_JSON_VALUE }, produces = MimeTypeUtils.APPLICATION_JSON_VALUE) - DeferredResult> speak( + DeferredResult> speak( @PathVariable @NotEmpty(message = "A username must be provided") String username, @@ -42,7 +42,7 @@ public class RecorderController @NotEmpty(message = "The spoken sentence must not be empty!") String sentence) { - DeferredResult> result = new DeferredResult<>(); + DeferredResult> result = new DeferredResult<>(); ProducerRecord record = new ProducerRecord<>(topic, username, sentence); producer.send(record, (metadata, exception) -> @@ -50,7 +50,7 @@ public class RecorderController if (metadata != null) { result.setResult( - ResponseEntity.ok(RecordingResult.of( + ResponseEntity.ok(Result.of( username, sentence, topic, @@ -64,7 +64,7 @@ public class RecorderController result.setErrorResult( ResponseEntity .internalServerError() - .body(RecordingResult.of( + .body(Result.of( username, sentence, topic,