Skip to content

Testing the go client with Apache ActiveMQ Artemis 2.6.0 on Minishift

License

Notifications You must be signed in to change notification settings

xcoulon/fabric8-amqp

Repository files navigation

Fabric8-AMQP - Test case 2

Playing with Apache ActiveMQ Artemis 2.6.0 on OpenShift/Minishift

Deploying Apache ActiveMQ Artemis

First, the Docker image is built by downloading the Apache ActiveMQ Artemis archive, extracting it in a Docker openjdk:9 image and pushing it in the fabric8 org in the Openshift container registry:

$ make deploy-activemq-artemis

Building and deploying the publisher

Each new version of the publisher is automatically deployed using an ImageStream and a DeployConfig. Building and deploying a new version of the publisher happens with (all at once!)

make deploy-publisher

Building and deploying the subscribers

All subscribers share the same code but are configured differently in their DeployConfig.

To avoid repetition among the YAML files, both subscribers are created using the same OpenShift template:

# subscriber 1 with 0 replica
$ oc process -f openshift/subscriber.tmpl.yaml -p SERVICE=subscriber1 -p REPLICA_COUNT=0 -p TARGET_ADDRESSES=fabric8.queue1 | oc apply -f -

# subscriber 2 with 0 replica
$ oc process -f openshift/subscriber.tmpl.yaml -p SERVICE=subscriber2 -p REPLICA_COUNT=0 -p TARGET_ADDRESSES=fabric8.queue2 | oc apply -f -

The template used above creates both the ImageStream and the DeployConfig resources for each subscriber. Once this is done, a new version of the code can be deployed with

$ make deploy-subscribers

Checking the results

# start the Apache ActiveMQ Artemis-server (previous replicas was set to '0')
$ oc scale deploy/activemq-artemis --replicas=1
deployment "activemq-artemis" scaled


# start the publisher and subscribers (replica count was previously lowered to '0' to stop all publishing)
$ oc scale dc/publisher --replicas=1
deploymentconfig "publisher" scaled

$ oc get pods
NAME                               READY     STATUS    RESTARTS   AGE
activemq-artemis-8c96dbddb-vsqx7   1/1       Running   1          15h
publisher-98-5tcmv                 1/1       Running   0          2m

# check the logs on the publisher
$ oc logs publisher-98-5tcmv
INFO[0000] opening connection to broker on 'amqp:https://activemq-artemis:61616'...  id=publisher-98-5tcmv
INFO[0000] connection established with server at 'amqp:https://activemq-artemis:61616'  id=publisher-98-5tcmv
INFO[0000] obtained a new session at 'amqp:https://activemq-artemis:61616'  id=publisher-98-5tcmv
INFO[0003] preparing msg 'message #1                     id=publisher-98-5tcmv
INFO[0003] publishing msg 'message #1'...                id=publisher-98-5tcmv
INFO[0003] published msg 'message #1' to address 'fabric8.queue1'  id=publisher-98-5tcmv
INFO[0003] published msg 'message #1' to address 'fabric8.queue2'  id=publisher-98-5tcmv
INFO[0006] preparing msg 'message #2                     id=publisher-98-5tcmv
INFO[0006] publishing msg 'message #2'...                id=publisher-98-5tcmv
INFO[0006] published msg 'message #2' to address 'fabric8.queue1'  id=publisher-98-5tcmv
INFO[0006] published msg 'message #2' to address 'fabric8.queue2'  id=publisher-98-5tcmv
...
^C

# deploy subscribers 1 and 2 a few minutes after publisher was started
$ oc scale dc/subscriber1 dc/subscriber2 --replicas=1
deploymentconfig "subscriber1" scaled
deploymentconfig "subscriber2" scaled

$ oc get pods
NAME                               READY     STATUS    RESTARTS   AGE
activemq-artemis-8c96dbddb-vsqx7   1/1       Running   1          15h
publisher-98-5tcmv                 1/1       Running   0          4m
subscriber1-15-ppct6               1/1       Running   0          21s
subscriber2-9-8j7nx                1/1       Running   0          20s

# check the logs on subscriber 1
$ oc logs subscriber1-15-ppct6
INFO[0000] opening connection to broker on 'amqp:https://activemq-artemis:61616'...  id=subscriber1-15-ppct6
INFO[0000] connection established with server at 'amqp:https://activemq-artemis:61616'  id=subscriber1-15-ppct6
INFO[0000] obtained a new session at 'amqp:https://activemq-artemis:61616'  id=subscriber1-15-ppct6
INFO[0000] received msg: message #1                      id=subscriber1-15-ppct6
...
INFO[0000] received msg: message #76                     id=subscriber1-15-ppct6
INFO[0003] received msg: message #77                     id=subscriber1-15-ppct6
^C

# check the logs on subscriber 2
$ oc logs subscriber2-9-8j7nx
INFO[0000] opening connection to broker on 'amqp:https://activemq-artemis:61616'...  id=subscriber2-9-8j7nx
INFO[0000] connection established with server at 'amqp:https://activemq-artemis:61616'  id=subscriber2-9-8j7nx
INFO[0000] obtained a new session at 'amqp:https://activemq-artemis:61616'  id=subscriber2-9-8j7nx
INFO[0000] received msg: message #1                      id=subscriber2-9-8j7nx
...
INFO[0000] received msg: message #76                     id=subscriber2-9-8j7nx
INFO[0002] received msg: message #77                     id=subscriber2-9-8j7nx

Conclusion

All pending messages sent to the fabric8.queue1 and fabric8.queue2 queues were consumed when the subscribers were started.

About

Testing the go client with Apache ActiveMQ Artemis 2.6.0 on Minishift

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published