From e70699abe1ee01a2628f04fbe5f760d77206644e Mon Sep 17 00:00:00 2001 From: Jens-Otto Larsen <46576810+jolarsen@users.noreply.github.com> Date: Mon, 25 Mar 2024 22:55:48 +0100 Subject: [PATCH] =?UTF-8?q?KafkaSender=20utility=20for=20=C3=A5=20unng?= =?UTF-8?q?=C3=A5=20lokale=20topics=20(#1352)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../felles/integrasjon/kafka/KafkaSender.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaSender.java b/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaSender.java index 696d91ecc..07c10f7d1 100644 --- a/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaSender.java +++ b/integrasjon/kafka-properties/src/main/java/no/nav/vedtak/felles/integrasjon/kafka/KafkaSender.java @@ -10,18 +10,22 @@ public class KafkaSender { private final Producer producer; - private final String topic; + private final String topicName; - public KafkaSender(String topic) { + public KafkaSender(String topicName) { this.producer = new KafkaProducer<>(KafkaProperties.forProducer()); - this.topic = topic; + this.topicName = topicName; + } + + public String getTopicName() { + return topicName; } public RecordMetadata send(String key, String message) { - if (topic == null) { + if (topicName == null) { throw kafkaPubliseringException("null", new IllegalArgumentException()); } - return send(key, message, this.topic); + return send(key, message, this.topicName); } public RecordMetadata send(String key, String message, String topic) {