Skip to content

Commit 1a451e0

Browse files
committed
KafkaSender utility for å unngå lokale topics
1 parent d6860c3 commit 1a451e0

File tree

1 file changed

+9
-5
lines changed
  • integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka

1 file changed

+9
-5
lines changed

integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaSender.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,22 @@
1010
public class KafkaSender {
1111

1212
private final Producer<String, String> producer;
13-
private final String topic;
13+
private final String topicName;
1414

15-
public KafkaSender(String topic) {
15+
public KafkaSender(String topicName) {
1616
this.producer = new KafkaProducer<>(KafkaProperties.forProducer());
17-
this.topic = topic;
17+
this.topicName = topicName;
18+
}
19+
20+
public String getTopicName() {
21+
return topicName;
1822
}
1923

2024
public RecordMetadata send(String key, String message) {
21-
if (topic == null) {
25+
if (topicName == null) {
2226
throw kafkaPubliseringException("null", new IllegalArgumentException());
2327
}
24-
return send(key, message, this.topic);
28+
return send(key, message, this.topicName);
2529
}
2630

2731
public RecordMetadata send(String key, String message, String topic) {

0 commit comments

Comments
 (0)