projects
/
demos
/
kafka
/
wordcount
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
recorder: 1.1.2 - The `JsonSerializer` is used for serialization
[demos/kafka/wordcount]
/
src
/
main
/
java
/
de
/
juplo
/
kafka
/
wordcount
/
recorder
/
RecorderController.java
diff --git
a/src/main/java/de/juplo/kafka/wordcount/recorder/RecorderController.java
b/src/main/java/de/juplo/kafka/wordcount/recorder/RecorderController.java
index
5fe69ad
..
c9d2109
100644
(file)
--- a/
src/main/java/de/juplo/kafka/wordcount/recorder/RecorderController.java
+++ b/
src/main/java/de/juplo/kafka/wordcount/recorder/RecorderController.java
@@
-11,17
+11,19
@@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.async.DeferredResult;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.context.request.async.DeferredResult;
-import ja
vax
.validation.constraints.NotEmpty;
+import ja
karta
.validation.constraints.NotEmpty;
@RestController
public class RecorderController
{
private final String topic;
@RestController
public class RecorderController
{
private final String topic;
- private final KafkaProducer<String,
Str
ing> producer;
+ private final KafkaProducer<String,
Record
ing> producer;
- public RecorderController(RecorderApplicationProperties properties, KafkaProducer<String,String> producer)
+ public RecorderController(
+ RecorderApplicationProperties properties,
+ KafkaProducer<String,Recording> producer)
{
this.topic = properties.getTopic();
this.producer = producer;
{
this.topic = properties.getTopic();
this.producer = producer;
@@
-44,7
+46,11
@@
public class RecorderController
{
DeferredResult<ResponseEntity<RecordingResult>> result = new DeferredResult<>();
{
DeferredResult<ResponseEntity<RecordingResult>> result = new DeferredResult<>();
- ProducerRecord<String, String> record = new ProducerRecord<>(topic, username, sentence);
+ ProducerRecord<String, Recording> record = new ProducerRecord<>(
+ topic,
+ username,
+ Recording.of(username, sentence));
+
producer.send(record, (metadata, exception) ->
{
if (metadata != null)
producer.send(record, (metadata, exception) ->
{
if (metadata != null)