Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Converting MCE Application to Springboot
  • Loading branch information
arunvasudevan committed Apr 5, 2020
commit 571c880a767f2f19f7a345985ff010bb67e07f9d
5 changes: 4 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ project.ext.externalDependency = [
'springCore': 'org.springframework:spring-core:5.1.6.RELEASE',
'springJdbc': 'org.springframework:spring-jdbc:5.1.6.RELEASE',
'springWeb': 'org.springframework:spring-web:5.1.6.RELEASE',
'springBootStarterWeb': 'org.springframework.boot:spring-boot-starter-web:2.1.2.RELEASE',
'springBootStarterJetty': 'org.springframework.boot:spring-boot-starter-jetty:2.1.2.RELEASE',
'springKafka': 'org.springframework.kafka:spring-kafka:2.2.3.RELEASE',
'testng': 'org.testng:testng:6.9.9'
]

Expand Down Expand Up @@ -102,4 +105,4 @@ subprojects {
}
}
}
}
}
6 changes: 4 additions & 2 deletions docker/mce-consumer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ MAINTAINER Kerem Sahin [email protected]

COPY . datahub-src
RUN cd datahub-src && ./gradlew :metadata-jobs:mce-consumer-job:build \
&& cp metadata-jobs/mce-consumer-job/build/distributions/mce-consumer-job.zip ../mce-consumer-job.zip \
&& cd .. && rm -rf datahub-src && unzip mce-consumer-job.zip
&& cp metadata-jobs/mce-consumer-job/build/libs/mce-consumer-job.jar ../mce-consumer-job.jar \
&& cd .. && rm -rf datahub-src

FROM openjdk:8-jre-alpine

COPY --from=builder /mce-consumer-job /mce-consumer-job/

ENTRYPOINT ["java", "-jar", "mce-consumer-job.jar"]
5 changes: 4 additions & 1 deletion docker/mce-consumer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ services:
- KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
- GMS_HOST=datahub-gms
- GMS_PORT=8080
- KAFKA_MCE_TOPIC_NAME=MetadataChangeEvent
- KAFKA_FMCE_TOPIC_NAME=FailedMetadataChangeEvent
- SPRING_PROFILES_ACTIVE=test
command: "sh -c './mce-consumer-job/bin/mce-consumer-job'"

networks:
default:
name: datahub_network
name: datahub_network
4 changes: 2 additions & 2 deletions metadata-jobs/mce-consumer-job/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@ Quickest way to try out `MCE Consumer Job` is running the [Docker image](../../d
If you do modify things and want to try it out quickly without building the Docker image, you can also run
the application directly from command line after a successful [build](#build):
```
./gradlew :metadata-jobs:mce-consumer-job:run
```
./gradlew :metadata-jobs:mce-consumer-job:bootRun
```
16 changes: 13 additions & 3 deletions metadata-jobs/mce-consumer-job/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
apply plugin: 'application'
apply plugin: 'java'
plugins {
id 'org.springframework.boot' version '2.1.2.RELEASE'
id 'java'
}

apply plugin: 'pegasus'

configurations {
Expand All @@ -23,6 +26,11 @@ dependencies {
compile externalDependency.kafkaAvroSerde
compile externalDependency.kafkaStreams
compile externalDependency.kafkaSerializers
compile (externalDependency.springBootStarterWeb) {
exclude module: "spring-boot-starter-tomcat"
}
compile externalDependency.springBootStarterJetty
compile externalDependency.springKafka

compileOnly externalDependency.lombok

Expand All @@ -47,4 +55,6 @@ clean {
project.delete("src/main/resources/avro")
}

mainClassName = 'com.linkedin.metadata.kafka.MceStreamTask'
bootJar {
mainClassName = 'com.linkedin.metadata.kafka.MceConsumerApplication'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.linkedin.metadata.kafka;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.elasticsearch.rest.RestClientAutoConfiguration;
import org.springframework.boot.autoconfigure.kafka.KafkaAutoConfiguration;

@SpringBootApplication(exclude = {RestClientAutoConfiguration.class, KafkaAutoConfiguration.class})
public class MceConsumerApplication {

public static void main(String[] args) {
SpringApplication.run(MceConsumerApplication.class, args);
}

}

This file was deleted.

Loading