Skip to content

Commit f5c63a0

Browse files
chore(spring-kafka-example): improve Kafka and Zookeeper setup in compose.yaml
1 parent ecb59cb commit f5c63a0

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

spring-kafka-example/compose.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
services:
2+
23
server:
34
build:
45
context: .
@@ -8,3 +9,25 @@ services:
89
SERVER_PORT: "80"
910
SPRING_PROFILES_ACTIVE: "default"
1011

12+
zookeeper:
13+
image: confluentinc/cp-zookeeper:7.4.0
14+
environment:
15+
ZOOKEEPER_CLIENT_PORT: 2181
16+
ZOOKEEPER_TICK_TIME: 2000
17+
ports:
18+
- '2181:2181'
19+
20+
kafka:
21+
image: confluentinc/cp-kafka:7.2.1
22+
depends_on:
23+
- zookeeper
24+
ports:
25+
- '9092:9092'
26+
- '29092:29092'
27+
environment:
28+
KAFKA_BROKER_ID: 1
29+
KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
30+
KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
31+
KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
32+
KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
33+
KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

0 commit comments

Comments
 (0)