-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ refactor: Kafka 설정 변경 및 API Docs 적용
- Loading branch information
Showing
7 changed files
with
234 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
{ | ||
"openapi": "3.0.1", | ||
"info": { | ||
"title": "OpenAPI definition", | ||
"version": "v0" | ||
}, | ||
"servers": [ | ||
{ | ||
"url": "http://localhost:8081", | ||
"description": "Generated server url" | ||
} | ||
], | ||
"paths": { | ||
"/api/v1/weather/short": { | ||
"post": { | ||
"tags": [ | ||
"weather-test-controller" | ||
], | ||
"operationId": "createExpectedWeatherTest", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/ForeCastTestRequest" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/weather/msg": { | ||
"post": { | ||
"tags": [ | ||
"weather-test-controller" | ||
], | ||
"operationId": "createDisasterMsgTest", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/MsgTestRequest" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/weather/daily": { | ||
"post": { | ||
"tags": [ | ||
"weather-test-controller" | ||
], | ||
"operationId": "createDailyWeatherTest", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/ForeCastTestRequest" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/weather/air": { | ||
"post": { | ||
"tags": [ | ||
"weather-test-controller" | ||
], | ||
"operationId": "airKoreaTest", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/AirTestRequest" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
}, | ||
"/api/v1/weather/accuweather": { | ||
"post": { | ||
"tags": [ | ||
"weather-test-controller" | ||
], | ||
"operationId": "accuweatherTest", | ||
"requestBody": { | ||
"content": { | ||
"application/json": { | ||
"schema": { | ||
"$ref": "#/components/schemas/AccuweatherTestRequest" | ||
} | ||
} | ||
}, | ||
"required": true | ||
}, | ||
"responses": { | ||
"200": { | ||
"description": "OK" | ||
} | ||
} | ||
} | ||
} | ||
}, | ||
"components": { | ||
"schemas": { | ||
"ForeCastTestRequest": { | ||
"type": "object", | ||
"properties": { | ||
"nx": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"ny": { | ||
"type": "integer", | ||
"format": "int32" | ||
}, | ||
"baseDate": { | ||
"type": "string" | ||
}, | ||
"baseTime": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"MsgTestRequest": { | ||
"type": "object", | ||
"properties": { | ||
"location": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"AirTestRequest": { | ||
"type": "object", | ||
"properties": { | ||
"searchDate": { | ||
"type": "string" | ||
} | ||
} | ||
}, | ||
"AccuweatherTestRequest": { | ||
"type": "object", | ||
"properties": { | ||
"latitude": { | ||
"type": "number", | ||
"format": "double" | ||
}, | ||
"longitude": { | ||
"type": "number", | ||
"format": "double" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
31 changes: 13 additions & 18 deletions
31
weather-service/src/main/java/com/waither/weatherservice/kafka/Consumer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,15 @@ | ||
package com.waither.weatherservice.kafka; | ||
|
||
import org.springframework.kafka.annotation.KafkaListener; | ||
import org.springframework.stereotype.Component; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
|
||
@Slf4j | ||
@Component | ||
@RequiredArgsConstructor | ||
public class Consumer { | ||
|
||
@KafkaListener(topics = "${spring.kafka.template.default-topic}", groupId = "${spring.kafka.consumer.group-id}", containerFactory = "dailyWeatherConcurrentKafkaListenerContainerFactory") | ||
public void dailyWeatherConsume(DailyWeatherKafkaMessage message) { | ||
|
||
log.info("Consumer Test ========================== "); | ||
log.info("[*] Consumer Message {} ", message); | ||
} | ||
} | ||
// 테스트용 Consumer | ||
// @Slf4j | ||
// @Component | ||
// @RequiredArgsConstructor | ||
// public class Consumer { | ||
// | ||
// @KafkaListener(topics = "${spring.kafka.template.topic}", groupId = "${spring.kafka.consumer.group-id}") | ||
// public void dailyWeatherConsume(String message) { | ||
// | ||
// log.info("Consumer Test ========================== "); | ||
// log.info("[*] Consumer Message {} ", message); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters