Skip to content

Commit fbc6a63

Browse files
author
Ivan Franchin
committedDec 4, 2024
Project upgrade
- upgrade to spring-boot 3.4.0; - upgrade to spring-could 2024.0.0; - upgrade to springdoc-openapi 2.7.0; - upgrade to mapstruct 1.6.3; - upgrade to confluentinc docker images 7.8.0; - upgrade to elasticsearch docker image 8.15.4; - upgrade to zipkin docker image 3.4.1; - remove logging.pattern.level as it was not needed; - refactor docker-compose.yml, docker-build.sh, and pom.xml files; - update README.
1 parent 4713562 commit fbc6a63

File tree

18 files changed

+402
-263
lines changed

18 files changed

+402
-263
lines changed
 

‎README.adoc

+9-9
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ image::documentation/websocket-operation.gif[]
5959
== Prerequisites
6060

6161
* https://www.oracle.com/java/technologies/downloads/#java21[`Java 21+`]
62-
* https://www.docker.com/[`Docker`]
62+
* Some containerization tool https://www.docker.com[`Docker`], https://podman.io[`Podman`], etc.
6363

6464
== Generate NewsEvent
6565

66-
* In a terminal, make sure you are in `spring-cloud-stream-kafka-elasticsearch` root folder
66+
* Open a terminal and navigate to the `spring-cloud-stream-kafka-elasticsearch` root folder;
6767

6868
* Run the following command to generate `NewsEvent`:
6969
+
@@ -76,7 +76,7 @@ It will install `commons-news-1.0.0.jar` in you local `Maven` repository, so tha
7676

7777
== Start Environment
7878

79-
* Open a terminal and inside `spring-cloud-stream-kafka-elasticsearch` root folder run:
79+
* In a terminal, navigate to the `spring-cloud-stream-kafka-elasticsearch` root folder, and run:
8080
+
8181
[source]
8282
----
@@ -92,7 +92,7 @@ docker compose ps
9292

9393
== Running Applications with Maven
9494

95-
Inside `spring-cloud-stream-kafka-elasticsearch` root folder, run the following `Maven` commands in different terminals:
95+
Inside the `spring-cloud-stream-kafka-elasticsearch` root folder, run the following `Maven` commands in different terminals:
9696

9797
* *eureka-server*
9898
+
@@ -140,7 +140,7 @@ Inside `spring-cloud-stream-kafka-elasticsearch` root folder, run the following
140140

141141
=== Build Application's Docker Image
142142

143-
* In a terminal, make sure you are in `spring-cloud-stream-kafka-elasticsearch` root folder
143+
* In a terminal, make sure you are in the `spring-cloud-stream-kafka-elasticsearch` root folder;
144144

145145
* In order to build the application's docker images, run the following script:
146146
+
@@ -314,7 +314,7 @@ Inside `spring-cloud-stream-kafka-elasticsearch` root folder, run the following
314314

315315
=== Run Application's Docker Container
316316

317-
* In a terminal, make sure you are inside `spring-cloud-stream-kafka-elasticsearch` root folder
317+
* In a terminal, make sure you are inside the `spring-cloud-stream-kafka-elasticsearch` root folder;
318318

319319
* Run following script:
320320
+
@@ -414,14 +414,14 @@ curl -X DELETE localhost:9200/news
414414

415415
* To stop applications:
416416
** If they were started with `Maven`, go to the terminals where they are running and press `Ctrl+C`;
417-
** If they were started as Docker containers, go to a terminal and, inside `spring-cloud-stream-kafka-elasticsearch` root folder, run the script below:
417+
** If they were started as Docker containers, in a terminal and inside the `spring-cloud-stream-kafka-elasticsearch` root folder, run the script below:
418418
+
419419
[source]
420420
----
421421
./stop-apps.sh
422422
----
423423

424-
* To stop and remove docker compose containers, network and volumes, go to a terminal and, inside `spring-cloud-stream-kafka-elasticsearch` root folder, run the following command:
424+
* To stop and remove docker compose containers, network and volumes, in a terminal, navigate to the `spring-cloud-stream-kafka-elasticsearch` root folder, and run the following command:
425425
+
426426
[source]
427427
----
@@ -430,7 +430,7 @@ docker compose down -v
430430

431431
== Cleanup
432432

433-
To remove the Docker images created by this project, go to a terminal and, inside `spring-cloud-stream-kafka-elasticsearch` root folder, run the script below:
433+
To remove the Docker images created by this project, in a terminal and inside the `spring-cloud-stream-kafka-elasticsearch` root folder, run the script below:
434434
[source]
435435
----
436436
./remove-docker-images.sh

‎categorizer-service/pom.xml

+53-15
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,28 @@
66
<groupId>com.ivanfranchin</groupId>
77
<artifactId>spring-cloud-stream-kafka-elasticsearch</artifactId>
88
<version>1.0.0</version>
9-
<relativePath>../pom.xml</relativePath>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1010
</parent>
1111
<artifactId>categorizer-service</artifactId>
1212
<name>categorizer-service</name>
1313
<description>Demo project for Spring Boot</description>
14-
14+
<url/>
15+
<licenses>
16+
<license/>
17+
</licenses>
18+
<developers>
19+
<developer/>
20+
</developers>
21+
<scm>
22+
<connection/>
23+
<developerConnection/>
24+
<tag/>
25+
<url/>
26+
</scm>
1527
<properties>
1628
<spring-cloud-schema-registry-client.version>1.1.5</spring-cloud-schema-registry-client.version>
1729
<ivanfranchin-commons-news.version>1.0.0</ivanfranchin-commons-news.version>
1830
</properties>
19-
2031
<dependencies>
2132
<dependency>
2233
<groupId>org.springframework.boot</groupId>
@@ -26,18 +37,6 @@
2637
<groupId>org.springframework.boot</groupId>
2738
<artifactId>spring-boot-starter-web</artifactId>
2839
</dependency>
29-
<dependency>
30-
<groupId>org.springframework.cloud</groupId>
31-
<artifactId>spring-cloud-stream</artifactId>
32-
</dependency>
33-
<dependency>
34-
<groupId>org.springframework.cloud</groupId>
35-
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
36-
</dependency>
37-
<dependency>
38-
<groupId>org.springframework.kafka</groupId>
39-
<artifactId>spring-kafka</artifactId>
40-
</dependency>
4140
<dependency>
4241
<groupId>io.micrometer</groupId>
4342
<artifactId>micrometer-tracing-bridge-brave</artifactId>
@@ -50,6 +49,16 @@
5049
<groupId>org.springframework.cloud</groupId>
5150
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
5251
</dependency>
52+
<dependency>
53+
<groupId>org.springframework.cloud</groupId>
54+
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
55+
</dependency>
56+
<dependency>
57+
<groupId>org.springframework.kafka</groupId>
58+
<artifactId>spring-kafka</artifactId>
59+
</dependency>
60+
61+
<!-- Schema Registry Client -->
5362
<dependency>
5463
<groupId>org.springframework.cloud</groupId>
5564
<artifactId>spring-cloud-schema-registry-client</artifactId>
@@ -85,4 +94,33 @@
8594
</dependency>
8695
</dependencies>
8796

97+
<build>
98+
<plugins>
99+
<plugin>
100+
<groupId>org.apache.maven.plugins</groupId>
101+
<artifactId>maven-compiler-plugin</artifactId>
102+
<configuration>
103+
<annotationProcessorPaths>
104+
<path>
105+
<groupId>org.projectlombok</groupId>
106+
<artifactId>lombok</artifactId>
107+
</path>
108+
</annotationProcessorPaths>
109+
</configuration>
110+
</plugin>
111+
<plugin>
112+
<groupId>org.springframework.boot</groupId>
113+
<artifactId>spring-boot-maven-plugin</artifactId>
114+
<configuration>
115+
<excludes>
116+
<exclude>
117+
<groupId>org.projectlombok</groupId>
118+
<artifactId>lombok</artifactId>
119+
</exclude>
120+
</excludes>
121+
</configuration>
122+
</plugin>
123+
</plugins>
124+
</build>
125+
88126
</project>

‎categorizer-service/src/main/resources/application.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ spring:
3131
management:
3232
endpoints:
3333
web:
34-
exposure.include: beans, env, health, info, metrics, mappings
34+
exposure.include: beans, env, health, metrics, mappings
3535
endpoint:
3636
health:
3737
show-details: always
@@ -48,7 +48,3 @@ eureka:
4848
defaultZone: http://${EUREKA_HOST:localhost}:${EUREKA_PORT:8761}/eureka
4949
instance:
5050
preferIpAddress: true
51-
52-
logging:
53-
pattern:
54-
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

‎collector-service/pom.xml

+37-17
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,30 @@
66
<groupId>com.ivanfranchin</groupId>
77
<artifactId>spring-cloud-stream-kafka-elasticsearch</artifactId>
88
<version>1.0.0</version>
9-
<relativePath>../pom.xml</relativePath>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1010
</parent>
1111
<artifactId>collector-service</artifactId>
1212
<name>collector-service</name>
1313
<description>Demo project for Spring Boot</description>
14-
14+
<url/>
15+
<licenses>
16+
<license/>
17+
</licenses>
18+
<developers>
19+
<developer/>
20+
</developers>
21+
<scm>
22+
<connection/>
23+
<developerConnection/>
24+
<tag/>
25+
<url/>
26+
</scm>
1527
<properties>
1628
<spring-cloud-schema-registry-client.version>1.1.5</spring-cloud-schema-registry-client.version>
1729
<ivanfranchin-commons-news.version>1.0.0</ivanfranchin-commons-news.version>
18-
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
30+
<org.mapstruct.version>1.6.3</org.mapstruct.version>
1931
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
2032
</properties>
21-
2233
<dependencies>
2334
<dependency>
2435
<groupId>org.springframework.boot</groupId>
@@ -32,18 +43,6 @@
3243
<groupId>org.springframework.boot</groupId>
3344
<artifactId>spring-boot-starter-web</artifactId>
3445
</dependency>
35-
<dependency>
36-
<groupId>org.springframework.cloud</groupId>
37-
<artifactId>spring-cloud-stream</artifactId>
38-
</dependency>
39-
<dependency>
40-
<groupId>org.springframework.cloud</groupId>
41-
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
42-
</dependency>
43-
<dependency>
44-
<groupId>org.springframework.kafka</groupId>
45-
<artifactId>spring-kafka</artifactId>
46-
</dependency>
4746
<dependency>
4847
<groupId>io.micrometer</groupId>
4948
<artifactId>micrometer-tracing-bridge-brave</artifactId>
@@ -56,6 +55,16 @@
5655
<groupId>org.springframework.cloud</groupId>
5756
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
5857
</dependency>
58+
<dependency>
59+
<groupId>org.springframework.cloud</groupId>
60+
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
61+
</dependency>
62+
<dependency>
63+
<groupId>org.springframework.kafka</groupId>
64+
<artifactId>spring-kafka</artifactId>
65+
</dependency>
66+
67+
<!-- Schema Registry Client -->
5968
<dependency>
6069
<groupId>org.springframework.cloud</groupId>
6170
<artifactId>spring-cloud-schema-registry-client</artifactId>
@@ -108,7 +117,6 @@
108117
<path>
109118
<groupId>org.projectlombok</groupId>
110119
<artifactId>lombok</artifactId>
111-
<version>${lombok.version}</version>
112120
</path>
113121
<path>
114122
<groupId>org.projectlombok</groupId>
@@ -123,6 +131,18 @@
123131
</annotationProcessorPaths>
124132
</configuration>
125133
</plugin>
134+
<plugin>
135+
<groupId>org.springframework.boot</groupId>
136+
<artifactId>spring-boot-maven-plugin</artifactId>
137+
<configuration>
138+
<excludes>
139+
<exclude>
140+
<groupId>org.projectlombok</groupId>
141+
<artifactId>lombok</artifactId>
142+
</exclude>
143+
</excludes>
144+
</configuration>
145+
</plugin>
126146
</plugins>
127147
</build>
128148

‎collector-service/src/main/resources/application.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ spring:
3333
management:
3434
endpoints:
3535
web:
36-
exposure.include: beans, env, health, info, metrics, mappings
36+
exposure.include: beans, env, health, metrics, mappings
3737
endpoint:
3838
health:
3939
show-details: always
@@ -50,7 +50,3 @@ eureka:
5050
defaultZone: http://${EUREKA_HOST:localhost}:${EUREKA_PORT:8761}/eureka
5151
instance:
5252
preferIpAddress: true
53-
54-
logging:
55-
pattern:
56-
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

‎commons-news/pom.xml

-2
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,12 @@
66
<artifactId>commons-news</artifactId>
77
<version>1.0.0</version>
88
<packaging>jar</packaging>
9-
109
<properties>
1110
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1211
<maven.compiler.source>21</maven.compiler.source>
1312
<maven.compiler.target>21</maven.compiler.target>
1413
<avro.version>1.11.4</avro.version>
1514
</properties>
16-
1715
<dependencies>
1816
<dependency>
1917
<groupId>org.apache.avro</groupId>

‎docker-build.sh

+48-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,50 @@
11
#!/usr/bin/env bash
22

3-
./mvnw clean compile jib:dockerBuild --projects eureka-server
4-
./mvnw clean compile jib:dockerBuild --projects producer-api
5-
./mvnw clean compile jib:dockerBuild --projects categorizer-service
6-
./mvnw clean compile jib:dockerBuild --projects collector-service
7-
./mvnw clean compile jib:dockerBuild --projects publisher-api
8-
./mvnw clean compile jib:dockerBuild --projects news-client
3+
DOCKER_IMAGE_PREFIX="ivanfranchin"
4+
APP_VERSION="1.0.0"
5+
6+
EUREKA_SERVER_APP_NAME="eureka-server"
7+
PRODUCER_API_APP_NAME="producer-api"
8+
CATEGORIZER_SERVICE_APP_NAME="categorizer-service"
9+
COLLECTOR_SERVICE_APP_NAME="collector-service"
10+
PUBLISHER_API_APP_NAME="publisher-api"
11+
NEWS_CLIENT_APP_NAME="news-client"
12+
13+
EUREKA_SERVER_DOCKER_IMAGE_NAME="${DOCKER_IMAGE_PREFIX}/${EUREKA_SERVER_APP_NAME}:${APP_VERSION}"
14+
PRODUCER_API_DOCKER_IMAGE_NAME="${DOCKER_IMAGE_PREFIX}/${PRODUCER_API_APP_NAME}:${APP_VERSION}"
15+
CATEGORIZER_SERVICE_DOCKER_IMAGE_NAME="${DOCKER_IMAGE_PREFIX}/${CATEGORIZER_SERVICE_APP_NAME}:${APP_VERSION}"
16+
COLLECTOR_SERVICE_DOCKER_IMAGE_NAME="${DOCKER_IMAGE_PREFIX}/${COLLECTOR_SERVICE_APP_NAME}:${APP_VERSION}"
17+
PUBLISHER_API_DOCKER_IMAGE_NAME="${DOCKER_IMAGE_PREFIX}/${PUBLISHER_API_APP_NAME}:${APP_VERSION}"
18+
NEWS_CLIENT_DOCKER_IMAGE_NAME="${DOCKER_IMAGE_PREFIX}/${NEWS_CLIENT_APP_NAME}:${APP_VERSION}"
19+
20+
SKIP_TESTS="true"
21+
22+
./mvnw clean compile jib:dockerBuild \
23+
--projects "$EUREKA_SERVER_APP_NAME" \
24+
-DskipTests="$SKIP_TESTS" \
25+
-Dimage="$EUREKA_SERVER_DOCKER_IMAGE_NAME"
26+
27+
./mvnw clean compile jib:dockerBuild \
28+
--projects "$PRODUCER_API_APP_NAME" \
29+
-DskipTests="$SKIP_TESTS" \
30+
-Dimage="$PRODUCER_API_DOCKER_IMAGE_NAME"
31+
32+
./mvnw clean compile jib:dockerBuild \
33+
--projects "$CATEGORIZER_SERVICE_APP_NAME" \
34+
-DskipTests="$SKIP_TESTS" \
35+
-Dimage="$CATEGORIZER_SERVICE_DOCKER_IMAGE_NAME"
36+
37+
./mvnw clean compile jib:dockerBuild \
38+
--projects "$COLLECTOR_SERVICE_APP_NAME" \
39+
-DskipTests="$SKIP_TESTS" \
40+
-Dimage="$COLLECTOR_SERVICE_DOCKER_IMAGE_NAME"
41+
42+
./mvnw clean compile jib:dockerBuild \
43+
--projects "$PUBLISHER_API_APP_NAME" \
44+
-DskipTests="$SKIP_TESTS" \
45+
-Dimage="$PUBLISHER_API_DOCKER_IMAGE_NAME"
46+
47+
./mvnw clean compile jib:dockerBuild \
48+
--projects "$NEWS_CLIENT_APP_NAME" \
49+
-DskipTests="$SKIP_TESTS" \
50+
-Dimage="$NEWS_CLIENT_DOCKER_IMAGE_NAME"

‎docker-compose.yml

+73-73
Original file line numberDiff line numberDiff line change
@@ -1,126 +1,126 @@
11
services:
22

33
elasticsearch:
4-
image: docker.elastic.co/elasticsearch/elasticsearch:8.13.4
5-
container_name: elasticsearch
6-
restart: unless-stopped
4+
image: 'docker.elastic.co/elasticsearch/elasticsearch:8.15.4'
5+
container_name: 'elasticsearch'
6+
restart: 'unless-stopped'
77
ports:
8-
- "9200:9200"
9-
- "9300:9300"
8+
- '9200:9200'
9+
- '9300:9300'
1010
environment:
11-
discovery.type: single-node
12-
xpack.security.enabled: false
13-
ES_JAVA_OPTS: "-Xms512m -Xmx512m"
11+
- 'discovery.type=single-node'
12+
- 'xpack.security.enabled=false'
13+
- 'ES_JAVA_OPTS=-Xms512m -Xmx512m'
1414
healthcheck:
15-
test: "curl -f http://localhost:9200 || exit 1"
15+
test: 'curl -f http://localhost:9200 || exit 1'
1616

1717
zookeeper:
18-
image: confluentinc/cp-zookeeper:7.6.1
19-
container_name: zookeeper
20-
restart: unless-stopped
18+
image: 'confluentinc/cp-zookeeper:7.8.0'
19+
container_name: 'zookeeper'
20+
restart: 'unless-stopped'
2121
ports:
22-
- "2181:2181"
22+
- '2181:2181'
2323
environment:
24-
ZOOKEEPER_CLIENT_PORT: 2181
24+
- 'ZOOKEEPER_CLIENT_PORT=2181'
2525
healthcheck:
26-
test: "echo stat | nc localhost $$ZOOKEEPER_CLIENT_PORT"
26+
test: 'echo stat | nc localhost $$ZOOKEEPER_CLIENT_PORT'
2727

2828
kafka:
29-
image: confluentinc/cp-kafka:7.6.1
30-
container_name: kafka
31-
restart: unless-stopped
29+
image: 'confluentinc/cp-kafka:7.8.0'
30+
container_name: 'kafka'
31+
restart: 'unless-stopped'
3232
depends_on:
33-
- zookeeper
33+
- 'zookeeper'
3434
ports:
35-
- "29092:29092"
35+
- '29092:29092'
3636
environment:
37-
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
38-
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
39-
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
40-
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
37+
- 'KAFKA_ZOOKEEPER_CONNECT=zookeeper:2181'
38+
- 'KAFKA_LISTENER_SECURITY_PROTOCOL_MAP=PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT'
39+
- 'KAFKA_ADVERTISED_LISTENERS=PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092'
40+
- 'KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR=1'
4141
healthcheck:
4242
test: [ "CMD", "nc", "-z", "localhost", "9092" ]
4343

4444
schema-registry:
45-
image: confluentinc/cp-schema-registry:7.6.1
46-
container_name: schema-registry
47-
restart: unless-stopped
45+
image: 'confluentinc/cp-schema-registry:7.8.0'
46+
container_name: 'schema-registry'
47+
restart: 'unless-stopped'
4848
depends_on:
49-
- kafka
49+
- 'kafka'
5050
ports:
51-
- "8081:8081"
51+
- '8081:8081'
5252
environment:
53-
SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: kafka:9092
54-
SCHEMA_REGISTRY_HOST_NAME: schema-registry
55-
SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081
53+
- 'SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS=kafka:9092'
54+
- 'SCHEMA_REGISTRY_HOST_NAME=schema-registry'
55+
- 'SCHEMA_REGISTRY_LISTENERS=http://0.0.0.0:8081'
5656
healthcheck:
57-
test: "curl -f http://localhost:8081 || exit 1"
57+
test: 'curl -f http://localhost:8081 || exit 1'
5858

5959
schema-registry-ui:
60-
image: landoop/schema-registry-ui:0.9.5
61-
container_name: kafka-schema-registry-ui
60+
image: 'landoop/schema-registry-ui:0.9.5'
61+
container_name: 'kafka-schema-registry-ui'
6262
depends_on:
63-
- schema-registry
63+
- 'schema-registry'
6464
ports:
65-
- "8001:8000"
65+
- '8001:8000'
6666
environment:
67-
SCHEMAREGISTRY_URL: http://schema-registry:8081
68-
PROXY: "true"
67+
- 'SCHEMAREGISTRY_URL=http://schema-registry:8081'
68+
- 'PROXY=true'
6969
healthcheck:
70-
test: "wget --quiet --tries=1 --spider http://localhost:8000 || exit 1"
70+
test: 'wget --quiet --tries=1 --spider http://localhost:8000 || exit 1'
7171

7272
kafka-rest-proxy:
73-
image: confluentinc/cp-kafka-rest:7.6.1
74-
container_name: kafka-rest-proxy
75-
restart: unless-stopped
73+
image: 'confluentinc/cp-kafka-rest:7.8.0'
74+
container_name: 'kafka-rest-proxy'
75+
restart: 'unless-stopped'
7676
depends_on:
77-
- zookeeper
78-
- kafka
77+
- 'zookeeper'
78+
- 'kafka'
7979
ports:
80-
- "8082:8082"
80+
- '8082:8082'
8181
environment:
82-
KAFKA_REST_BOOTSTRAP_SERVERS: PLAINTEXT://kafka:9092
83-
KAFKA_REST_ZOOKEEPER_CONNECT: zookeeper:2181
84-
KAFKA_REST_HOST_NAME: kafka-rest-proxy
85-
KAFKA_REST_LISTENERS: http://0.0.0.0:8082
86-
KAFKA_REST_CONSUMER_REQUEST_TIMEOUT_MS: 30000
82+
- 'KAFKA_REST_BOOTSTRAP_SERVERS=PLAINTEXT://kafka:9092'
83+
- 'KAFKA_REST_ZOOKEEPER_CONNECT=zookeeper:2181'
84+
- 'KAFKA_REST_HOST_NAME=kafka-rest-proxy'
85+
- 'KAFKA_REST_LISTENERS=http://0.0.0.0:8082'
86+
- 'KAFKA_REST_CONSUMER_REQUEST_TIMEOUT_MS=30000'
8787
healthcheck:
88-
test: "curl -f http://localhost:8082 || exit 1"
88+
test: 'curl -f http://localhost:8082 || exit 1'
8989

9090
kafka-topics-ui:
91-
image: landoop/kafka-topics-ui:0.9.4
92-
container_name: kafka-topics-ui
93-
restart: unless-stopped
91+
image: 'landoop/kafka-topics-ui:0.9.4'
92+
container_name: 'kafka-topics-ui'
93+
restart: 'unless-stopped'
9494
depends_on:
95-
- kafka-rest-proxy
95+
- 'kafka-rest-proxy'
9696
ports:
97-
- "8085:8000"
97+
- '8085:8000'
9898
environment:
99-
KAFKA_REST_PROXY_URL: http://kafka-rest-proxy:8082
100-
PROXY: "true"
99+
- 'KAFKA_REST_PROXY_URL=http://kafka-rest-proxy:8082'
100+
- 'PROXY=true'
101101
healthcheck:
102-
test: "wget --quiet --tries=1 --spider http://localhost:8000 || exit 1"
102+
test: 'wget --quiet --tries=1 --spider http://localhost:8000 || exit 1'
103103

104104
kafka-manager:
105-
image: hlebalbau/kafka-manager:3.0.0.5
106-
container_name: kafka-manager
107-
restart: unless-stopped
105+
image: 'hlebalbau/kafka-manager:3.0.0.5'
106+
container_name: 'kafka-manager'
107+
restart: 'unless-stopped'
108108
depends_on:
109-
- zookeeper
109+
- 'zookeeper'
110110
ports:
111-
- "9001:9000"
111+
- '9001:9000'
112112
environment:
113-
ZK_HOSTS: zookeeper:2181
114-
APPLICATION_SECRET: "random-secret"
115-
command: -Dpidfile.path=/dev/null
113+
- 'ZK_HOSTS=zookeeper:2181'
114+
- 'APPLICATION_SECRET=random-secret'
115+
command: '-Dpidfile.path=/dev/null'
116116
healthcheck:
117-
test: "curl -f http://localhost:9000 || exit 1"
117+
test: 'curl -f http://localhost:9000 || exit 1'
118118

119119
zipkin:
120-
image: openzipkin/zipkin:2.24.3
121-
container_name: zipkin
122-
restart: unless-stopped
120+
image: 'openzipkin/zipkin:3.4.1'
121+
container_name: 'zipkin'
122+
restart: 'unless-stopped'
123123
ports:
124-
- "9411:9411"
124+
- '9411:9411'
125125
healthcheck:
126126
test: [ "CMD", "nc", "-z", "localhost", "9411" ]

‎eureka-server/pom.xml

+23-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,24 @@
66
<groupId>com.ivanfranchin</groupId>
77
<artifactId>spring-cloud-stream-kafka-elasticsearch</artifactId>
88
<version>1.0.0</version>
9-
<relativePath>../pom.xml</relativePath>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1010
</parent>
1111
<artifactId>eureka-server</artifactId>
1212
<name>eureka-server</name>
1313
<description>Demo project for Spring Boot</description>
14-
14+
<url/>
15+
<licenses>
16+
<license/>
17+
</licenses>
18+
<developers>
19+
<developer/>
20+
</developers>
21+
<scm>
22+
<connection/>
23+
<developerConnection/>
24+
<tag/>
25+
<url/>
26+
</scm>
1527
<dependencies>
1628
<dependency>
1729
<groupId>org.springframework.boot</groupId>
@@ -29,4 +41,13 @@
2941
</dependency>
3042
</dependencies>
3143

44+
<build>
45+
<plugins>
46+
<plugin>
47+
<groupId>org.springframework.boot</groupId>
48+
<artifactId>spring-boot-maven-plugin</artifactId>
49+
</plugin>
50+
</plugins>
51+
</build>
52+
3253
</project>

‎eureka-server/src/main/resources/application.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ eureka:
1212
management:
1313
endpoints:
1414
web:
15-
exposure.include: beans, env, health, info, metrics, mappings
15+
exposure.include: beans, env, health, metrics, mappings
1616
endpoint:
1717
health:
1818
show-details: always

‎news-client/pom.xml

+42-21
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,28 @@
66
<groupId>com.ivanfranchin</groupId>
77
<artifactId>spring-cloud-stream-kafka-elasticsearch</artifactId>
88
<version>1.0.0</version>
9-
<relativePath>../pom.xml</relativePath>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1010
</parent>
1111
<artifactId>news-client</artifactId>
1212
<name>news-client</name>
1313
<description>Demo project for Spring Boot</description>
14-
14+
<url/>
15+
<licenses>
16+
<license/>
17+
</licenses>
18+
<developers>
19+
<developer/>
20+
</developers>
21+
<scm>
22+
<connection/>
23+
<developerConnection/>
24+
<tag/>
25+
<url/>
26+
</scm>
1527
<properties>
1628
<spring-cloud-schema-registry-client.version>1.1.5</spring-cloud-schema-registry-client.version>
1729
<ivanfranchin-commons-news.version>1.0.0</ivanfranchin-commons-news.version>
1830
</properties>
19-
2031
<dependencies>
2132
<dependency>
2233
<groupId>org.springframework.boot</groupId>
@@ -31,20 +42,8 @@
3142
<artifactId>spring-boot-starter-web</artifactId>
3243
</dependency>
3344
<dependency>
34-
<groupId>org.springframework.cloud</groupId>
35-
<artifactId>spring-cloud-starter-openfeign</artifactId>
36-
</dependency>
37-
<dependency>
38-
<groupId>org.springframework.cloud</groupId>
39-
<artifactId>spring-cloud-stream</artifactId>
40-
</dependency>
41-
<dependency>
42-
<groupId>org.springframework.cloud</groupId>
43-
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
44-
</dependency>
45-
<dependency>
46-
<groupId>org.springframework.kafka</groupId>
47-
<artifactId>spring-kafka</artifactId>
45+
<groupId>org.springframework.boot</groupId>
46+
<artifactId>spring-boot-starter-websocket</artifactId>
4847
</dependency>
4948
<dependency>
5049
<groupId>io.micrometer</groupId>
@@ -60,12 +59,22 @@
6059
</dependency>
6160
<dependency>
6261
<groupId>org.springframework.cloud</groupId>
63-
<artifactId>spring-cloud-schema-registry-client</artifactId>
64-
<version>${spring-cloud-schema-registry-client.version}</version>
62+
<artifactId>spring-cloud-starter-openfeign</artifactId>
6563
</dependency>
6664
<dependency>
67-
<groupId>org.springframework.boot</groupId>
68-
<artifactId>spring-boot-starter-websocket</artifactId>
65+
<groupId>org.springframework.cloud</groupId>
66+
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.springframework.kafka</groupId>
70+
<artifactId>spring-kafka</artifactId>
71+
</dependency>
72+
73+
<!-- Schema Registry Client -->
74+
<dependency>
75+
<groupId>org.springframework.cloud</groupId>
76+
<artifactId>spring-cloud-schema-registry-client</artifactId>
77+
<version>${spring-cloud-schema-registry-client.version}</version>
6978
</dependency>
7079

7180
<!-- commons-news -->
@@ -99,6 +108,18 @@
99108

100109
<build>
101110
<plugins>
111+
<plugin>
112+
<groupId>org.apache.maven.plugins</groupId>
113+
<artifactId>maven-compiler-plugin</artifactId>
114+
<configuration>
115+
<annotationProcessorPaths>
116+
<path>
117+
<groupId>org.projectlombok</groupId>
118+
<artifactId>lombok</artifactId>
119+
</path>
120+
</annotationProcessorPaths>
121+
</configuration>
122+
</plugin>
102123
<plugin>
103124
<groupId>org.springframework.boot</groupId>
104125
<artifactId>spring-boot-maven-plugin</artifactId>

‎news-client/src/main/resources/application.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ spring:
2525
management:
2626
endpoints:
2727
web:
28-
exposure.include: beans, env, health, info, metrics, mappings
28+
exposure.include: beans, env, health, metrics, mappings
2929
endpoint:
3030
health:
3131
show-details: always
@@ -42,7 +42,3 @@ eureka:
4242
defaultZone: http://${EUREKA_HOST:localhost}:${EUREKA_PORT:8761}/eureka
4343
instance:
4444
preferIpAddress: true
45-
46-
logging:
47-
pattern:
48-
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

‎pom.xml

+36-42
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,42 @@
11
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
33
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.springframework.boot</groupId>
6+
<artifactId>spring-boot-starter-parent</artifactId>
7+
<version>3.4.0</version>
8+
<relativePath/> <!-- lookup parent from repository -->
9+
</parent>
410
<groupId>com.ivanfranchin</groupId>
511
<artifactId>spring-cloud-stream-kafka-elasticsearch</artifactId>
612
<version>1.0.0</version>
713
<packaging>pom</packaging>
814
<name>spring-cloud-stream-kafka-elasticsearch</name>
915
<description>News Pipeline</description>
10-
11-
<parent>
12-
<groupId>org.springframework.boot</groupId>
13-
<artifactId>spring-boot-starter-parent</artifactId>
14-
<version>3.3.4</version>
15-
<relativePath/> <!-- lookup parent from repository -->
16-
</parent>
17-
16+
<url/>
17+
<licenses>
18+
<license/>
19+
</licenses>
20+
<developers>
21+
<developer/>
22+
</developers>
23+
<scm>
24+
<connection/>
25+
<developerConnection/>
26+
<tag/>
27+
<url/>
28+
</scm>
1829
<properties>
1930
<java.version>21</java.version>
20-
<spring-cloud.version>2023.0.3</spring-cloud.version>
31+
<spring-cloud.version>2024.0.0</spring-cloud.version>
2132
<jib-maven-plugin.version>3.4.4</jib-maven-plugin.version>
22-
<jdk-image.version>21.0.4</jdk-image.version>
23-
<docker-image.prefix>ivanfranchin</docker-image.prefix>
2433
</properties>
25-
26-
<modules>
27-
<module>eureka-server</module>
28-
<module>producer-api</module>
29-
<module>categorizer-service</module>
30-
<module>collector-service</module>
31-
<module>publisher-api</module>
32-
<module>news-client</module>
33-
<module>commons-news</module>
34-
</modules>
35-
34+
<dependencies>
35+
<dependency>
36+
<groupId>org.springframework.cloud</groupId>
37+
<artifactId>spring-cloud-stream</artifactId>
38+
</dependency>
39+
</dependencies>
3640
<dependencyManagement>
3741
<dependencies>
3842
<dependency>
@@ -47,32 +51,22 @@
4751

4852
<build>
4953
<plugins>
50-
<plugin>
51-
<groupId>org.springframework.boot</groupId>
52-
<artifactId>spring-boot-maven-plugin</artifactId>
53-
<executions>
54-
<execution>
55-
<id>build-info</id>
56-
<goals>
57-
<goal>build-info</goal>
58-
</goals>
59-
</execution>
60-
</executions>
61-
</plugin>
6254
<plugin>
6355
<groupId>com.google.cloud.tools</groupId>
6456
<artifactId>jib-maven-plugin</artifactId>
6557
<version>${jib-maven-plugin.version}</version>
66-
<configuration>
67-
<from>
68-
<image>amazoncorretto:${jdk-image.version}</image>
69-
</from>
70-
<to>
71-
<image>${docker-image.prefix}/${project.artifactId}:${project.version}</image>
72-
</to>
73-
</configuration>
7458
</plugin>
7559
</plugins>
7660
</build>
7761

62+
<modules>
63+
<module>eureka-server</module>
64+
<module>producer-api</module>
65+
<module>categorizer-service</module>
66+
<module>collector-service</module>
67+
<module>publisher-api</module>
68+
<module>news-client</module>
69+
<module>commons-news</module>
70+
</modules>
71+
7872
</project>

‎producer-api/pom.xml

+38-30
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,32 @@
66
<groupId>com.ivanfranchin</groupId>
77
<artifactId>spring-cloud-stream-kafka-elasticsearch</artifactId>
88
<version>1.0.0</version>
9-
<relativePath>../pom.xml</relativePath>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1010
</parent>
1111
<artifactId>producer-api</artifactId>
1212
<name>producer-api</name>
1313
<description>Demo project for Spring Boot</description>
14-
14+
<url/>
15+
<licenses>
16+
<license/>
17+
</licenses>
18+
<developers>
19+
<developer/>
20+
</developers>
21+
<scm>
22+
<connection/>
23+
<developerConnection/>
24+
<tag/>
25+
<url/>
26+
</scm>
1527
<properties>
1628
<spring-cloud-schema-registry-client.version>1.1.5</spring-cloud-schema-registry-client.version>
1729
<avro.version>1.11.4</avro.version>
1830
<ivanfranchin-commons-news.version>1.0.0</ivanfranchin-commons-news.version>
19-
<org.mapstruct.version>1.5.5.Final</org.mapstruct.version>
31+
<org.mapstruct.version>1.6.3</org.mapstruct.version>
2032
<lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version>
21-
<springdoc-openapi.version>2.6.0</springdoc-openapi.version>
33+
<springdoc-openapi.version>2.7.0</springdoc-openapi.version>
2234
</properties>
23-
2435
<dependencies>
2536
<dependency>
2637
<groupId>org.springframework.boot</groupId>
@@ -34,18 +45,6 @@
3445
<groupId>org.springframework.boot</groupId>
3546
<artifactId>spring-boot-starter-web</artifactId>
3647
</dependency>
37-
<dependency>
38-
<groupId>org.springframework.cloud</groupId>
39-
<artifactId>spring-cloud-stream</artifactId>
40-
</dependency>
41-
<dependency>
42-
<groupId>org.springframework.cloud</groupId>
43-
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
44-
</dependency>
45-
<dependency>
46-
<groupId>org.springframework.kafka</groupId>
47-
<artifactId>spring-kafka</artifactId>
48-
</dependency>
4948
<dependency>
5049
<groupId>io.micrometer</groupId>
5150
<artifactId>micrometer-tracing-bridge-brave</artifactId>
@@ -58,6 +57,16 @@
5857
<groupId>org.springframework.cloud</groupId>
5958
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
6059
</dependency>
60+
<dependency>
61+
<groupId>org.springframework.cloud</groupId>
62+
<artifactId>spring-cloud-stream-binder-kafka</artifactId>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.springframework.kafka</groupId>
66+
<artifactId>spring-kafka</artifactId>
67+
</dependency>
68+
69+
<!-- Schema Registry Client -->
6170
<dependency>
6271
<groupId>org.springframework.cloud</groupId>
6372
<artifactId>spring-cloud-schema-registry-client</artifactId>
@@ -116,18 +125,6 @@
116125

117126
<build>
118127
<plugins>
119-
<plugin>
120-
<groupId>org.springframework.boot</groupId>
121-
<artifactId>spring-boot-maven-plugin</artifactId>
122-
<configuration>
123-
<excludes>
124-
<exclude>
125-
<groupId>org.projectlombok</groupId>
126-
<artifactId>lombok</artifactId>
127-
</exclude>
128-
</excludes>
129-
</configuration>
130-
</plugin>
131128
<plugin>
132129
<groupId>org.apache.maven.plugins</groupId>
133130
<artifactId>maven-compiler-plugin</artifactId>
@@ -136,7 +133,6 @@
136133
<path>
137134
<groupId>org.projectlombok</groupId>
138135
<artifactId>lombok</artifactId>
139-
<version>${lombok.version}</version>
140136
</path>
141137
<path>
142138
<groupId>org.projectlombok</groupId>
@@ -151,6 +147,18 @@
151147
</annotationProcessorPaths>
152148
</configuration>
153149
</plugin>
150+
<plugin>
151+
<groupId>org.springframework.boot</groupId>
152+
<artifactId>spring-boot-maven-plugin</artifactId>
153+
<configuration>
154+
<excludes>
155+
<exclude>
156+
<groupId>org.projectlombok</groupId>
157+
<artifactId>lombok</artifactId>
158+
</exclude>
159+
</excludes>
160+
</configuration>
161+
</plugin>
154162
</plugins>
155163
</build>
156164

‎producer-api/src/main/resources/application.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ spring:
2828
management:
2929
endpoints:
3030
web:
31-
exposure.include: beans, env, health, info, metrics, mappings
31+
exposure.include: beans, env, health, metrics, mappings
3232
endpoint:
3333
health:
3434
show-details: always
@@ -51,7 +51,3 @@ springdoc:
5151
swagger-ui:
5252
groups-order: DESC
5353
disable-swagger-default-url: true
54-
55-
logging:
56-
pattern:
57-
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

‎publisher-api/pom.xml

+31-14
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,36 @@
66
<groupId>com.ivanfranchin</groupId>
77
<artifactId>spring-cloud-stream-kafka-elasticsearch</artifactId>
88
<version>1.0.0</version>
9-
<relativePath>../pom.xml</relativePath>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1010
</parent>
11-
1211
<artifactId>publisher-api</artifactId>
1312
<name>publisher-api</name>
1413
<description>Demo project for Spring Boot</description>
15-
14+
<url/>
15+
<licenses>
16+
<license/>
17+
</licenses>
18+
<developers>
19+
<developer/>
20+
</developers>
21+
<scm>
22+
<connection/>
23+
<developerConnection/>
24+
<tag/>
25+
<url/>
26+
</scm>
1627
<properties>
17-
<springdoc-openapi.version>2.6.0</springdoc-openapi.version>
28+
<springdoc-openapi.version>2.7.0</springdoc-openapi.version>
1829
</properties>
19-
2030
<dependencies>
2131
<dependency>
2232
<groupId>org.springframework.boot</groupId>
2333
<artifactId>spring-boot-starter-actuator</artifactId>
2434
</dependency>
35+
<dependency>
36+
<groupId>org.springframework.boot</groupId>
37+
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
38+
</dependency>
2539
<dependency>
2640
<groupId>org.springframework.boot</groupId>
2741
<artifactId>spring-boot-starter-validation</artifactId>
@@ -42,10 +56,6 @@
4256
<groupId>org.springframework.cloud</groupId>
4357
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
4458
</dependency>
45-
<dependency>
46-
<groupId>org.springframework.boot</groupId>
47-
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
48-
</dependency>
4959

5060
<!-- SpringDoc OpenApi -->
5161
<dependency>
@@ -69,15 +79,22 @@
6979
<artifactId>spring-cloud-stream-test-binder</artifactId>
7080
<scope>test</scope>
7181
</dependency>
72-
<dependency>
73-
<groupId>org.springframework.kafka</groupId>
74-
<artifactId>spring-kafka-test</artifactId>
75-
<scope>test</scope>
76-
</dependency>
7782
</dependencies>
7883

7984
<build>
8085
<plugins>
86+
<plugin>
87+
<groupId>org.apache.maven.plugins</groupId>
88+
<artifactId>maven-compiler-plugin</artifactId>
89+
<configuration>
90+
<annotationProcessorPaths>
91+
<path>
92+
<groupId>org.projectlombok</groupId>
93+
<artifactId>lombok</artifactId>
94+
</path>
95+
</annotationProcessorPaths>
96+
</configuration>
97+
</plugin>
8198
<plugin>
8299
<groupId>org.springframework.boot</groupId>
83100
<artifactId>spring-boot-maven-plugin</artifactId>

‎publisher-api/src/main/resources/application.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spring:
77
management:
88
endpoints:
99
web:
10-
exposure.include: beans, env, health, info, metrics, mappings
10+
exposure.include: beans, env, health, metrics, mappings
1111
endpoint:
1212
health:
1313
show-details: always
@@ -30,7 +30,3 @@ springdoc:
3030
swagger-ui:
3131
groups-order: DESC
3232
disable-swagger-default-url: true
33-
34-
logging:
35-
pattern:
36-
level: "%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]"

‎start-apps.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ echo "Starting eureka..."
77

88
docker run -d --rm --name eureka -p 8761:8761 \
99
--network spring-cloud-stream-kafka-elasticsearch_default \
10-
--health-cmd="curl -f http://localhost:8761/actuator/health || exit 1" \
10+
--health-cmd='[ -z "$(echo "" > /dev/tcp/localhost/8761)" ] || exit 1' \
1111
ivanfranchin/eureka-server:1.0.0
1212

1313
wait_for_container_log "eureka" "Started"
@@ -18,7 +18,7 @@ echo "Starting producer-api..."
1818
docker run -d --rm --name producer-api -p 9080:8080 \
1919
-e KAFKA_HOST=kafka -e KAFKA_PORT=9092 -e SCHEMA_REGISTRY_HOST=schema-registry -e EUREKA_HOST=eureka -e ZIPKIN_HOST=zipkin \
2020
--network=spring-cloud-stream-kafka-elasticsearch_default \
21-
--health-cmd="curl -f http://localhost:8080/actuator/health || exit 1" \
21+
--health-cmd='[ -z "$(echo "" > /dev/tcp/localhost/9080)" ] || exit 1' \
2222
ivanfranchin/producer-api:1.0.0
2323

2424
wait_for_container_log "producer-api" "Started"
@@ -29,7 +29,7 @@ echo "Starting categorizer-service..."
2929
docker run -d --rm --name categorizer-service -p 9081:8080 \
3030
-e KAFKA_HOST=kafka -e KAFKA_PORT=9092 -e SCHEMA_REGISTRY_HOST=schema-registry -e EUREKA_HOST=eureka -e ZIPKIN_HOST=zipkin \
3131
--network=spring-cloud-stream-kafka-elasticsearch_default \
32-
--health-cmd="curl -f http://localhost:8080/actuator/health || exit 1" \
32+
--health-cmd='[ -z "$(echo "" > /dev/tcp/localhost/9081)" ] || exit 1' \
3333
ivanfranchin/categorizer-service:1.0.0
3434

3535
wait_for_container_log "categorizer-service" "Started"
@@ -40,7 +40,7 @@ echo "Starting collector-service..."
4040
docker run -d --rm --name collector-service -p 9082:8080 \
4141
-e ELASTICSEARCH_HOST=elasticsearch -e KAFKA_HOST=kafka -e KAFKA_PORT=9092 -e SCHEMA_REGISTRY_HOST=schema-registry -e EUREKA_HOST=eureka -e ZIPKIN_HOST=zipkin \
4242
--network=spring-cloud-stream-kafka-elasticsearch_default \
43-
--health-cmd="curl -f http://localhost:8080/actuator/health || exit 1" \
43+
--health-cmd='[ -z "$(echo "" > /dev/tcp/localhost/9082)" ] || exit 1' \
4444
ivanfranchin/collector-service:1.0.0
4545

4646
wait_for_container_log "collector-service" "Started"
@@ -51,7 +51,7 @@ echo "Starting publisher-api..."
5151
docker run -d --rm --name publisher-api -p 9083:8080 \
5252
-e ELASTICSEARCH_HOST=elasticsearch -e EUREKA_HOST=eureka -e ZIPKIN_HOST=zipkin \
5353
--network=spring-cloud-stream-kafka-elasticsearch_default \
54-
--health-cmd="curl -f http://localhost:8080/actuator/health || exit 1" \
54+
--health-cmd='[ -z "$(echo "" > /dev/tcp/localhost/9083)" ] || exit 1' \
5555
ivanfranchin/publisher-api:1.0.0
5656

5757
wait_for_container_log "publisher-api" "Started"
@@ -62,7 +62,7 @@ echo "Starting news-client..."
6262
docker run -d --rm --name news-client -p 8080:8080 \
6363
-e KAFKA_HOST=kafka -e KAFKA_PORT=9092 -e SCHEMA_REGISTRY_HOST=schema-registry -e EUREKA_HOST=eureka -e ZIPKIN_HOST=zipkin \
6464
--network=spring-cloud-stream-kafka-elasticsearch_default \
65-
--health-cmd="curl -f http://localhost:8080/actuator/health || exit 1" \
65+
--health-cmd='[ -z "$(echo "" > /dev/tcp/localhost/8080)" ] || exit 1' \
6666
ivanfranchin/news-client:1.0.0
6767

6868
wait_for_container_log "news-client" "Started"

0 commit comments

Comments
 (0)
Please sign in to comment.