Author |
Message
|
Mangesh1187 |
Posted: Fri Dec 09, 2016 9:23 pm Post subject: Java with & without PCF |
|
|
Centurion
Joined: 23 Mar 2013 Posts: 116
|
Hi All,
I am working on to build utility to check the queues current status, using Java.
I wrote the java program and can able to get the values for few queue status attribut using below MQQueue methods :
getCurrentDepth()
getOpenInputCount()
getOpenOutputCount()
getMaximumDepth()
However I am not able to find the method to show the Last Put Date, Last Get Date, Connection Name etc.
I have searched on web and come to know about the PCF & used it in JAVA. And can able to get this details.
But I want to use only Java (not PCF) for getting these queue status attributes (Last Put Date, Last Get Date, Connection Name etc.)
Is this possible ? Any suggestions ?
![](images/smiles/helpsmilie.gif) |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
smdavies99 |
Posted: Sat Dec 10, 2016 12:02 am Post subject: Re: Java with & without PCF |
|
|
![](images/avatars/4738380695809c05f78f20.jpg) Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Mangesh1187 wrote: |
However I am not able to find the method to show the Last Put Date, Last Get Date, Connection Name etc.
|
Those sound like Channel properties not queue ones.
You don't connect directly to a queue with a connection name, that is part of the data held on the connection channel.
Also, I think you might be wanting the client IP address.
If not can you give more information about what you really want _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Mangesh1187 |
Posted: Sat Dec 10, 2016 7:47 am Post subject: |
|
|
Centurion
Joined: 23 Mar 2013 Posts: 116
|
smdavies99 , Thanks for your reply.
Quote: |
Those sound like Channel properties not queue ones. |
No, I am looking for the queue status properties.
Quote: |
Also, I think you might be wanting the client IP address.
If not can you give more information about what you really want |
Let me elaborate it more. I have a queue manager QM1 & a queue TESTQ that I want to inquire about.
Following is the Java program I used to do this task.
Code: |
import java.util.Hashtable;
import com.ibm.mq.*;
public class InquireQ
{
public static void main(String args[]) {
MQEnvironment.hostname = "localhost";
MQEnvironment.channel = "SYSTEM.DEF.SVRCONN";
MQEnvironment.port = 1501;
int openOptions = MQC.MQOO_INQUIRE + MQC.MQOO_FAIL_IF_QUIESCING + MQC.MQOO_INPUT_SHARED;
try{
MQQueueManager qMgr = new MQQueueManager("QM1");
MQQueue queue = qMgr.accessQueue("TESTQ", openOptions, null, null, null);
System.out.println("The Maximum depth : "+ queue.getMaximumDepth());
System.out.println("The current depth : "+ queue.getCurrentDepth());
System.out.println("Input Process count : "+ queue.getOpenInputCount());
System.out.println("Output Process count : "+ queue.getOpenOutputCount());
}catch(Exception e){
System.out.println("Exception occured");
}
}
} |
o/p:
The Maximum depth : 5000
The current depth : 0
Input Process count : 7
Output Process count : 0
Now what I want , apart from the above four attributes of QUEUE STATUS, want to get the details of queue status such as :
LastGetDate,LastPutDate,LastGetTIme,LastPutTIme,CONNAME , Channel Name etc.
But I am not able to find any such methods. I don't want to use PCF, instead like to use plain java methods like above.
Hence need help for the same. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
fjb_saper |
Posted: Sat Dec 10, 2016 9:00 am Post subject: |
|
|
![](images/avatars/gallery/misc/2.gif) Grand High Poobah
Joined: 18 Nov 2003 Posts: 20696 Location: LI,NY
|
Java PCF is using plain java. You will not find the methods for what you're looking for, because they don't exist as object method.
You have to use PCF or look at the brand new REST interface in 9.0.1.0!
Have fun ![](images/smiles/innocent.gif) _________________ MQ & Broker admin |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Mangesh1187 |
Posted: Sat Dec 10, 2016 9:08 am Post subject: |
|
|
Centurion
Joined: 23 Mar 2013 Posts: 116
|
Quote: |
Java PCF is using plain java. You will not find the methods for what you're looking for, because they don't exist as object method.
You have to use PCF or look at the brand new REST interface in 9.0.1.0! |
Thanks fjb_saper , for your reply.
I find using the Java methods , if any is lot easier for what I am looking for.
I have done the initial R&D on PCF & Java combination, and its little bit confusing to me.
But nevertheless, I am continuing my research with the help of Mr.Google & few pdfs. I hope I will get a rid of it soon. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Mangesh1187 |
Posted: Sat Dec 10, 2016 9:28 am Post subject: |
|
|
Centurion
Joined: 23 Mar 2013 Posts: 116
|
Another reason is not to use the PCF is it required the PUT & DSP authentications to the SYSTEM.ADMIN.COMMAND.QUEUE.
I am from the application team, and usually the MQ group won't provide the authorities to the SYSTEM.* queues. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Mangesh1187 |
Posted: Sat Dec 10, 2016 8:59 pm Post subject: |
|
|
Centurion
Joined: 23 Mar 2013 Posts: 116
|
Hi All,
I have done a little progress and prepared a small PCF sample to accomplish my task & its working.
PFB code excerpt.
Code: |
try{
PCFMessageAgent agent=new PCFMessageAgent("localhost",1501,"SYSTEM.DEF.SVRCONN");
PCFMessage request=new PCFMessage(CMQCFC.MQCMD_INQUIRE_Q_STATUS);
request.addParameter(CMQC.MQCA_Q_NAME,"TESTQ");
request.addParameter (CMQC.MQIA_Q_TYPE, MQC.MQQT_LOCAL);
PCFMessage[] responses = agent.send(request);
int count=responses[0].getParameterCount();
System.out.println("ReplyQueue : " + agent.replyQueueName) ;
String lastGetTime=null;
String lastPutTIme=null;
String qName=null;
System.out.println("QueueName LastPutTIme LastGetTimen\n\n");
for (int i=0; i < responses.length ; i++ ){
lastGetTime=(String) responses[i].getParameterValue(CMQCFC.MQCACF_LAST_GET_TIME);
lastPutTIme=(String) responses[i].getParameterValue(CMQCFC.MQCACF_LAST_PUT_TIME);
qName=(String) responses[i].getParameterValue(CMQC.MQCA_Q_NAME);
System.out.println(qName+" "+lastPutTIme+" "+lastGetTime);
}
}catch (Exception e){
System.out.println("Caught in the exception...!" );
e.printStackTrace();
|
o/p
ReplyQueue : AMQ.54B00FAA024F0020
QueueName LastPutTIme LastGetTimen
TESTQ 21.15.02
If you see in the output , the replyTO queue is created dynamically.
Can I use a physical LOCAL queue instead of dynamic queue for the responses ? If yes please guide me how to . |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
fjb_saper |
Posted: Mon Dec 12, 2016 5:34 am Post subject: |
|
|
![](images/avatars/gallery/misc/2.gif) Grand High Poobah
Joined: 18 Nov 2003 Posts: 20696 Location: LI,NY
|
Mangesh1187 wrote: |
If you see in the output , the replyTO queue is created dynamically.
Can I use a physical LOCAL queue instead of dynamic queue for the responses ? If yes please guide me how to . |
Have you looked at what methods are available to the PCFMessageAgent ? ![](images/smiles/innocent.gif) _________________ MQ & Broker admin |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Mangesh1187 |
Posted: Tue Dec 13, 2016 1:40 am Post subject: |
|
|
Centurion
Joined: 23 Mar 2013 Posts: 116
|
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
fjb_saper |
Posted: Tue Dec 13, 2016 5:56 am Post subject: |
|
|
![](images/avatars/gallery/misc/2.gif) Grand High Poobah
Joined: 18 Nov 2003 Posts: 20696 Location: LI,NY
|
You might also want to look at the different constructors for PCFMessage, and MQMessage... especially the initialize and write methods of the PCFMessage... ![](images/smiles/innocent.gif) _________________ MQ & Broker admin |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
Mangesh1187 |
Posted: Tue Dec 13, 2016 9:41 pm Post subject: |
|
|
Centurion
Joined: 23 Mar 2013 Posts: 116
|
fjb_saper wrote: |
You might also want to look at the different constructors for PCFMessage, and MQMessage... especially the initialize and write methods of the PCFMessage... ![](images/smiles/innocent.gif) |
Thanks fjb_saper.
Looks liike I have to do lots of R&D. ( I thought it would be a peace of cake , as it was looking prety straight )
If any one already able to use the PCF using a REPLY_TO _QUEUE set , (in JAVA) please share your thoughts .. |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
mqjeff |
Posted: Wed Dec 14, 2016 4:56 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
There is a PCFMessage constructor that accepts an MQMessage as the input parameter.
This might (I forget) allow you to build an MQMessage that has a static replytoq, create a PCFMessage from that, and then send it. _________________ chmod -R ugo-wx / |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
gbaddeley |
Posted: Thu Dec 15, 2016 3:16 pm Post subject: |
|
|
![](images/avatars/gallery/Star Wars/movie_star_wars_yoda.gif) Jedi
Joined: 25 Mar 2003 Posts: 2495 Location: Melbourne, Australia
|
Your original requirement was to build a utility to check queues. Was this going to be used the app support or operational teams or by the MQ administrator team?
I would be very concerned about giving an app team authority to the MQ command queue so that they could directly do PCF MQ administrative command messaging. The risk of abuse or unintentional damage to the queue manager is too great. _________________ Glenn |
|
Back to top |
|
![](templates/DAJ_Glass/images/spacer.gif) |
|