import com.fasterxml.jackson.databind.ObjectMapper;
-import de.juplo.kafka.payment.transfer.impl.TransferServiceImpl;
+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;
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);
}
@Bean
- TransferServiceImpl transferService(
- KafkaProducer<UUID, String> producer,
+ TransferService transferService(
+ TransferRepository repository,
+ KafkaProducer<String, String> producer,
ObjectMapper mapper,
TransferServiceProperties properties)
{
- return new TransferServiceImpl(producer, mapper, properties.topic);
+ return new TransferService(repository, producer, mapper, properties.topic);
}