Initiale Version eines Gateways für die SumUp-Services
[demos/kafka/training] / src / main / java / de / juplo / kafka / ApplicationConfiguration.java
index 0642aa4..33dabc9 100644 (file)
@@ -1,6 +1,7 @@
 package de.juplo.kafka;
 
 import org.apache.kafka.clients.producer.KafkaProducer;
+import org.apache.kafka.common.serialization.IntegerSerializer;
 import org.apache.kafka.common.serialization.StringSerializer;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
 import org.springframework.context.annotation.Bean;
@@ -14,20 +15,19 @@ import java.util.Properties;
 public class ApplicationConfiguration
 {
   @Bean
-  public RestProducer restProducer(
+  public RestGateway restGateway(
       ApplicationProperties properties,
-      KafkaProducer<String, String> kafkaProducer)
+      KafkaProducer<String, Integer> kafkaProducer)
   {
     return
-        new RestProducer(
+        new RestGateway(
             properties.getClientId(),
             properties.getTopic(),
-            properties.getPartition(),
             kafkaProducer);
   }
 
   @Bean(destroyMethod = "close")
-  public KafkaProducer<String, String> kafkaProducer(ApplicationProperties properties)
+  public KafkaProducer<String, Integer> kafkaProducer(ApplicationProperties properties)
   {
     Properties props = new Properties();
     props.put("bootstrap.servers", properties.getBootstrapServer());
@@ -39,7 +39,7 @@ public class ApplicationConfiguration
     props.put("linger.ms", properties.getLingerMs());
     props.put("compression.type", properties.getCompressionType());
     props.put("key.serializer", StringSerializer.class.getName());
-    props.put("value.serializer", StringSerializer.class.getName());
+    props.put("value.serializer", IntegerSerializer.class.getName());
 
     return new KafkaProducer<>(props);
   }