Go to a temporary folder and remove previously downloaded latest
images:
$ cd ~/Development/temp
$ docker rmi quay.io/microcks/microcks:latest quay.io/microcks/microcks-async-minion:latest quay.io/microcks/microcks-postman-runtime:latest
Close a fresh copy of Microcks Git repository:
$ git clone https://github.com/microcks/microcks
Cloning into 'microcks'...
remote: Enumerating objects: 10287, done.
remote: Counting objects: 100% (1543/1543), done.
remote: Compressing objects: 100% (655/655), done.
remote: Total 10287 (delta 692), reused 1368 (delta 598), pack-reused 8744
Receiving objects: 100% (10287/10287), 2.60 MiB | 6.13 MiB/s, done.
Resolving deltas: 100% (5229/5229), done.
Go to docker-compose folder and launch with async-addon
:
$ cd microcks/install/docker-compose
$ docker-compose -f docker-compose.yml -f docker-compose-async-addon.yml up -d
Creating network "docker-compose_default" with the default driver
Pulling postman (quay.io/microcks/microcks-postman-runtime:latest)...
latest: Pulling from microcks/microcks-postman-runtime
cbdbe7a5bc2a: Already exists
95feee427958: Already exists
4123295e9f39: Already exists
a59140832df1: Already exists
6504409a8831: Pull complete
9ce8afff0d5c: Pull complete
03f83af2527a: Pull complete
f208b202f815: Pull complete
Digest: sha256:dc95b935d95a65910b2905853f87befb47fc200ecb6a74a1f719a7f391a40e47
Status: Downloaded newer image for quay.io/microcks/microcks-postman-runtime:latest
Pulling app (quay.io/microcks/microcks:latest)...
latest: Pulling from microcks/microcks
42f70057e367: Already exists
a4360c9d581f: Already exists
fa3b48288a36: Pull complete
f8ea30396047: Pull complete
852609e2d1fe: Pull complete
aaef94beb9bb: Pull complete
61c0a4e2cda9: Pull complete
9e05f03f7765: Pull complete
Digest: sha256:18e87a5173e7e8ab8f93b3e0023f18b577c6e290cfb2d05a7477eb96f919adaf
Status: Downloaded newer image for quay.io/microcks/microcks:latest
Pulling async-minion (quay.io/microcks/microcks-async-minion:latest)...
latest: Pulling from microcks/microcks-async-minion
b26afdf22be4: Already exists
218f593046ab: Already exists
67779099baee: Pull complete
625098ad0913: Pull complete
9318c2def511: Pull complete
Digest: sha256:04601232c4ef907d4aa8313d03523e0b7caf75c876aeadb9e68b17eca3e5e828
Status: Downloaded newer image for quay.io/microcks/microcks-async-minion:latest
Creating microcks-db ... done
Creating microcks-postman-runtime ... done
Creating microcks-sso ... done
Creating microcks-zookeeper ... done
Creating microcks-kafka ... done
Creating microcks ... done
Creating microcks-async-minion ... done
After some minutes, check everything is running. Microcks app is bound on localhost:8080
, Keyclaok is bound on localhost:18080
and Kafka broker is bound on localhost:19092
:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9e7380dfe580 quay.io/microcks/microcks-async-minion:latest "/deployments/run-ja…" 5 minutes ago Up 3 minutes 8080/tcp microcks-async-minion
79c1ff64f80c quay.io/microcks/microcks:latest "/deployments/run-ja…" 5 minutes ago Up 5 minutes 0.0.0.0:8080->8080/tcp, :::8080->8080/tcp, 8778/tcp, 0.0.0.0:9090->9090/tcp, :::9090->9090/tcp, 9779/tcp microcks
94142f738afc strimzi/kafka:0.17.0-kafka-2.4.0 "sh -c 'bin/kafka-se…" 5 minutes ago Up 5 minutes 0.0.0.0:9092->9092/tcp, :::9092->9092/tcp, 0.0.0.0:19092->19092/tcp, :::19092->19092/tcp microcks-kafka
8a9fd11f8aaa mongo:3.4.23 "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 27017/tcp microcks-db
547af6ae0758 jboss/keycloak:14.0.0 "/opt/jboss/tools/do…" 5 minutes ago Up 5 minutes 8443/tcp, 0.0.0.0:18080->8080/tcp, :::18080->8080/tcp microcks-sso
acd803f46dec strimzi/kafka:0.17.0-kafka-2.4.0 "sh -c 'bin/zookeepe…" 5 minutes ago Up 5 minutes 0.0.0.0:2181->2181/tcp, :::2181->2181/tcp microcks-zookeeper
afa7ef760733 quay.io/microcks/microcks-postman-runtime:latest "docker-entrypoint.s…" 5 minutes ago Up 5 minutes 3000/tcp microcks-postman-runtime
Now, follow the Getting Started guide. First access Microcks on localhost:8080
from your browser and use admin/microcks123
to log in. Then got to the Importers
and add a new importer on https://raw.githubusercontent.com/microcks/microcks/master/samples/UserSignedUpAPI-asyncapi.yml
URL as specified in Loading samples section.
Check the relevant logs on Microcks container:
$ docker logs 79c1ff64f80c
...
09:06:19.401 DEBUG 1 --- [080-exec-3] io.github.microcks.web.JobController : Creating new job: io.github.microcks.domain.ImportJob@48b6ac83
09:06:19.439 DEBUG 1 --- [080-exec-1] io.github.microcks.web.JobController : Activating job with id 611a2a8b510091547e69a8ff
09:06:19.446 DEBUG 1 --- [080-exec-7] io.github.microcks.web.JobController : Getting job list for page 0 and size 20
09:06:19.462 DEBUG 1 --- [080-exec-4] io.github.microcks.web.JobController : Starting job with id 611a2a8b510091547e69a8ff
09:06:19.465 INFO 1 --- [080-exec-4] i.github.microcks.service.JobService : Starting import for job 'User signed-up API Job'
09:06:19.467 INFO 1 --- [080-exec-4] i.g.microcks.service.ServiceService : Importing service definitions from https://raw.githubusercontent.com/microcks/microcks/master/samples/UserSignedUpAPI-asyncapi.yml
09:06:19.939 INFO 1 --- [080-exec-4] i.g.m.u.MockRepositoryImporterFactory : Found an asyncapi: 2 pragma in file so assuming it's an AsyncAPI spec to import
09:06:20.009 DEBUG 1 --- [080-exec-4] i.g.microcks.service.ServiceService : Service [User signed-up API, 0.1.1] exists ? false
09:06:20.081 DEBUG 1 --- [080-exec-4] i.g.microcks.service.ServiceService : Service change event has been published
09:06:20.081 INFO 1 --- [080-exec-4] i.g.microcks.service.ServiceService : Having imported 1 services definitions into repository
09:06:20.081 DEBUG 1 --- [ task-3] i.g.m.l.ServiceChangeEventPublisher : Received a ServiceChangeEvent on 611a2a8c510091547e69a900
09:06:20.087 DEBUG 1 --- [ task-3] i.g.microcks.service.MessageService : Found 2 event(s) for operation 611a2a8c510091547e69a900-SUBSCRIBE user/signedup
09:06:20.088 INFO 1 --- [080-exec-4] i.github.microcks.service.JobService : Import of job 'User signed-up API Job' done
...
From now, you should start having messages on the Kafka broker. Check the relevant logs on Microcks-async-minion container:
$ docker logs 9e7380dfe580
...
2021-08-16 09:06:20,109 INFO [io.git.mic.min.asy.AsyncMockDefinitionUpdater] (vert.x-eventloop-thread-0) Received a new change event [CREATED] for '611a2a8c510091547e69a900', at 1629104780088
2021-08-16 09:06:20,111 INFO [io.git.mic.min.asy.AsyncMockDefinitionUpdater] (vert.x-eventloop-thread-0) Found 'SUBSCRIBE user/signedup' as a candidate for async message mocking
2021-08-16 09:06:20,131 INFO [io.git.mic.min.asy.SchemaRegistry] (vert.x-eventloop-thread-0) Updating schema registry for 'User signed-up API - 0.1.1' with 1 entries
2021-08-16 09:06:21,491 INFO [io.git.mic.min.asy.pro.ProducerManager] (QuarkusQuartzScheduler_Worker-21) Producing async mock messages for frequency: 3
2021-08-16 09:06:21,492 INFO [io.git.mic.min.asy.pro.KafkaProducerManager] (QuarkusQuartzScheduler_Worker-21) Publishing on topic {UsersignedupAPI-0.1.1-user-signedup}, message: {"id": "9BBHsmLBUIWyhflhGAHUG45Pjt6CXPhp", "sendAt": "1629104781492", "fullName": "Laurent Broudoux", "email": "[email protected]", "age": 41}
2021-08-16 09:06:21,495 INFO [io.git.mic.min.asy.pro.KafkaProducerManager] (QuarkusQuartzScheduler_Worker-21) Publishing on topic {UsersignedupAPI-0.1.1-user-signedup}, message: {"id":"jNWJfGXrBBV8XHZGDaob9EIMUcwFU7DY","sendAt":"1629104781495","fullName":"John Doe","email":"[email protected]","age":36}
2021-08-16 09:06:24,491 INFO [io.git.mic.min.asy.pro.ProducerManager] (QuarkusQuartzScheduler_Worker-23) Producing async mock messages for frequency: 3
2021-08-16 09:06:24,491 INFO [io.git.mic.min.asy.pro.KafkaProducerManager] (QuarkusQuartzScheduler_Worker-23) Publishing on topic {UsersignedupAPI-0.1.1-user-signedup}, message: {"id": "XUoUVFVFfZqYY2dF03Gc85cCyQexC1I0", "sendAt": "1629104784491", "fullName": "Laurent Broudoux", "email": "[email protected]", "age": 41}
2021-08-16 09:06:24,461 INFO [io.git.mic.min.asy.pro.KafkaProducerManager] (QuarkusQuartzScheduler_Worker-23) Publishing on topic {UsersignedupAPI-0.1.1-user-signedup}, message: {"id":"boP3SoD1dm2ExjoxpKFJrGPaJWOZ17yp","sendAt":"1629104784461","fullName":"John Doe","email":"[email protected]","age":36}
2021-08-16 09:06:25,492 INFO [io.git.mic.min.asy.pro.ProducerManager] (QuarkusQuartzScheduler_Worker-22) Producing async mock messages for frequency: 10
...
Check the Kafka topic for messages, directly from your machine shell using kafkacat
utility and 19092
advertised port:
$ kafkacat -b localhost:19092 -t UsersignedupAPI-0.1.1-user-signedup -o end
% Auto-selecting Consumer mode (use -P or -C to override)
% Reached end of topic UsersignedupAPI-0.1.1-user-signedup [0] at offset 294
{"id": "THioqM7DDi3MpmyzqjBOMF0042v6g9wE", "sendAt": "1629104973491", "fullName": "Laurent Broudoux", "email": "[email protected]", "age": 41}
{"id":"6JGKPNQc6VXp7YcUY8en0s51QOMRsYCA","sendAt":"1629104973506","fullName":"John Doe","email":"[email protected]","age":36}
% Reached end of topic UsersignedupAPI-0.1.1-user-signedup [0] at offset 296
{"id": "WYzURh5K7pyT4OXzUFqpwFpnLs6raoaH", "sendAt": "1629104976492", "fullName": "Laurent Broudoux", "email": "[email protected]", "age": 41}
{"id":"Dnlv8v7ozHtmbRfMCF7FXmf0KIxza9qT","sendAt":"1629104976495","fullName":"John Doe","email":"[email protected]","age":36}
% Reached end of topic UsersignedupAPI-0.1.1-user-signedup [0] at offset 298
You can also connect to the running Microcks-kafka container to use the built-in Kafka tools. This time, you access the broker using the kafka:9092
address:
$ docker exec -it acd803f46dec /bin/sh
sh-4.2$ cd bin/
sh-4.2$ ./kafka-topics.sh --bootstrap-server kafka:9092 --list
UsersignedupAPI-0.1.1-user-signedup
__consumer_offsets
microcks-services-updates
sh-4.2$ ./kafka-console-consumer.sh --bootstrap-server kafka:9092 --topic UsersignedupAPI-0.1.1-user-signedup
{"id": "SSPOBJI42V57zxkpm1g4jdKBiTLFzxfO", "sendAt": "1629105318492", "fullName": "Laurent Broudoux", "email": "[email protected]", "age": 41}
{"id":"Ovq5N3tIr5bVyPPVHZFLZ5sUThLE45yA","sendAt":"1629105318497","fullName":"John Doe","email":"[email protected]","age":36}
{"id": "dOHY2U3y4KyNVVJ0u8fmOtJpYRVYHFIb", "sendAt": "1629105321492", "fullName": "Laurent Broudoux", "email": "[email protected]", "age": 41}
{"id":"y6S2auSwy9V5HJLlwN0k8gFl7gbOPtEX","sendAt":"1629105321495","fullName":"John Doe","email":"[email protected]","age":36}
^CProcessed a total of 4 messages
sh-4.2$ exit
exit
That's it!