ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General Discussion » How to parse Activity Trace msg with Java? (WMQ V7.0+)

Post new topic  Reply to topic
 How to parse Activity Trace msg with Java? (WMQ V7.0+) « View previous topic :: View next topic » 
Author Message
issac
PostPosted: Tue Oct 27, 2015 11:36 pm    Post subject: How to parse Activity Trace msg with Java? (WMQ V7.0+) Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Wed Oct 28, 2015 4:38 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Wed Oct 28, 2015 5:01 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20696
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
View user's profile Send private message Send e-mail
tczielke
PostPosted: Wed Oct 28, 2015 8:09 am    Post subject: Reply with quote

Guardian

Joined: 08 Jul 2010
Posts: 939
Location: Illinois, USA

Coming up with a Java equivalent to amqsact is a fine endeavor. However, if your main concern is deficiencies with amqsact, you may want to check out amqsactz -> http://www.capitalware.com/mq_code_c.html

I wrote amqsactz (which is enhancements to amqsact) out of my own struggles with using amqsact.

This MQTC session also gives some tips on how to use amqsactz -> http://www.mqtechconference.com/sessions_v2015/MQTC_v2015_Tracing.pdf
_________________
Working with MQ since 2010.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » How to parse Activity Trace msg with Java? (WMQ V7.0+)
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.