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 read SYSTEM.ADMIN.XXX.EVENT

Post new topic  Reply to topic
 How to read SYSTEM.ADMIN.XXX.EVENT « View previous topic :: View next topic » 
Author Message
pmane
PostPosted: Sun Sep 08, 2002 10:17 pm    Post subject: How to read SYSTEM.ADMIN.XXX.EVENT Reply with quote

Acolyte

Joined: 17 Oct 2001
Posts: 50

I am trying to read the SYSTEM.ADMIN.CHANNEL.EVENT QUEUE in Java.
I am not able to open it as it says it is in use. Can't I check for the events.
My options are
qMgr = new MQQueueManager(qManager);
int openOptions = MQC.MQOO_INPUT_SHARED | MQC.MQOO_BROWSE ;
Back to top
View user's profile Send private message
pmane
PostPosted: Mon Sep 09, 2002 2:03 am    Post subject: Reply with quote

Acolyte

Joined: 17 Oct 2001
Posts: 50

Just got an additional info about the PCF commands. But I am unable to get a sample source code that can read EVENT queu using PCF command. Do we need PCF command to read the EVENT QUEUE ? as I do find MQCMD_PERFM_EVENT in CMQCFC Java class
Back to top
View user's profile Send private message
nimconsult
PostPosted: Mon Sep 09, 2002 11:00 pm    Post subject: Reply with quote

Master

Joined: 22 May 2002
Posts: 268
Location: NIMCONSULT - Belgium

Most probable cause is that another process has opened the queue in exclusive mode (which is by the way the default open option on event queues if I remeber well). You may have a monitoring agent already running on your queue manager.

If it is not the case, can you be more specific on the type of error and reason code you receive in your application?
_________________
Nicolas Maréchal
Senior Architect - Partner

NIMCONSULT Software Architecture Services (Belgium)
http://www.nimconsult.be
Back to top
View user's profile Send private message Send e-mail Visit poster's website
pmane
PostPosted: Tue Sep 10, 2002 12:48 am    Post subject: Reply with quote

Acolyte

Joined: 17 Oct 2001
Posts: 50

My error was MQJE001 : Completion code 2 and reason code 2042. I am not using any other event monitoring tool. But not I have a improvement , this error comes only some times. Other wise my program works fine. Have any idea if any other process might use event queues in exec mode ? Below is my code
import java.io.*;
import com.ibm.mq.*;
import com.ibm.mq.pcf.*;
import java.util.*;
import java.text.*;


public class ChannelMonitorNew {


/**
* For testing only.
*/
public static void main(String[] args) {

try {

String qManager = "GLANSERGW.QUEUE.MANAGER";
MQQueueManager qMgr;

java.util.Hashtable properties;

qMgr = new MQQueueManager(qManager);

MQQueue mqqueue =
qMgr.accessQueue("SYSTEM.ADMIN.CHANNEL.EVENT", 8201);

MQGetMessageOptions mqgetmessageoptions = new MQGetMessageOptions();
mqgetmessageoptions.matchOptions = 0;
mqgetmessageoptions.waitInterval = 333;
mqgetmessageoptions.options = 8225;
boolean flag = false;

int i = 0 ;
while(true){

MQMessage mqmessage = new MQMessage();
mqqueue.get(mqmessage, mqgetmessageoptions);
System.out.println("Got an event message!");
SimpleDateFormat simpledateformat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
GregorianCalendar eventTime = ((MQMD) (mqmessage)).putDateTime;
PCFMessage pcfeventmessage = new PCFMessage(mqmessage);
System.out.println("--------------------" + "EVENT:" + i + "----------------" + "\n" +
"Time:" + simpledateformat.format(eventTime.getTime()) + "\n" +
"Command: " + pcfeventmessage.getCommand() + "\n" +
"CompCode: " + pcfeventmessage.getCompCode() + "\n" +
"Reason: " + pcfeventmessage.getReason() + "\n" +
"Control:" + pcfeventmessage.getControl() + "\n" +
"ParameterCount" + pcfeventmessage.getParameterCount() + "\n");

if(pcfeventmessage.getReason() == CMQC.MQRC_CHANNEL_STARTED){

System.out.println(pcfeventmessage.getStringParameterValue(CMQCFC.MQCACH_CHANNEL_NAME) +
" on Transmission Queue : " +
pcfeventmessage.getStringParameterValue(CMQCFC.MQCACH_XMIT_Q_NAME) +
" with connection name :" +
pcfeventmessage.getStringParameterValue(CMQCFC.MQCACH_CONNECTION_NAME) +
" CHANNEL STARTED" + "\n") ;
}else
if(pcfeventmessage.getReason() == CMQC.MQRC_CHANNEL_STOPPED){

System.out.println(pcfeventmessage.getStringParameterValue(CMQCFC.MQCACH_CHANNEL_NAME) +
" on Transmission Queue : " +
pcfeventmessage.getStringParameterValue(CMQCFC.MQCACH_XMIT_Q_NAME) +
" with connection name :" +
pcfeventmessage.getStringParameterValue(CMQCFC.MQCACH_CONNECTION_NAME) +
" CHANNEL STOPPED" + "\n") ;
}else {
System.out.println("SOME OTHER CODE" + "\n") ;
}

//System.out.println("MESSAGE:" + pcfeventmessage.toString());
i++;


}

//mqqueue.close();
//qMgr.disconnect();

}
catch (Exception ex)
{
ex.printStackTrace();
}

}

}
Back to top
View user's profile Send private message
nimconsult
PostPosted: Tue Sep 10, 2002 10:19 pm    Post subject: Reply with quote

Master

Joined: 22 May 2002
Posts: 268
Location: NIMCONSULT - Belgium

Yes I have an idea: your application is blocking itself!

Try to reproduce this:
- make sure your event queue until you see an open input count 0.
- run your application.
- when the application ends look immediately at the open input count. Chance are great that open input count remains 1 for some seconds.
- if you restart your application immediately you fail to open the queue because the handle of the previous execution was not cleaned.


The first thing you should do is to close the queue and disconnect from the queue manager when you leave the application (a quick look at your code shows that the lines are currently commented). This gives more opportunity to MQ to clean the handles smoothly.
_________________
Nicolas Maréchal
Senior Architect - Partner

NIMCONSULT Software Architecture Services (Belgium)
http://www.nimconsult.be
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General Discussion » How to read SYSTEM.ADMIN.XXX.EVENT
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.