docker-compose up setup
docker-compose up -d
- sleep 10
-while ! [[ $(http 0:8080/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for producer..."; sleep 1; done
-
-echo foo | http -v :8080/bar
-echo bar | http -v :8080/foo
-echo foobar | http -v :8080/bar
-dd if=/dev/zero bs=1024 count=1024 | http -v :8080/bar
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-echo foofoo | http -v :8080/bar
-echo barbar | http -v :8080/foo
-
-docker-compose logs producer
-docker-compose logs consumer
++while ! [[ $(http 0:8081/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for acks-1..."; sleep 1; done
++while ! [[ $(http 0:8082/actuator/health 2> /dev/null) =~ "UP" ]]; do echo "Waiting for acks-all..."; sleep 1; done
+
+# tag::foo[]
+echo foo | http -v :8081/foo-acks-1
+echo foo | http -v :8082/foo-acks-all
+http -v :8000/seen
+# end::foo[]
+
+# tag::stop[]
+docker-compose stop kafka-1
+# end::stop[]
+
+echo bar | http -v :8081/bar-acks-1
+echo bar | http -v :8082/bar-acks-all
- http -v :8000/seen
++docker-compose exec cli kafkacat -C -b kafka:9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'
+
+docker-compose stop kafka-3
+
+echo foobar | http -v :8081/foobar-acks-1
+echo foobar | http -v :8082/foobar-acks-all
- http -v :8000/seen
-
- docker-compose stop acks-all acks-1 consumer
++docker-compose exec cli kafkacat -C -b kafka:9092 -t test -o 0 -e -f'p=%p|o=%o|k=%k|v=%s\n'
environment:
server.port: 8080
producer.bootstrap-server: kafka:9092
- producer.client-id: producer
+ producer.client-id: acks-all
producer.topic: test
+ producer.acks: all
+
+ acks-1:
+ image: juplo/rest-producer:1.0-SNAPSHOT
+ ports:
+ - 8081:8080
+ environment:
+ server.port: 8080
+ producer.bootstrap-server: kafka:9092
+ producer.client-id: acks-1
+ producer.topic: test
+ producer.acks: 1
consumer:
- image: juplo/endless-consumer:1.0-SNAPSHOT
- ports:
- - 8000:8080
- environment:
- server.port: 8080
- consumer.bootstrap-server: kafka:9092
- consumer.client-id: my-group
- consumer.client-id: consumer
- consumer.topic: test
+ image: juplo/toolbox
+ command: kafkacat -C -b kafka:9092 -t test -o 0 -f'p=%p|o=%o|k=%k|v=%s\n'