X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=delivery%2Fsrc%2Fmain%2Fjava%2Fde%2Fjuplo%2Fkafka%2Foutbox%2Fdelivery%2FOutboxProducer.java;h=999883f97ffca8844582d280b2d3100254a1b041;hb=ca44f2f7e67fb263660adf43f816e5ec98a5e567;hp=ac7d4ebff2cbcd44280b469f84bb87805f0d670c;hpb=e3865636a1236c681127a4d267ed5bbf334a992b;p=demos%2Fkafka%2Foutbox 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 ac7d4eb..999883f 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 @@ -17,6 +17,10 @@ import org.springframework.scheduling.annotation.Scheduled; 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; + public class OutboxProducer { @@ -41,9 +45,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;