From 8af60124c6506ccb535fab943dd2f8de72b926d8 Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sat, 30 Jan 2021 16:37:31 +0100 Subject: [PATCH] Replaced handwritten property-names by references --- .../de/juplo/kafka/outbox/delivery/OutboxProducer.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/delivery/src/main/java/de/juplo/kafka/outbox/delivery/OutboxProducer.java b/delivery/src/main/java/de/juplo/kafka/outbox/delivery/OutboxProducer.java index 79b3e02..49f777f 100644 --- a/delivery/src/main/java/de/juplo/kafka/outbox/delivery/OutboxProducer.java +++ b/delivery/src/main/java/de/juplo/kafka/outbox/delivery/OutboxProducer.java @@ -16,6 +16,10 @@ import org.springframework.stereotype.Component; import javax.annotation.PreDestroy; +import static org.apache.kafka.clients.CommonClientConfigs.BOOTSTRAP_SERVERS_CONFIG; +import static org.apache.kafka.clients.producer.ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG; +import static org.apache.kafka.clients.producer.ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG; + @Component public class OutboxProducer @@ -36,9 +40,9 @@ public class OutboxProducer this.repository = repository; Properties props = new Properties(); - props.put("bootstrap.servers", properties.bootstrapServers); - props.put("key.serializer", StringSerializer.class.getName()); - props.put("value.serializer", StringSerializer.class.getName()); + props.put(BOOTSTRAP_SERVERS_CONFIG, properties.bootstrapServers); + props.put(KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); + props.put(VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class.getName()); this.producer = new KafkaProducer<>(props); this.topic = properties.topic; -- 2.20.1