MQ Tracing with Instana

Zhimin Wen
7 min readMar 27, 2022
Image by Bertsz from Pixabay

In this paper, I will explore how we use Instana to trace a Java Spring Boot application, down to its JMS messaging, and further down to the underlying Queue manager (IBM MQ).

The environment is Kubernetes based. All the components including the application, MQ, Instana agent are running on the OpenShift container platform (OCP).

The Spring Boot Application

I use the demo springboot application as the base, which can be cloned from this repo. We use JMS to talk to to MQ. The following utilities is developed to send IBM MQ message through JMS.

In the method of JmsConnectionFactory creation, get all the configuration settings from the environment variables, including the MQ hostname, port, queue manager name, channel and so on. As we running on kubernetes, I use certificate’s common name to map to the MQ’s user instead of the common user/password pairs. In the function, we load the keystore for its certificate and use that for the TLS communication and for the authentication and authorization purpose. (refer to my last medium paper for more detais)

With this utilities, we can have the following HTTP handler to send test message to MQ.

@GetMapping("/putmsg")
public String putMessage(){
boolean res = MQUtil.SendMessage("MY_APP", "testq1", "testing message");
if(res){
return "message posted";
}else{
return "error in posting the message";
}
}

Deploy of IBM MQ

Before we deploy the Spring Boot application, lets setup the MQ with the latest IBM CloudPak for Integration. The queue manager is created with the MQ operator. The CR for it is shown as following,

apiVersion: mq.ibm.com/v1beta1
kind: QueueManager
metadata:
name: my-mq
spec:
license:
accept: true
license: L-RJON-BZFQU2
use: NonProduction
queueManager:
name: qm1
resources:
limits:
cpu: 500m
requests:
cpu: 500m
storage:
queueManager:
type: persistent-claim…

--

--