The presentation from the meetup.
You have to add some entries to your /etc/hosts
file:
127.0.0.1 keycloak
127.0.0.1 kafka
That's needed for host resolution because Kafka brokers and Kafka clients connecting to Keycloak have to use the same hostname to ensure the compatibility of generated access tokens. Also, when Kafka client connects to Kafka broker running inside docker image, the broker will redirect the client to kafka:9092
.
docker rm keycloak kafka zookeeper
Go to docker directory of the repo:
cd docker
All the following docker-compose commands should be run from this directory.
Starting infra:
docker-compose -f compose.yml -f keycloak/compose.yml -f keycloak-import/compose.yml -f kafka-oauth-strimzi/compose-authz.yml up --build
Service-A
kafka-console-producer.sh --broker-list kafka:9092 --topic a_messages --producer.config=service-a.properties
Service-C
kafka-console-producer.sh --broker-list kafka:9092 --topic a_messages --producer.config=service-c.properties
Service-B
kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic a_messages --from-beginning --consumer.config=service-b.properties --group a_consumer_group_1
cd service-a
mvn spring-boot:run
cd service-b
mvn spring-boot:run
cd service-c
go run main.go
cd service-d
go run main.go