projects
/
demos
/
kafka
/
training
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Überarbeitungen von Setup/Übung aus Branch 'rest-producer' gemerged
[demos/kafka/training]
/
src
/
main
/
java
/
de
/
juplo
/
kafka
/
RestProducer.java
diff --git
a/src/main/java/de/juplo/kafka/RestProducer.java
b/src/main/java/de/juplo/kafka/RestProducer.java
index
bfea3ca
..
b5bb2d9
100644
(file)
--- a/
src/main/java/de/juplo/kafka/RestProducer.java
+++ b/
src/main/java/de/juplo/kafka/RestProducer.java
@@
-19,6
+19,7
@@
public class RestProducer
{
private final String id;
private final String topic;
{
private final String id;
private final String topic;
+ private final Integer partition;
private final KafkaProducer<String, String> producer;
private long produced = 0;
private final KafkaProducer<String, String> producer;
private long produced = 0;
@@
-27,6
+28,7
@@
public class RestProducer
{
this.id = properties.getClientId();
this.topic = properties.getTopic();
{
this.id = properties.getClientId();
this.topic = properties.getTopic();
+ this.partition = properties.getPartition();
Properties props = new Properties();
props.put("bootstrap.servers", properties.getBootstrapServer());
Properties props = new Properties();
props.put("bootstrap.servers", properties.getBootstrapServer());
@@
-55,6
+57,7
@@
public class RestProducer
final ProducerRecord<String, String> record = new ProducerRecord<>(
topic, // Topic
final ProducerRecord<String, String> record = new ProducerRecord<>(
topic, // Topic
+ partition, // Partition
key, // Key
value // Value
);
key, // Key
value // Value
);
@@
-95,9
+98,8
@@
public class RestProducer
long now = System.currentTimeMillis();
log.trace(
long now = System.currentTimeMillis();
log.trace(
- "{} - Queued
#{}
key={} latency={}ms",
+ "{} - Queued
message with
key={} latency={}ms",
id,
id,
- value,
record.key(),
now - time
);
record.key(),
now - time
);