|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
How to parse Activity Trace msg with Java? (WMQ V7.0+) |
« View previous topic :: View next topic » |
Author |
Message
|
issac |
Posted: Tue Oct 27, 2015 11:36 pm Post subject: How to parse Activity Trace msg with Java? (WMQ V7.0+) |
|
|
 Disciple
Joined: 02 Oct 2008 Posts: 158 Location: Shanghai
|
Dear experts
I've found Activity Tracing quite helpful. Unfortunately amqsact output is not idea, and I want to have a customized app for AT.
I'm not quite into C. However by reading amqsact0.c I got the following info about parsing AT msgs:
1) It is quite likely to be programed with PCF command: MQConstant.MQCMD_ACTIVITY_TRACE.
2) This PCF command should accept at least 1 parameter, which is a queuename, which defaults to SYSTEM.ADMIN.TRACING.ACTIVITY
Is there any doc showing what the PCF parameter should be ?
Is there any support pack/sth already to parse AT msgs in a more user-friendly format?
This is my program so far (don't laugh )
Code: |
package com.ibm.issac.moe.wmq.pcf;
import java.io.IOException;
import com.ibm.issac.moe.wmq.pcf.ibmshipped.PCF_CommonMethods;
import com.ibm.issac.toolkit.logging.Plog;
import com.ibm.mq.constants.MQConstants;
import com.ibm.mq.headers.MQDataException;
import com.ibm.mq.headers.pcf.PCFMessage;
public class DisplayActivityTrace {
public static void main(String[] args) {
PCF_CommonMethods pcfCM = new PCF_CommonMethods();
try {
if (pcfCM.ParseParameters(args)) {
pcfCM.CreateAgent(args.length);
displayActivityTrace(pcfCM,"CHL2");
pcfCM.DestroyAgent();
}
} catch (Exception e) {
pcfCM.DisplayException(e);
}
return;
}
public static String displayActivityTrace(PCF_CommonMethods pcfCM, String chlName) throws MQDataException, IOException {
Plog.p2("Inquiring Activity Trace...");
PCFMessage pcfCmd = new PCFMessage(MQConstants.MQCMD_ACTIVITY_TRACE);
PCFMessage[] rsp = pcfCM.agent.send(pcfCmd);
return null;
}
}
|
It doesn't work as expected . it gives 3007 0x00000bbf MQRCCF_CFH_COMMAND_ERROR _________________ Bazinga! |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Oct 28, 2015 4:38 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
... Ok. That code doesn't really look familiar to me.
You should hopefully understand that you have to configure activity tracing using the mqat.ini file, it's not something you can manage from PCF messages.
Then you need to read the appropriate queue with a PCF agent or otherwise just get messages and pass them to a PCF java class to parse the PCF structures.
There might be easy ways from there to extract the AT information, but when I've written PCF code, I've just used the constants to identify each piece and then access the values to do what I want.
Looking at your code, and the PCF_DisplayConnections.java sample, it does look like your code is the current method. You just need to implement the part that looks like
Code: |
String msgExit = (String) response.getParameterValue(MQConstants.MQCACH_MSG_EXIT_NAME); |
And etc, as relevant for the structure of the Activity Trace PCF response messages.
You might look at just using the MQCACH class and etc. directly instead of using MQConstants.
The reference on the structure of the Activity Trace messages starts here: http://www-01.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.mon.doc/q037590_.htm _________________ chmod -R ugo-wx / |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Oct 28, 2015 5:01 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If you want to just evaluate existing pcf messages (created by your activity trace) you can use java base to read the message off the queue and create your pcf message as follows (from memory)
Code: |
PCFMessage pcfm = new PCFMessage(basemqmsg); |
Remember to use props compatibility in your open options to correctly report the pcf format of the mq base message.
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
tczielke |
Posted: Wed Oct 28, 2015 8:09 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|