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 » Java with & without PCF

Post new topic  Reply to topic
 Java with & without PCF « View previous topic :: View next topic » 
Author Message
Mangesh1187
PostPosted: Fri Dec 09, 2016 9:23 pm    Post subject: Java with & without PCF Reply with quote

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 ?
Back to top
View user's profile Send private message
smdavies99
PostPosted: Sat Dec 10, 2016 12:02 am    Post subject: Re: Java with & without PCF Reply with quote

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
View user's profile Send private message
Mangesh1187
PostPosted: Sat Dec 10, 2016 7:47 am    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Sat Dec 10, 2016 9:00 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
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
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Mangesh1187
PostPosted: Sat Dec 10, 2016 9:08 am    Post subject: Reply with quote

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
View user's profile Send private message
Mangesh1187
PostPosted: Sat Dec 10, 2016 9:28 am    Post subject: Reply with quote

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
View user's profile Send private message
Mangesh1187
PostPosted: Sat Dec 10, 2016 8:59 pm    Post subject: Reply with quote

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
View user's profile Send private message
fjb_saper
PostPosted: Mon Dec 12, 2016 5:34 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
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 ?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Mangesh1187
PostPosted: Tue Dec 13, 2016 1:40 am    Post subject: Reply with quote

Centurion

Joined: 23 Mar 2013
Posts: 116

I have searched a lot for PCFMessage , PCFMessageAgent clasees but don't see any exact method to set the reply_to_queue.
https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.0.1/com.ibm.mq.javadoc.doc/WMQJavaClasses/com/ibm/mq/pcf/PCFMessageAgent.html
https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_7.0.1/com.ibm.mq.javadoc.doc/WMQJavaClasses/com/ibm/mq/pcf/PCFMessage.html

I can see there is a 'replyToQueueName; filed in MQMD class (and MQMessage is a subsclass of it). So I hope there is some place to set it in PCFMessage

I have then tried to add the MQCA_COMMAND_REPLY_Q_NAME to the PCF request message in the above code :

request.addParameter(CMQC.MQCA_Q_NAME,"TESTQ");
request.addParameter (CMQC.MQIA_Q_TYPE, MQC.MQQT_LOCAL);
request.addParameter(CMQC.MQCA_COMMAND_REPLY_Q_NAME ,"PCF.REPLY.QUEUE")

But my program ended with MQJE001: Completion Code '2', Reason '3015'. MQRCCF_CFST_PARM_ID_ERROR

Then I have tried to use ,
request.addParameter(CMQCFC.MQCACF_REPLY_TO_Q ,"PCF.REPLY.QUEUE") , but still the same issue.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Dec 13, 2016 5:56 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20695
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...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Mangesh1187
PostPosted: Tue Dec 13, 2016 9:41 pm    Post subject: Reply with quote

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...


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
View user's profile Send private message
mqjeff
PostPosted: Wed Dec 14, 2016 4:56 am    Post subject: Reply with quote

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
View user's profile Send private message
gbaddeley
PostPosted: Thu Dec 15, 2016 3:16 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2491
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
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 » Java with & without PCF
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.