docker-compose up -d zookeeper kafka
-while ! [[ $(zookeeper-shell zookeeper:2181 ls /brokers/ids 2> /dev/null) =~ 1001 ]];
+while ! [[ $(docker-compose exec kafka zookeeper-shell zookeeper:2181 ls /brokers/ids 2> /dev/null) =~ 1001 ]];
do
echo "Waiting for kafka...";
sleep 1;
done
-kafka-topics --create --zookeeper zookeeper:2181 --replication-factor 1 --partitions 3 --topic outbox
+docker-compose exec kafka kafka-topics --zookeeper zookeeper:2181 --create --if-not-exists --replication-factor 1 --partitions 3 --topic outbox
-docker-compose up -d jdbc outbox
+docker-compose up -d jdbc outbox kafkacat
while ! [[ $(http :8080/actuator/health 2>/dev/null | jq -r .status) == "UP" ]];
do
done
-kafkacat -C -b localhost:9092 -t outbox &
+docker-compose logs -f kafkacat &
echo peter | http :8080/users
echo franz | http :8080/users
services:
zookeeper:
- image: "confluentinc/cp-zookeeper:latest"
+ image: confluentinc/cp-zookeeper:6.0.1
ports:
- 2181:2181
environment:
ZOOKEEPER_CLIENT_PORT: 2181
kafka:
- image: confluentinc/cp-kafka:latest
+ image: confluentinc/cp-kafka:6.0.1
ports:
- 9092:9092
environment:
depends_on:
- zookeeper
+ kafkacat:
+ image: confluentinc/cp-kafkacat:6.0.1
+ command: "kafkacat -C -b kafka:9093 -t outbox -K:"
+ tty: true
+ depends_on:
+ - kafka
+
jdbc:
image: juplo/jdbc:outbox
ports: