The examples show the ways we can connect to an IBM MQ Server using Camel K
You can find more information about Apache Camel and Apache Camel K on the official Camel website.
Read the general instructions in the root README.md file for setting up your environment and the Kubernetes cluster before looking at this example.
Make sure you've read the installation instructions for your specific cluster before starting the example.
An IBM MQ Server: Queue manager for providing queuing services to clients. For installation instructions, see How to deploy an IBM MQ Server to a Kubernetes cluster for demo purposes.
Deploy the IBM MQ Server, as described in the ibm-mq-server-deploy/README.md
Change the IBM MQ Server address in the MQRoute.java class file
ibmip=`kubectl get svc/ibm-mq-server -ojsonpath="{.spec.clusterIP}"`; sed -i "/mqHost/s/\".*\"/\"$ibmip\"/g" MQRoute.java
For licensing reasons, the IBM MQ Java libraries are not defined in the routes themselves, but you can declare the dependency while running the integration. Alternatively, you can use Kamel modeline to add the dependency in the route file as a header.
kamel run --dev MQRoute.java -d mvn:com.ibm.mq:com.ibm.mq.allclient:9.2.5.0
It will print the following output in the console
JmsConsumer[DEV.QUEUE.1]) Exchange[ExchangePattern: InOnly, BodyType: String, Body: Hello Camel K! #2]
The kamel commands below set the following configurations:
Secret
object.Run the integration to generate messages and send them to the IBM MQ Queue (there is no output in the console)
kamel run --dev jms-ibm-mq-sink-binding.yaml -d mvn:com.ibm.mq:com.ibm.mq.allclient:9.2.5.0 --config secret:ibm-mq/ibm-mq-password -p serverName=`kubectl get svc/ibm-mq-server -ojsonpath="{.spec.clusterIP}"`
Run the integration to retrieve messages from the IBM MQ Queue and print in the console.
kamel run --dev jms-ibm-mq-source-binding.yaml -d mvn:com.ibm.mq:com.ibm.mq.allclient:9.2.5.0 --config secret:ibm-mq/ibm-mq-password -p serverName=`kubectl get svc/ibm-mq-server -ojsonpath="{.spec.clusterIP}"`