-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Design high-level system and create modules.
- Loading branch information
Showing
32 changed files
with
5,406 additions
and
27 deletions.
There are no files selected for viewing
Binary file not shown.
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,2 @@ | ||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.3/apache-maven-3.9.3-bin.zip | ||
wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar |
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,95 @@ | ||
version: "3.8" | ||
|
||
services: | ||
|
||
kafka: | ||
image: confluentinc/cp-kafka:7.3.1 | ||
hostname: kafka | ||
container_name: kafka | ||
ports: | ||
- "9092:9092" | ||
- "9101:9101" | ||
environment: | ||
KAFKA_BROKER_ID: 1 | ||
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: 'CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT' | ||
KAFKA_ADVERTISED_LISTENERS: 'PLAINTEXT://kafka:29092,PLAINTEXT_HOST://localhost:9092' | ||
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1 | ||
KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0 | ||
KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1 | ||
KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1 | ||
KAFKA_JMX_PORT: 9101 | ||
KAFKA_JMX_HOSTNAME: localhost | ||
KAFKA_PROCESS_ROLES: 'broker,controller' | ||
KAFKA_NODE_ID: 1 | ||
KAFKA_CONTROLLER_QUORUM_VOTERS: '1@kafka:29093' | ||
KAFKA_LISTENERS: 'PLAINTEXT://kafka:29092,CONTROLLER://kafka:29093,PLAINTEXT_HOST://0.0.0.0:9092' | ||
KAFKA_INTER_BROKER_LISTENER_NAME: 'PLAINTEXT' | ||
KAFKA_CONTROLLER_LISTENER_NAMES: 'CONTROLLER' | ||
KAFKA_LOG_DIRS: '/tmp/kraft-combined-logs' | ||
volumes: | ||
- kafka-data:/var/lib/kafka/data | ||
- ./scripts/update_run.sh:/tmp/update_run.sh | ||
command: "bash -c 'if [ ! -f /tmp/update_run.sh ]; then echo \"ERROR: Did you forget the update_run.sh file that came with this docker-compose.yml file?\" && exit 1 ; else /tmp/update_run.sh && /etc/confluent/docker/run ; fi'" | ||
|
||
kafka-connect: | ||
image: confluentinc/cp-kafka-connect:7.3.1 | ||
hostname: kafka-connect | ||
container_name: kafka-connect | ||
depends_on: | ||
- kafka | ||
ports: | ||
- "8083:8083" | ||
environment: | ||
# Kafka Connect configuration parameters | ||
CONNECT_BOOTSTRAP_SERVERS: 'kafka:29092' | ||
CONNECT_REST_PORT: 8083 | ||
CONNECT_GROUP_ID: 'connect-cluster' | ||
CONNECT_CONFIG_STORAGE_TOPIC: '_connect_configs' | ||
CONNECT_OFFSET_STORAGE_TOPIC: '_connect_offset' | ||
CONNECT_STATUS_STORAGE_TOPIC: '_connect_status' | ||
CONNECT_CONFIG_STORAGE_REPLICATION_FACTOR: "1" | ||
CONNECT_OFFSET_STORAGE_REPLICATION_FACTOR: "1" | ||
CONNECT_STATUS_STORAGE_REPLICATION_FACTOR: "1" | ||
CONNECT_KEY_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter' | ||
CONNECT_VALUE_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter' | ||
CONNECT_KEY_CONVERTER_SCHEMAS_ENABLE: 'false' | ||
CONNECT_VALUE_CONVERTER_SCHEMAS_ENABLE: 'false' | ||
CONNECT_REST_ADVERTISED_HOST_NAME: 'kafka-connect' | ||
CONNECT_LOG4J_LOGGERS: 'org.apache.kafka.connect.runtime.rest=WARN,org.reflections=ERROR' | ||
CONNECT_INTERNAL_KEY_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter' | ||
CONNECT_INTERNAL_VALUE_CONVERTER: 'org.apache.kafka.connect.json.JsonConverter' | ||
CONNECT_PLUGIN_PATH: "/usr/share/java,/usr/share/confluent-hub-components" | ||
CONNECT_LISTENERS: "http://kafka-connect:8083" | ||
volumes: | ||
- ./connect/configs/jars:/etc/kafka-connect/jars | ||
|
||
kafka-ui: | ||
image: provectuslabs/kafka-ui:latest | ||
hostname: kafka-ui | ||
container_name: kafka-ui | ||
ports: | ||
- "8084:8080" | ||
depends_on: | ||
- kafka | ||
environment: | ||
KAFKA_CLUSTERS_0_NAME: local | ||
KAFKA_CLUSTERS_0_BOOTSTRAPSERVERS: kafka:29092 | ||
KAFKA_CLUSTERS_0_KAFKACONNECT_0_NAME: local | ||
KAFKA_CLUSTERS_0_KAFKACONNECT_0_ADDRESS: http://kafka-connect:8083 | ||
|
||
feed-simulator: | ||
build: | ||
context: ./feed-simulator | ||
dockerfile: Dockerfile | ||
target: production | ||
labels: | ||
container-name: feed-simulator | ||
hostname: feed-simulator | ||
container_name: feed-simulator | ||
ports: | ||
- "8090:8090" | ||
volumes: | ||
- ../:/production | ||
|
||
volumes: | ||
kafka-data: |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,33 @@ | ||
HELP.md | ||
target/ | ||
!.mvn/wrapper/maven-wrapper.jar | ||
!**/src/main/**/target/ | ||
!**/src/test/**/target/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
build/ | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ |
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,34 @@ | ||
FROM maven:3.8.5-openjdk-17 as module-build | ||
|
||
WORKDIR /module/app | ||
|
||
COPY . . | ||
|
||
RUN mvn clean install -DskipTests=true | ||
|
||
|
||
FROM openjdk:17.0.2-jdk-slim as production | ||
|
||
USER root | ||
|
||
RUN apt-get update -y && apt-get install -y jq curl | ||
|
||
USER 1000 | ||
|
||
WORKDIR /app | ||
|
||
COPY --from=module-build --chown=1000:1000 /module/app/target/feed-simulator-0.0.1-SNAPSHOT.jar ./feed-simulator-0.0.1-SNAPSHOT.jar | ||
|
||
ENTRYPOINT ["java", "-jar", "feed-simulator-0.0.1-SNAPSHOT.jar"] | ||
|
||
FROM production as development | ||
|
||
USER root | ||
|
||
COPY --from=module-build /usr/share/maven /usr/share/maven | ||
COPY --from=module-build --chown=1000:1000 /module/app /development | ||
COPY --from=module-build --chown=1000:1000 /root/.m2 /opt/jboss/.m2 | ||
|
||
RUN ln -s /usr/share/maven/bin/mvn /usr/bin/mvn | ||
|
||
USER 1000 |
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,70 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<parent> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-parent</artifactId> | ||
<version>3.1.1</version> | ||
<relativePath/> <!-- lookup parent from repository --> | ||
</parent> | ||
<groupId>com.kpn.rss</groupId> | ||
<artifactId>feed-simulator</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<name>feed-simulator</name> | ||
<description>feed-simulator</description> | ||
|
||
<properties> | ||
<java.version>17</java.version> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-actuator</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-web</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-devtools</artifactId> | ||
<scope>runtime</scope> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-configuration-processor</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
<optional>true</optional> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-starter-test</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.springframework.boot</groupId> | ||
<artifactId>spring-boot-maven-plugin</artifactId> | ||
<configuration> | ||
<excludes> | ||
<exclude> | ||
<groupId>org.projectlombok</groupId> | ||
<artifactId>lombok</artifactId> | ||
</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
</project> |
27 changes: 27 additions & 0 deletions
27
feed-simulator/src/main/java/com/kpn/rss/feedsimulator/RssFeedController.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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.kpn.rss.feedsimulator; | ||
|
||
import lombok.RequiredArgsConstructor; | ||
import org.springframework.core.io.Resource; | ||
import org.springframework.core.io.ResourceLoader; | ||
import org.springframework.http.MediaType; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import java.io.IOException; | ||
|
||
@RestController | ||
@RequiredArgsConstructor | ||
@RequestMapping("/rss") | ||
public class RssFeedController { | ||
|
||
private final ResourceLoader resourceLoader; | ||
|
||
@GetMapping(value = "/outages.xml", produces = MediaType.APPLICATION_XML_VALUE) | ||
public ResponseEntity<byte[]> outages() throws IOException { | ||
final Resource resource = this.resourceLoader.getResource("classpath:outages.xml"); | ||
final byte[] outagesBytes = resource.getInputStream().readAllBytes(); | ||
return ResponseEntity.ok().body(outagesBytes); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
feed-simulator/src/main/java/com/kpn/rss/feedsimulator/RssFeedSimulatorApplication.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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.kpn.rss.feedsimulator; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class RssFeedSimulatorApplication { | ||
|
||
public static void main(final String[] args) { | ||
SpringApplication.run(RssFeedSimulatorApplication.class, args); | ||
} | ||
|
||
} |
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,2 @@ | ||
server.port=8090 | ||
spring.mvc.problemdetails.enabled=true |
Oops, something went wrong.