Author |
Message
|
sekarnaren |
Posted: Thu Jul 10, 2008 10:44 pm Post subject: Problem reading Activity Report PCF Message |
|
|
Newbie
Joined: 10 Jul 2008 Posts: 3
|
Hi All,
Am facing a problem while reading Activity Report Message.
Background:
I Enabled activity recording on my QMGR, by altering the ACTIVREC attribute of the QMGR.
On enabling the same the sending MCA(SDR Channel) and the receiving MCA(RCVR Channel) are sending Activity report PCF messages to SYSTEM.ADMIN.ACTIVITY.QUEUE, for the messages which has requested activity reports to be generated.
Am trying to read these PCF messages from my java code using:
Code: |
PCFMessage pcf = new PCFMessage (message); |
While doing so am getting the following exception
Quote: |
com.ibm.mq.MQException: MQJE001: Completion Code 2, Reason 3001: MQRCCF_CFH_TYPE_ERROR |
But the same code is able to read QMGR event PCF messages and Channel event PCF messages using the same code.
Code: |
package test;
import com.ibm.mq.*;
import com.ibm.mq.jms.PCF;
import com.ibm.mq.pcf.*;
import java.io.*;
import javax.jms.JMSException;
public class ReadPCFMessages
{
public static void main (String [] args)
{
int messageCount = 0;
String qName = "SYSTEM.ADMIN.ACTIVITY.QUEUE";
String qmName = "NAREN_SOURCE";
try
{
MQEnvironment.hostname="10.128.24.73";
MQEnvironment.channel="SYSTEM.DEF.SVRCONN";
MQEnvironment.port=1414;
MQException.log = null;
MQQueueManager qm = new MQQueueManager (qmName);
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;
while (true)
{
message.messageId = null;
message.correlationId = null;
queue.get (message, gmo);
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");
}
}
} |
[/code] |
|
Back to top |
|
 |
amitgoelamit |
Posted: Wed Jul 23, 2008 11:30 pm Post subject: |
|
|
Novice
Joined: 19 Jul 2008 Posts: 20
|
Hi,
I also tried doing same and got same error.
Please let me know if you got any break through!!
I will be trying to find activity pcf group
Activity report consist of
1 MQMD
2. Data:
2.1 MQEPH (embedded PCF header)
2.2 report data |
|
Back to top |
|
 |
amitgoelamit |
Posted: Wed Jul 23, 2008 11:37 pm Post subject: |
|
|
Novice
Joined: 19 Jul 2008 Posts: 20
|
sekarnaren,
how did u enable the message for activity report.
I was able to do it by setting activity_report flag with discard and discard_expiry flag.
Wondering what could be side effects of these flags. |
|
Back to top |
|
 |
sekarnaren |
Posted: Thu Jul 24, 2008 12:03 am Post subject: |
|
|
Newbie
Joined: 10 Jul 2008 Posts: 3
|
Hi Amit,
I enabled the message for activity report using the report field in MQMD.
See the below code snippet.
Code: |
MQMessage msg = new MQMessage();
msg.report = MQC.MQRO_ACTIVITY; |
Once it is enabled the sending MCA and the receiving MCA, automatically generates activity report for the above message, which can be found in SYSTEM.ADMIN.ACTIVITY.QUEUE.
Am still breaking my head to crak this  |
|
Back to top |
|
 |
amitgoelamit |
Posted: Sat Jul 26, 2008 12:55 am Post subject: |
|
|
Novice
Joined: 19 Jul 2008 Posts: 20
|
I dont know how u achieved generation report by just setting activity_report.
I had to do:
int reportOpts = MQC.MQRO_ACTIVITY |
MQC.MQRO_DISCARD_MSG |
MQC.MQRO_PASS_DISCARD_AND_EXPIRY;
i was able to read the header information of activity report via MQMessage... I guess its like a normal message.... just exploring the way to get to read and parse activity report data section!!
u got any breakthrough? |
|
Back to top |
|
 |
sekarnaren |
Posted: Sun Jul 27, 2008 7:27 pm Post subject: |
|
|
Newbie
Joined: 10 Jul 2008 Posts: 3
|
Hi,
Code: |
int reportOpts = MQC.MQRO_ACTIVITY |
MQC.MQRO_DISCARD_MSG |
MQC.MQRO_PASS_DISCARD_AND_EXPIRY; |
In the above code snippet u ve attached, "MQC.MQRO_ACTIVITY" alone is mandatory to generated activity report for that message, the rest (MQC.MQRO_DISCARD_MSG | MQC.MQRO_PASS_DISCARD_AND_EXPIRY) are optional, so i did not use that in my code.
How did you manage to read the header??
Can you please share the code snippet?? |
|
Back to top |
|
 |
amitgoelamit |
Posted: Mon Jul 28, 2008 7:52 am Post subject: |
|
|
Novice
Joined: 19 Jul 2008 Posts: 20
|
hi,
I read the activity report from ACTIVITY.QUEUE in normal way and then read header of activity report using the MQMessage fields and methods....
the challenge is in reading the data section ...
I am referring to chapter 13 of 'Monitoring Websphere MQ" pdf and then use readInt() , readString()... to read data in sequence....
I observed that where doc say datatype to be Long .. I used readInt to get proper value.. otherwise with readLong() was giving wrong information....
With this I am able to reach to PCF header section in the data part...
Code: |
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;
//PCFMessage p = new PCFMessage(message);
queue.get (message, gmo);
//PCFMessage pcf = new PCFMessage (message);
int dataLength = message.getDataLength();
int dataOffset = message.getDataOffset();
int msgLen = message.getMessageLength();
int totMsgLen = message.getTotalMessageLength();
String applOriginData = message.applicationOriginData;
int feedback = message.feedback;
String format = message.format;
int charSet = message.characterSet;
|
I am actually surprised to see that not much of code snippets or help available in dev community over this.... and above that there is no ActivityReport class from IBM.. considering the static structure of it.... wonder why??
... where did u reach?
will post the data parser when i reach that point.... |
|
Back to top |
|
 |
|