-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;
@RestController
-public class RecorderController
+public class ApplicationController
{
private final String topic;
private final KafkaProducer<String, String> producer;
- public RecorderController(RecorderApplicationProperties properties, KafkaProducer<String,String> producer)
+ public ApplicationController(ApplicationProperties properties, KafkaProducer<String,String> producer)
{
this.topic = properties.getTopic();
this.producer = producer;
MimeTypeUtils.APPLICATION_JSON_VALUE
},
produces = MimeTypeUtils.APPLICATION_JSON_VALUE)
- DeferredResult<ResponseEntity<RecordingResult>> speak(
+ DeferredResult<ResponseEntity<Result>> speak(
@PathVariable
@NotEmpty(message = "A username must be provided")
String username,
@NotEmpty(message = "The spoken sentence must not be empty!")
String sentence)
{
- DeferredResult<ResponseEntity<RecordingResult>> result = new DeferredResult<>();
+ DeferredResult<ResponseEntity<Result>> result = new DeferredResult<>();
ProducerRecord<String, String> record = new ProducerRecord<>(topic, username, sentence);
producer.send(record, (metadata, exception) ->
if (metadata != null)
{
result.setResult(
- ResponseEntity.ok(RecordingResult.of(
+ ResponseEntity.ok(Result.of(
username,
sentence,
topic,
result.setErrorResult(
ResponseEntity
.internalServerError()
- .body(RecordingResult.of(
+ .body(Result.of(
username,
sentence,
topic,