From d3cedbb8ed67f71d04d57198a113e49606e27be8 Mon Sep 17 00:00:00 2001 From: deogicorgi Date: Thu, 14 Apr 2022 21:07:17 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B9=B4=ED=94=84=EC=B9=B4=20=EB=A1=9C?= =?UTF-8?q?=EC=BB=AC=EB=A1=9C=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 카프카 로컬서버로 변경 --- .../reactive/consumer/config/KafkaConfig.java | 20 +++++++++---------- consumer/src/main/resources/application.yml | 18 ++++++++--------- producer/src/main/resources/application.yml | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/consumer/src/main/java/com/github/deogicorgi/reactive/consumer/config/KafkaConfig.java b/consumer/src/main/java/com/github/deogicorgi/reactive/consumer/config/KafkaConfig.java index 1bc9e19..9c9603a 100644 --- a/consumer/src/main/java/com/github/deogicorgi/reactive/consumer/config/KafkaConfig.java +++ b/consumer/src/main/java/com/github/deogicorgi/reactive/consumer/config/KafkaConfig.java @@ -23,16 +23,16 @@ public class KafkaConfig { private final KafkaProperties properties; - // deogicorgi-uri 리시버 - @Bean("uriMessageReceiver") + // deogicorgi-topic-1 리시버 + @Bean("deogicorgiTopic1") public KafkaReceiver uriMessageReceiver() throws Exception { - Map.Entry deogicorgiUri = properties.getProperty("deogicorgiUri").orElse(null); + Map.Entry propertyEntry = properties.getProperty("deogicorgi-topic-1").orElse(null); - if (ObjectUtils.isEmpty(deogicorgiUri)) { + if (ObjectUtils.isEmpty(propertyEntry)) { throw new Exception("property is null"); } - KafkaReceiverProperty property = deogicorgiUri.getValue(); + KafkaReceiverProperty property = propertyEntry.getValue(); ReceiverOptions receiverOptions = ReceiverOptions.create(getConsumerProps(property)) @@ -41,16 +41,16 @@ public class KafkaConfig { return KafkaReceiver.create(receiverOptions); } - // deogicorgi-message 리시버 - @Bean("messageReceiver") + // deogicorgi-topic-2 리시버 + @Bean("deogicorgiTopic2") public KafkaReceiver messageReceiver() throws Exception { - Map.Entry deogicorgiUri = properties.getProperty("deogicorgiMessage").orElse(null); + Map.Entry propertyEntry = properties.getProperty("deogicorgi-topic-2").orElse(null); - if (ObjectUtils.isEmpty(deogicorgiUri)) { + if (ObjectUtils.isEmpty(propertyEntry)) { throw new Exception("property is null"); } - KafkaReceiverProperty property = deogicorgiUri.getValue(); + KafkaReceiverProperty property = propertyEntry.getValue(); ReceiverOptions receiverOptions = ReceiverOptions.create(getConsumerProps(property)) diff --git a/consumer/src/main/resources/application.yml b/consumer/src/main/resources/application.yml index 845ae9c..1865bfc 100644 --- a/consumer/src/main/resources/application.yml +++ b/consumer/src/main/resources/application.yml @@ -1,11 +1,11 @@ kafka: - hosts: deogicorgi.home:29092 + hosts: localhost:9092 receiver : - uri: - name : deogicorgiUri - topic : deogicorgi-uri - groupId : deogicorgi-uri-1 - message: - name : deogicorgiMessage - topic : deogicorgi-message - groupId : deogicorgi-message-1 + deogicorgi-topic-1: + name : deogicorgi-topic-1 + topic : deogicorgi-topic-1 + groupId : deogicorgi-topic-1 + deogicorgi-topic-2: + name : deogicorgi-topic-2 + topic : deogicorgi-topic-2 + groupId : deogicorgi-topic-2 diff --git a/producer/src/main/resources/application.yml b/producer/src/main/resources/application.yml index 5829b0c..7a6afae 100644 --- a/producer/src/main/resources/application.yml +++ b/producer/src/main/resources/application.yml @@ -2,5 +2,5 @@ server: port: 18080 kafka: - hosts: deogicorgi.home:29092 + hosts: localhost:9092