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 » IBM MQ Java / JMS » Clue or Sample program to read activity report?

Post new topic  Reply to topic
 Clue or Sample program to read activity report? « View previous topic :: View next topic » 
Author Message
amitgoelamit
PostPosted: Wed Jul 23, 2008 11:40 pm    Post subject: Clue or Sample program to read activity report? Reply with quote

Novice

Joined: 19 Jul 2008
Posts: 20

Am trying to write java program to read and parse activity report.
It will be helpful if anyone can guide me to apis and preferably a sample Activity report reader and parser code


From documentation Activity report consist of
1 MQMD
2. Data:
2.1 MQEPH (embedded PCF header)
2.2 report data


But, there has to be a parent to have MQMD and DATA inside that parent. What is that? What is the starting point.

Help appreciated!!
Back to top
View user's profile Send private message
amitgoelamit
PostPosted: Sun Jul 27, 2008 4:57 am    Post subject: Reply with quote

Novice

Joined: 19 Jul 2008
Posts: 20

Hi java_problem, fjb_saper, all

I am trying to read the activity report. Got the activity report structure at
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqsav.doc/csqsav0464.htm
and further details at
http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp?topic=/com.ibm.mq.csqsav.doc/csqsav0464.htm


documentation says
Activity reports are standard WebSphere MQ report messages containing a message descriptor and message data. Activity reports are PCF messages generated by applications that have performed an activity on behalf of a message as it has been routed through a queue manager network.

In the same line Activity report is considered as standard report message and also PCF message. Confusing ...

I was able to read activity report and get header information using
Code:
               MQQueue queue = qm.accessQueue (qName, MQC.MQOO_BROWSE | MQC.MQOO_FAIL_IF_QUIESCING);
              
               MQMessage message = new MQMessage ();
               MQGetMessageOptions gmo = new MQGetMessageOptions ();
              
              
               gmo.options = MQC.MQGMO_BROWSE_NEXT | MQC.MQGMO_NO_WAIT | MQC.MQGMO_CONVERT;


                   message.messageId = null;
                   message.correlationId = null;

                   queue.get (message, gmo);


and then got header information by message.
So that means activity report is a normal message since I the code didnt threw any exception.
However for statement
Code:
 PCFMessage pcf = new PCFMessage (message);


I got QJE001: Completion Code 2, Reason 3001: MQRCCF_CFH_TYPE_ERROR

that means atleast PCFMessage is not the way to parse it..

Now considering the activity report is a normal MQMessage then getting to its data section is trickier...
documentation says activity data has 2 parts-
    1. Embedded PCF Header MQEPH and
    2. Activity Report Message Data itself - this inturn has MQMD and Embedded MQMD.


I am not able to get any clear documentation for parsing these... or any guide on parsing the information....

it will be helpful if anyone can provide sample code or guide or link to some clue towards this... even anything which can help me understanding parsing of data....

appreciate quick help!!

thanks
Back to top
View user's profile Send private message
amitgoelamit
PostPosted: Sun Jul 27, 2008 5:01 am    Post subject: Reply with quote

Novice

Joined: 19 Jul 2008
Posts: 20

Also the standard util code

Code:
import com.ibm.mq.*;
import com.ibm.mq.pcf.*;
import java.io.*;

public class ReadPCFMessages
{
    public static void main (String [] args)
    {
        int messageCount = 0;

        try
        {
            MQException.log = null;
            MQQueueManager qm = new MQQueueManager (args [0]);
            MQQueue queue = qm.accessQueue (args [1], MQC.MQOO_BROWSE | MQC.MQOO_FAIL_IF_QUIESCING);
            MQMessage message = new MQMessage ();
            MQGetMessageOptions gmo = new MQGetMessageOptions ();

            gmo.options = MQC.MQGMO_BROWSE_NEXT | MQC.MQGMO_NO_WAIT | MQC.MQGMO_CONVERT;

            while (true)
            {
                message.messageId = null;
                message.correlationId = null;
                queue.get (message, gmo);

                // Parse the message content using a PCFMessage object and print out the result.

                PCFMessage pcf = new PCFMessage (message);

                System.out.println ("Message " + ++messageCount + ": " + pcf + "\n");
            }
        }

        catch (MQException mqe)
        {
            if (mqe.reasonCode == MQException.MQRC_NO_MSG_AVAILABLE)
            {
                System.out.println (messageCount + (messageCount == 1 ? " message." : " messages."));
            }
            else
            {
                System.err.println (mqe + ": " + PCFConstants.lookupReasonCode (mqe.reasonCode));
            }
        }

        catch (IOException ioe)
        {
            System.err.println (ioe);
        }

        catch (ArrayIndexOutOfBoundsException abe)
        {
            System.err.println ("Usage: java " + ReadPCFMessages.class.getName () +
                " local-queue-manager-name queue-name");
        }
    }
}

works for Reading PCF messages including administration, event, accounting and statistics messages.

When code ran on SYSTEM.ADMIN.ACTIVITY.QUEUE got MQJE001: Completion Code 2, Reason 3001: MQRCCF_CFH_TYPE_ERROR

seeking clues !!!

thanks
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 » IBM MQ Java / JMS » Clue or Sample program to read activity report?
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.