프로젝트 구조 변경
This commit is contained in:
39
build.gradle
39
build.gradle
@@ -18,29 +18,24 @@ repositories {
|
|||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
subprojects {
|
||||||
// Spring boot
|
apply plugin: 'java'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter'
|
apply plugin: 'idea'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-webflux'
|
|
||||||
implementation 'io.projectreactor.kafka:reactor-kafka:1.3.11'
|
|
||||||
|
|
||||||
// swagger ui
|
dependencies {
|
||||||
implementation 'io.springfox:springfox-boot-starter:3.0.0'
|
implementation('org.slf4j:jcl-over-slf4j')
|
||||||
implementation 'io.springfox:springfox-swagger-ui:3.0.0'
|
implementation('ch.qos.logback:logback-classic')
|
||||||
|
}
|
||||||
// logging
|
|
||||||
implementation('org.slf4j:jcl-over-slf4j')
|
|
||||||
implementation('ch.qos.logback:logback-classic')
|
|
||||||
|
|
||||||
// lombok
|
|
||||||
compileOnly 'org.projectlombok:lombok'
|
|
||||||
annotationProcessor 'org.projectlombok:lombok'
|
|
||||||
|
|
||||||
// test
|
|
||||||
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
||||||
testImplementation 'org.springframework.kafka:spring-kafka-test'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.named('test') {
|
project(':producer') {
|
||||||
useJUnitPlatform()
|
dependencies {
|
||||||
|
implementation project(':common')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
project(':consumer') {
|
||||||
|
dependencies {
|
||||||
|
implementation project(':common')
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
19
common/build.gradle
Normal file
19
common/build.gradle
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
plugins {
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
group 'com.github.deogicorgi.reactive'
|
||||||
|
version '0.0.1-SNAPSHOT'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0'
|
||||||
|
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0'
|
||||||
|
}
|
||||||
|
|
||||||
|
test {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
30
consumer/build.gradle
Normal file
30
consumer/build.gradle
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.springframework.boot' version '2.6.6'
|
||||||
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.github.deogicorgi.reactive'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
sourceCompatibility = '11'
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
BIN
consumer/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
consumer/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
consumer/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
consumer/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka;
|
package com.github.deogicorgi.reactive.consumer;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class ReactorKafkaApplication {
|
public class ConsumerApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(ReactorKafkaApplication.class, args);
|
SpringApplication.run(ConsumerApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
1
consumer/src/main/resources/application.properties
Normal file
1
consumer/src/main/resources/application.properties
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka;
|
package com.github.deogicorgi.reactive.consumer;
|
||||||
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
class ReactorKafkaApplicationTests {
|
class ConsumerApplicationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void contextLoads() {
|
void contextLoads() {
|
||||||
46
producer/build.gradle
Normal file
46
producer/build.gradle
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
plugins {
|
||||||
|
id 'org.springframework.boot' version '2.6.6'
|
||||||
|
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
|
||||||
|
id 'java'
|
||||||
|
}
|
||||||
|
|
||||||
|
group = 'com.github.deogicorgi.reactive.producer'
|
||||||
|
version = '0.0.1-SNAPSHOT'
|
||||||
|
sourceCompatibility = '11'
|
||||||
|
|
||||||
|
configurations {
|
||||||
|
compileOnly {
|
||||||
|
extendsFrom annotationProcessor
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenCentral()
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
// Spring boot
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-webflux'
|
||||||
|
implementation 'io.projectreactor.kafka:reactor-kafka:1.3.11'
|
||||||
|
|
||||||
|
// swagger ui
|
||||||
|
implementation 'io.springfox:springfox-boot-starter:3.0.0'
|
||||||
|
implementation 'io.springfox:springfox-swagger-ui:3.0.0'
|
||||||
|
|
||||||
|
// logging
|
||||||
|
implementation('org.slf4j:jcl-over-slf4j')
|
||||||
|
implementation('ch.qos.logback:logback-classic')
|
||||||
|
|
||||||
|
// lombok
|
||||||
|
compileOnly 'org.projectlombok:lombok'
|
||||||
|
annotationProcessor 'org.projectlombok:lombok'
|
||||||
|
|
||||||
|
// test
|
||||||
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
||||||
|
testImplementation 'org.springframework.kafka:spring-kafka-test'
|
||||||
|
}
|
||||||
|
|
||||||
|
tasks.named('test') {
|
||||||
|
useJUnitPlatform()
|
||||||
|
}
|
||||||
BIN
producer/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
producer/gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
5
producer/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
5
producer/gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.github.deogicorgi.reactive.producer;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class ProducerApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication.run(ProducerApplication.class, args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.config;
|
package com.github.deogicorgi.reactive.producer.config;
|
||||||
|
|
||||||
import org.apache.kafka.clients.producer.ProducerConfig;
|
import org.apache.kafka.clients.producer.ProducerConfig;
|
||||||
import org.apache.kafka.common.serialization.StringSerializer;
|
import org.apache.kafka.common.serialization.StringSerializer;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.config;
|
package com.github.deogicorgi.reactive.producer.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.config;
|
package com.github.deogicorgi.reactive.producer.config;
|
||||||
|
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.reactive.config.WebFluxConfigurer;
|
import org.springframework.web.reactive.config.WebFluxConfigurer;
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.exception;
|
package com.github.deogicorgi.reactive.producer.exception;
|
||||||
|
|
||||||
public class ProducerServiceException extends Exception {
|
public class ProducerServiceException extends Exception {
|
||||||
public ProducerServiceException(Exception e) {
|
public ProducerServiceException(Exception e) {
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.producer.message;
|
package com.github.deogicorgi.reactive.producer.message;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
import com.fasterxml.jackson.annotation.JsonSubTypes;
|
||||||
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
import com.fasterxml.jackson.annotation.JsonTypeInfo;
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.values.ProduceMessageType;
|
import com.github.deogicorgi.reactive.producer.value.ProduceMessageType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.producer.message;
|
package com.github.deogicorgi.reactive.producer.message;
|
||||||
|
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.values.ProduceMessageType;
|
import com.github.deogicorgi.reactive.producer.value.ProduceMessageType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class KafkaBodyProduceMessage extends AbstractKafkaProduceMessage {
|
|||||||
// 요청 메시지
|
// 요청 메시지
|
||||||
private String message;
|
private String message;
|
||||||
|
|
||||||
public KafkaBodyProduceMessage () {
|
public KafkaBodyProduceMessage() {
|
||||||
super.type = ProduceMessageType.Message;
|
super.type = ProduceMessageType.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.producer.message;
|
package com.github.deogicorgi.reactive.producer.message;
|
||||||
|
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.values.ProduceMessageType;
|
import com.github.deogicorgi.reactive.producer.value.ProduceMessageType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ public class KafkaUriProduceMessage extends AbstractKafkaProduceMessage {
|
|||||||
// 요청 URI
|
// 요청 URI
|
||||||
private String uri;
|
private String uri;
|
||||||
|
|
||||||
public KafkaUriProduceMessage () {
|
public KafkaUriProduceMessage() {
|
||||||
super.type = ProduceMessageType.URI;
|
super.type = ProduceMessageType.URI;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.producer.model;
|
package com.github.deogicorgi.reactive.producer.model;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.message.AbstractKafkaProduceMessage;
|
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.values.ProduceMessageType;
|
import com.github.deogicorgi.reactive.producer.value.ProduceMessageType;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.github.deogicorgi.reactive.producer.value;
|
||||||
|
|
||||||
|
public enum ProduceMessageType {
|
||||||
|
URI,
|
||||||
|
Message;
|
||||||
|
}
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.web.controller;
|
package com.github.deogicorgi.reactive.producer.web.controller;
|
||||||
|
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.message.AbstractKafkaProduceMessage;
|
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.model.KafkaProduceResult;
|
import com.github.deogicorgi.reactive.producer.model.KafkaProduceResult;
|
||||||
import com.github.deogicorgi.reactor.kafka.web.service.ProduceService;
|
import com.github.deogicorgi.reactive.producer.web.service.ProduceService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.web.service;
|
package com.github.deogicorgi.reactive.producer.web.service;
|
||||||
|
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.message.AbstractKafkaProduceMessage;
|
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.model.KafkaProduceResult;
|
import com.github.deogicorgi.reactive.producer.model.KafkaProduceResult;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.kafka.clients.producer.ProducerRecord;
|
import org.apache.kafka.clients.producer.ProducerRecord;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.web.service;
|
package com.github.deogicorgi.reactive.producer.web.service;
|
||||||
|
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.message.AbstractKafkaProduceMessage;
|
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
|
||||||
import com.github.deogicorgi.reactor.kafka.producer.model.KafkaProduceResult;
|
import com.github.deogicorgi.reactive.producer.model.KafkaProduceResult;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.github.deogicorgi.reactive.producer;
|
||||||
|
|
||||||
|
import org.junit.jupiter.api.Test;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
|
||||||
|
@SpringBootTest
|
||||||
|
class ProducerApplicationTests {
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void contextLoads() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1 +1,5 @@
|
|||||||
rootProject.name = 'reactor-kafka'
|
rootProject.name = 'reactor-kafka'
|
||||||
|
include 'producer'
|
||||||
|
include 'consumer'
|
||||||
|
include 'common'
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
package com.github.deogicorgi.reactor.kafka.producer.values;
|
|
||||||
|
|
||||||
public enum ProduceMessageType {
|
|
||||||
URI,
|
|
||||||
Message;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user