WIP
[demos/kafka/demos-kafka-payment-system-transfer] / transfer / src / main / java / de / juplo / kafka / payment / transfer / TransferServiceApplication.java
index 80f1d4e..320b841 100644 (file)
@@ -2,12 +2,12 @@ package de.juplo.kafka.payment.transfer;
 
 
 import com.fasterxml.jackson.databind.ObjectMapper;
+import de.juplo.kafka.payment.transfer.domain.TransferRepository;
 import de.juplo.kafka.payment.transfer.domain.TransferService;
 import lombok.extern.slf4j.Slf4j;
 import org.apache.kafka.clients.producer.KafkaProducer;
 import org.apache.kafka.clients.producer.ProducerConfig;
 import org.apache.kafka.common.serialization.StringSerializer;
-import org.apache.kafka.common.serialization.UUIDSerializer;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -23,11 +23,11 @@ import java.util.UUID;
 public class TransferServiceApplication
 {
   @Bean(destroyMethod = "close")
-  KafkaProducer<UUID, String> producer(TransferServiceProperties properties)
+  KafkaProducer<String, String> producer(TransferServiceProperties properties)
   {
     Properties props = new Properties();
     props.put(ProducerConfig.BOOTSTRAP_SERVERS_CONFIG, properties.bootstrapServers);
-    props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, UUIDSerializer.class);
+    props.put(ProducerConfig.KEY_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
     props.put(ProducerConfig.VALUE_SERIALIZER_CLASS_CONFIG, StringSerializer.class);
 
     return new KafkaProducer<>(props);
@@ -35,11 +35,12 @@ public class TransferServiceApplication
 
   @Bean
   TransferService transferService(
-      KafkaProducer<UUID, String> producer,
+      TransferRepository repository,
+      KafkaProducer<String, String> producer,
       ObjectMapper mapper,
       TransferServiceProperties properties)
   {
-    return new TransferService(producer, mapper, properties.topic);
+    return new TransferService(repository, producer, mapper, properties.topic);
   }