Installing AMQ Broker Operator from OperatorHub
- Launch your web browser and open a new tab with the Administrator view of the web console for your Openshift cluster. Login to the console as an administrator.
- After login, click Operators->OperatorHub in the left side navigation menu.
- On the Project drop-down menu at the top of the OperatorHub page, select the project in which you want to install in the Operator.
- There are quite a few different operators shown on the page. You can use the Filter by keyword box at the top of the page to quickly locate the AMQ Broker Operator. Just input text “Red Hat Integration - AMQ Broker Operator” and click on the result operator.
Note you may find two operators in the filtered list. In that case, choose the operator whose name is exactly “Red Hat Integration - AMQ Broker Operator”. The other one is the Long Time Support (LTS) version of the AMQ Broker Operator.
- Click Red Hat Integration - AMQ Broker Operator. In the dialog box that appears, click Install.
It will bring you to the AMQ Broker Operator configuration page.
Currently, the AMQ broker operator supports watching one specific namespace
- Click Install.
When the Operator installation is complete, it will show you that the operator is ready to use.
- Click View Operator and you will get the installed AMQ Broker Operator details page.
Creating AMQ Broker Instances with the Operator
- At the operator details page, click Create new instance under the AMQ Broker box.
- On the creation page, you can configure the broker. Fill in adminUser and adminPassword with values
admin
andadmin
. Then, under Deployment Plan, change the size value to1
. Finally, click the Create button at the bottom.If you don’t supply values for adminUserand adminPassword,they will be randomly generated. The Deployment Plan’s size default is 2.
- Then the console will show you the created Artemis instance with status. Click on the Name of the broker instance to see more details.
The details page will look like this:
It tells you that you have successfully created one AMQ Broker pod in Red Hat OpenShift.
Send and receive messages
Now you can test the broker pods by sending and receiving some messages.
- From the command line, login to the OpenShift cluster and change into your project where the operator is installed. Check the pod status:
$ oc get pod amq-broker-operator-65545f7f6-xlrbx 1/1 Running 0 53m ex-aao-ss-0 1/1 Running 0 44m
- Login to the broker pod ex-aao-ss-0.
$ oc rsh ex-aao-ss-0
- Use the Artemis CLI to send some messages, e.g.
$ amq-broker/bin/artemis producer --user admin --password admin --url tcp://ex-aao-ss-0:61616 --message-count 100 OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N Connection brokerURL = tcp://ex-aao-ss-0:61616 Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed time ... Producer ActiveMQQueue[TEST], thread=0 Produced: 100 messages Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 1 s Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second : 1796 milli seconds
- Consume the messages.
$ amq-broker/bin/artemis consumer --user admin --password admin --url tcp://ex-aao-ss-0:61616 --message-count 100 OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N Connection brokerURL = tcp://ex-aao-ss-0:61616 Consumer:: filter = null Consumer ActiveMQQueue[TEST], thread=0 wait until 100 messages are consumed Consumer ActiveMQQueue[TEST], thread=0 Consumed: 100 messages Consumer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 0 s Consumer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second : 61 milli seconds Consumer ActiveMQQueue[TEST], thread=0 Consumed: 100 messages Consumer ActiveMQQueue[TEST], thread=0 Consumer thread finished
Congratulations! You just deployed the AMQ Broker Operator and deployed a broker to send and receive messages.
For details and more information please refer to AMQ Broker online documentation:
Last updated: November 14, 2023