From 6952a12b00e8c5f015c8211c545bb2e022400c9b Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Mon, 5 Sep 2022 18:22:54 +0200 Subject: [PATCH] WIP --- docker-compose.yml | 28 ++++++++++++++++--- .../juplo/kafka/ApplicationConfiguration.java | 11 -------- src/main/resources/application.yml | 2 +- 3 files changed, 25 insertions(+), 16 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 2c22c7b..5400911 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -73,14 +73,34 @@ services: image: juplo/toolbox command: sleep infinity - gateway: - image: juplo/sumup-gateway:1.0-SNAPSHOT + gateway-partition-0: + image: juplo/sumup-gateway-springified:1.0-SNAPSHOT ports: - 8080:8080 environment: server.port: 8080 - sumup.gateway.bootstrap-server: kafka:9092 - sumup.gateway.client-id: gateway + spring-kafka.bootstrap-servers: kafka:9092 + spring.kafka.client-id: gateway-partition-0 + sumup.gateway.partition: 0 + + gateway-partition-0: + image: juplo/sumup-gateway-springified:1.0-SNAPSHOT + ports: + - 8081:8080 + environment: + server.port: 8080 + spring-kafka.bootstrap-servers: kafka:9092 + spring.kafka.client-id: gateway-partition-1 + sumup.gateway.partition: 1 + + gateway-hashed: + image: juplo/sumup-gateway-springified:1.0-SNAPSHOT + ports: + - 8082:8080 + environment: + server.port: 8080 + spring-kafka.bootstrap-servers: kafka:9092 + spring.kafka.client-id: gateway-hashed consumer: image: juplo/toolbox diff --git a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java index 3a17625..d040f90 100644 --- a/src/main/java/de/juplo/kafka/ApplicationConfiguration.java +++ b/src/main/java/de/juplo/kafka/ApplicationConfiguration.java @@ -1,16 +1,11 @@ package de.juplo.kafka; -import org.apache.kafka.clients.producer.KafkaProducer; -import org.apache.kafka.clients.producer.Producer; import org.springframework.boot.autoconfigure.kafka.KafkaProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.kafka.annotation.EnableKafka; import org.springframework.kafka.core.KafkaTemplate; -import org.springframework.kafka.core.ProducerFactory; - -import java.util.Properties; @Configuration @@ -30,10 +25,4 @@ public class ApplicationConfiguration applicationProperties.getPartition(), kafkaTemplate); } - - @Bean(destroyMethod = "close") - public Producer kafkaProducer(ProducerFactory factory) - { - return factory.createProducer(); - } } diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 40d0a85..ed234c7 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -37,7 +37,7 @@ spring: batch-size: 16384 compression-type: gzip key-serializer: org.apache.kafka.common.serialization.StringSerializer - value-serializer: org.springframework.kafka.support.serializer.IntegerSerializer + value-serializer: org.apache.kafka.common.serialization.IntegerSerializer properties: linger.ms: 0 delivery.timeout.ms: 20000 # 20 Sekunden -- 2.20.1