if [ ! -e transfer/target/BUILD ] || [ "$(find transfer/target/classes/ -anewer transfer/target/BUILD | grep transfer/target/classes/de )" != "" ]
then
echo "Rebuilding Docker-Image..."
- docker-compose rm -svf transfer
+ docker-compose rm -svf peter ute franz beate klaus
mvn -f transfer/pom.xml docker:build
touch transfer/target/BUILD
fi
docker-compose run --rm kafka kafka-topics --zookeeper zookeeper:2181 --if-not-exists --create --replication-factor 1 --partitions 5 --topic transfers
-docker-compose up -d transfer
+docker-compose up -d peter ute franz beate klaus
docker-compose run --name transferlog --rm kafka kafka-console-consumer --bootstrap-server kafka:9093 --topic transfers &
-while ! [[ $(http 0:8091/actuator/health 2> /dev/null | jq -r .status ) =~ "UP" ]]; do echo "Waiting for transfer..."; sleep 1; done
+while ! [[ $(http 0:8091/actuator/health 2> /dev/null | jq -r .status ) =~ "UP" ]]; do echo "Waiting for peter..."; sleep 1; done
echo '{"id":1,"payer":1,"payee":2, "amount":10}' | http -v :8091/transfers
-http :8091/transfers/1
+http --follow :8091/transfers/1
http -v :8091/transfers id=2 payer=2 payee=1 amount=5
-http :8091/transfers/2
-
-docker-compose restart transfer
-while ! [[ $(http 0:8091/actuator/health 2> /dev/null | jq -r .status ) =~ "UP" ]]; do echo "Waiting for transfer..."; sleep 1; done
-http :8091/transfers/1
-http :8091/transfers/2
+http --follow :8091/transfers/2
+http -v :8091/transfers id=12 payer=2 payee=1 amount=5
+http -v :8091/transfers id=21 payer=2 payee=1 amount=5
+http -v :8091/transfers id=7 payer=2 payee=1 amount=5
+http -v :8091/transfers id=9 payer=2 payee=1 amount=5
+http -v :8091/transfers id=13 payer=2 payee=1 amount=5
+http -v :8091/transfers id=31 payer=2 payee=1 amount=5
+http -v --follow :8091/transfers/12
+http -v --follow :8091/transfers/21
+http -v --follow :8091/transfers/7
+http -v --follow :8091/transfers/9
+http -v --follow :8091/transfers/13
+http -v --follow :8091/transfers/31
+
+docker-compose restart peter ute franz beate klaus
+while ! [[ $(http 0:8091/actuator/health 2> /dev/null | jq -r .status ) =~ "UP" ]]; do echo "Waiting for peter..."; sleep 1; done
+http -v --follow :8091/transfers/1
+http -v --follow :8091/transfers/2
+http -v --follow :8091/transfers/12
+http -v --follow :8091/transfers/21
+http -v --follow :8091/transfers/7
+http -v --follow :8091/transfers/9
+http -v --follow :8091/transfers/13
+http -v --follow :8091/transfers/31
docker container stop transferlog
zookeeper:
image: confluentinc/cp-zookeeper:6.2.0
ports:
- - "2181:2181"
+ - 2181:2181
environment:
ZOOKEEPER_CLIENT_PORT: 2181
depends_on:
- zookeeper
- transfer:
- image: juplo/payment-service-demo--transfer:1.1.0
+ messages:
+ image: confluentinc/cp-kafka:6.2.0
+ command: >
+ kafka-console-consumer
+ --bootstrap-server kafka:9093
+ --from-beginning
+ --property print.key=true
+ --property key.separator=": "
+ --topic transfers
+
+ peter:
+ image: juplo/payment-service-demo--transfer:2.0.0
+ ports:
+ - 8091:8080
+ environment:
+ juplo.transfer.bootstrap-servers: kafka:9093
+ juplo.transfer.group-instance-id: peter
+ juplo.transfer.instance-id-uri-mapping.peter: http://localhost:8091
+ juplo.transfer.instance-id-uri-mapping.ute: http://localhost:8092
+ juplo.transfer.instance-id-uri-mapping.franz: http://localhost:8093
+ juplo.transfer.instance-id-uri-mapping.beate: http://localhost:8094
+ juplo.transfer.instance-id-uri-mapping.klaus: http://localhost:8095
+ depends_on:
+ - zookeeper
+ - kafka
+
+ ute:
+ image: juplo/payment-service-demo--transfer:2.0.0
+ ports:
+ - 8092:8080
+ environment:
+ juplo.transfer.bootstrap-servers: kafka:9093
+ juplo.transfer.group-instance-id: ute
+ juplo.transfer.instance-id-uri-mapping.peter: http://localhost:8091
+ juplo.transfer.instance-id-uri-mapping.ute: http://localhost:8092
+ juplo.transfer.instance-id-uri-mapping.franz: http://localhost:8093
+ juplo.transfer.instance-id-uri-mapping.beate: http://localhost:8094
+ juplo.transfer.instance-id-uri-mapping.klaus: http://localhost:8095
+ depends_on:
+ - zookeeper
+ - kafka
+
+ franz:
+ image: juplo/payment-service-demo--transfer:2.0.0
+ ports:
+ - 8093:8080
+ environment:
+ juplo.transfer.bootstrap-servers: kafka:9093
+ juplo.transfer.group-instance-id: franz
+ juplo.transfer.instance-id-uri-mapping.peter: http://localhost:8091
+ juplo.transfer.instance-id-uri-mapping.ute: http://localhost:8092
+ juplo.transfer.instance-id-uri-mapping.franz: http://localhost:8093
+ juplo.transfer.instance-id-uri-mapping.beate: http://localhost:8094
+ juplo.transfer.instance-id-uri-mapping.klaus: http://localhost:8095
+ depends_on:
+ - zookeeper
+ - kafka
+
+ beate:
+ image: juplo/payment-service-demo--transfer:2.0.0
+ ports:
+ - 8094:8080
+ environment:
+ juplo.transfer.bootstrap-servers: kafka:9093
+ juplo.transfer.group-instance-id: beate
+ juplo.transfer.instance-id-uri-mapping.peter: http://localhost:8091
+ juplo.transfer.instance-id-uri-mapping.ute: http://localhost:8092
+ juplo.transfer.instance-id-uri-mapping.franz: http://localhost:8093
+ juplo.transfer.instance-id-uri-mapping.beate: http://localhost:8094
+ juplo.transfer.instance-id-uri-mapping.klaus: http://localhost:8095
+ depends_on:
+ - zookeeper
+ - kafka
+
+ klaus:
+ image: juplo/payment-service-demo--transfer:2.0.0
ports:
- - "8091:8080"
+ - 8095:8080
environment:
juplo.transfer.bootstrap-servers: kafka:9093
+ juplo.transfer.group-instance-id: klaus
+ juplo.transfer.instance-id-uri-mapping.peter: http://localhost:8091
+ juplo.transfer.instance-id-uri-mapping.ute: http://localhost:8092
+ juplo.transfer.instance-id-uri-mapping.franz: http://localhost:8093
+ juplo.transfer.instance-id-uri-mapping.beate: http://localhost:8094
+ juplo.transfer.instance-id-uri-mapping.klaus: http://localhost:8095
depends_on:
- zookeeper
- kafka