프로젝트 구조 변경

This commit is contained in:
deogicorgi
2022-04-02 09:13:48 +09:00
parent 7c179f693b
commit 781fb62fb7
29 changed files with 189 additions and 58 deletions

View File

@@ -18,29 +18,24 @@ 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'
subprojects {
apply plugin: 'java'
apply plugin: 'idea'
// 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'
dependencies {
implementation('org.slf4j:jcl-over-slf4j')
implementation('ch.qos.logback:logback-classic')
}
}
tasks.named('test') {
useJUnitPlatform()
project(':producer') {
dependencies {
implementation project(':common')
}
}
project(':consumer') {
dependencies {
implementation project(':common')
}
}

19
common/build.gradle Normal file
View 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
View 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()
}

Binary file not shown.

View 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

View File

@@ -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.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ReactorKafkaApplication {
public class ConsumerApplication {
public static void main(String[] args) {
SpringApplication.run(ReactorKafkaApplication.class, args);
SpringApplication.run(ConsumerApplication.class, args);
}
}

View File

@@ -0,0 +1 @@

View File

@@ -1,10 +1,10 @@
package com.github.deogicorgi.reactor.kafka;
package com.github.deogicorgi.reactive.consumer;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class ReactorKafkaApplicationTests {
class ConsumerApplicationTests {
@Test
void contextLoads() {

46
producer/build.gradle Normal file
View 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()
}

Binary file not shown.

View 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

View File

@@ -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);
}
}

View File

@@ -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.common.serialization.StringSerializer;

View File

@@ -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.Configuration;

View File

@@ -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.web.reactive.config.WebFluxConfigurer;

View File

@@ -1,4 +1,4 @@
package com.github.deogicorgi.reactor.kafka.exception;
package com.github.deogicorgi.reactive.producer.exception;
public class ProducerServiceException extends Exception {
public ProducerServiceException(Exception e) {

View File

@@ -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.JsonTypeInfo;
import com.github.deogicorgi.reactor.kafka.producer.values.ProduceMessageType;
import com.github.deogicorgi.reactive.producer.value.ProduceMessageType;
import lombok.Getter;
import lombok.Setter;

View File

@@ -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.Setter;
@@ -14,7 +14,7 @@ public class KafkaBodyProduceMessage extends AbstractKafkaProduceMessage {
// 요청 메시지
private String message;
public KafkaBodyProduceMessage () {
public KafkaBodyProduceMessage() {
super.type = ProduceMessageType.Message;
}

View File

@@ -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.Setter;
@@ -14,7 +14,7 @@ public class KafkaUriProduceMessage extends AbstractKafkaProduceMessage {
// 요청 URI
private String uri;
public KafkaUriProduceMessage () {
public KafkaUriProduceMessage() {
super.type = ProduceMessageType.URI;
}

View File

@@ -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.github.deogicorgi.reactor.kafka.producer.message.AbstractKafkaProduceMessage;
import com.github.deogicorgi.reactor.kafka.producer.values.ProduceMessageType;
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
import com.github.deogicorgi.reactive.producer.value.ProduceMessageType;
import lombok.Getter;
import java.time.LocalDateTime;

View File

@@ -0,0 +1,6 @@
package com.github.deogicorgi.reactive.producer.value;
public enum ProduceMessageType {
URI,
Message;
}

View File

@@ -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.reactor.kafka.producer.model.KafkaProduceResult;
import com.github.deogicorgi.reactor.kafka.web.service.ProduceService;
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
import com.github.deogicorgi.reactive.producer.model.KafkaProduceResult;
import com.github.deogicorgi.reactive.producer.web.service.ProduceService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

View File

@@ -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.reactor.kafka.producer.model.KafkaProduceResult;
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
import com.github.deogicorgi.reactive.producer.model.KafkaProduceResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.kafka.clients.producer.ProducerRecord;

View File

@@ -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.reactor.kafka.producer.model.KafkaProduceResult;
import com.github.deogicorgi.reactive.producer.message.AbstractKafkaProduceMessage;
import com.github.deogicorgi.reactive.producer.model.KafkaProduceResult;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

View File

@@ -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() {
}
}

View File

@@ -1 +1,5 @@
rootProject.name = 'reactor-kafka'
include 'producer'
include 'consumer'
include 'common'

View File

@@ -1,6 +0,0 @@
package com.github.deogicorgi.reactor.kafka.producer.values;
public enum ProduceMessageType {
URI,
Message;
}