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 IBM MQ Support » Using PCF and .Net to query queue manager

Post new topic  Reply to topic
 Using PCF and .Net to query queue manager « View previous topic :: View next topic » 
Author Message
wes212
PostPosted: Wed Aug 26, 2020 2:08 am    Post subject: Using PCF and .Net to query queue manager Reply with quote

Newbie

Joined: 26 Aug 2020
Posts: 4

Hi,

I am fairly new to using queues. I am currently working on a .Net solution that should allow me to query the queues mangers and queues. However, I am running into issues about what I believe should be a straight forward solution and I would appreciate any help.

Below is a snippet of my failing code

Code:
PCFMessageAgent messageAgent = messageAgent = new PCFMessageAgent(queueManager);
PCFMessage reqeuestMessage = new PCFMessage(MQC.MQCMD_INQUIRE_SUBSCRIPTION);
reqeuestMessage.AddParameter(MQC.MQCACF_SUB_NAME, "*");
PCFMessage[] pcfResponse = messageAgent.Send(reqeuestMessage);


An "Unknown Type" exception is thrown on the last line. I am not sure what I am doing wrong here.

Furthermore, I am able to retrieve the queue names from the code below and this works, which makes it further confusing.

Code:
PCFMessageAgent messageAgent = messageAgent = new PCFMessageAgent(queueManager);
PCFMessage reqeuestMessage = new PCFMessage(MQC.MQCMD_INQUIRE_Q);
reqeuestMessage.AddParameter(MQC.MQCA_Q_NAME, "*");
PCFMessage[] pcfResponse = messageAgent.Send(reqeuestMessage);


I would appreciate any help ASAP. Thanks in advance.
Back to top
View user's profile Send private message
hughson
PostPosted: Wed Aug 26, 2020 12:39 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

I believe the first problem is that the answer to Inquire Sub returns some data (the Sub Id) in MQCFBS (byte string) type, and the unsupported .Net PCF classes do not know how to handle that type. Nothing you can do there but lobby IBM to support (and then fix) the .Net PCF classes. There is an RFE you should search for and vote on.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
wes212
PostPosted: Wed Aug 26, 2020 12:55 pm    Post subject: Reply with quote

Newbie

Joined: 26 Aug 2020
Posts: 4

Thank you for your reply. So if I understand what you are saying, there is currently no way to get subscription information using C#?

Just to be explicit in what I am trying to do, using C# - given a topic name, I want to see all the subscription information that topic is subscribed to.

Thanks in advance
Back to top
View user's profile Send private message
gbaddeley
PostPosted: Wed Aug 26, 2020 5:06 pm    Post subject: Reply with quote

Jedi

Joined: 25 Mar 2003
Posts: 2492
Location: Melbourne, Australia

wes212 wrote:
Thank you for your reply. So if I understand what you are saying, there is currently no way to get subscription information using C#?

Just to be explicit in what I am trying to do, using C# - given a topic name, I want to see all the subscription information that topic is subscribed to.

Thanks in advance

You could try sending a PCF Escape command "DISPLAY SUB(...." and process the PCF structures and various types of parameters in the response, but that is a lot more coding. eg. in VB.Net
Code:

    ' Build a PCF structure for an "Escape MQSC command" request
    Dim MyPcfRequest As PCFMessage = New PCFMessage(CMQCFC.MQCMD_ESCAPE)
    MyPcfRequest.AddParameter(CMQCFC.MQIACF_ESCAPE_TYPE, CMQCFC.MQET_MQSC)
    MyPcfRequest.AddParameter(CMQCFC.MQCACF_ESCAPE_TEXT, "DISPLAY ......")  ' A single command in MQSC syntax

    ' Send request to PCF Agent, responds with array of PCF structures
    Dim MyPcfResponses() As PCFMessage = MyPcfAgent.Send(MyPcfRequest)

    Dim MyParams() As PCFParameter
    For RespIdx = 0 To MyPcfResponses.Length - 1
     With MyPcfResponses(RespIdx)
      MyParams = .GetParameters
      ' Process the parameter array in a PCF structure
      For ParamIdx = 0 To .GetParameterCount - 1
        PValue = MyParams(ParamIdx).GetValue
        PType = MyParams(ParamIdx).Type
        Select Case PType
          Case CMQCFC.MQCFT_STRING
            .......
          Case CMQCFC.MQCFT_INTEGER
           ..........
        End Select
      Next
     End With
    Next

_________________
Glenn
Back to top
View user's profile Send private message
wes212
PostPosted: Wed Aug 26, 2020 5:22 pm    Post subject: Reply with quote

Newbie

Joined: 26 Aug 2020
Posts: 4

Thanks Glen for your reply.

I am having a hard time following explanation. I am not great at using VB.Net (I am more of a C# person) but I can follow. However when you say command "DISPLAY SUB(..", I dont see that in your sample code.

I am pretty new to this, so I am just not understanding how I would be able to use a topic and get the subscription information based on what you have here.

Thanks again
Back to top
View user's profile Send private message
hughson
PostPosted: Wed Aug 26, 2020 8:31 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

wes212 wrote:
However when you say command "DISPLAY SUB(..", I dont see that in your sample code.


Look for the DISPLAY ...

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
markt
PostPosted: Thu Aug 27, 2020 12:56 am    Post subject: Reply with quote

Knight

Joined: 14 May 2002
Posts: 502

And if the queue managers have been configured for it, you can always use REST admin calls instead.
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Aug 27, 2020 1:42 am    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

wes212 wrote:
I am pretty new to this, so I am just not understanding how I would be able to use a topic and get the subscription information based on what you have here.

In case it's not clear, what is being suggested in the MQSC case is that instead of a PCF command, you formulate an MQSC command to get the information you want.

You can practice getting the correct command using the runmqsc tool first, and once you have what you need, put it into your "Escape PCF" command as the example code from Glenn shows.

The simplest would be:

Code:
DISPLAY SUB(*) ALL


but you might want to change the ALL keyword and instead just list the keywords you want back. Have a play with runmqsc and come back to us if you don't understand how to use the MQSC command.

Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
wes212
PostPosted: Thu Aug 27, 2020 4:11 pm    Post subject: Reply with quote

Newbie

Joined: 26 Aug 2020
Posts: 4

I really appreciate your help and I figured it out a bit.

So what I have is

Code:
                PCFMessage reqeuestMessage = new PCFMessage(MQC.MQCMD_ESCAPE);
                reqeuestMessage.AddParameter(MQC.MQIACF_ESCAPE_TYPE, CMQCFC.MQET_MQSC);
                reqeuestMessage.AddParameter(MQC.MQCACF_ESCAPE_TEXT, "DISPLAY SUB(*) SUBID, TOPICSTR");


However this returns all the subscriptions. My question is how now do I filter it by topic. So what I mean is how can I give a Topic string and return all only subscriptions associated with that topic string.

Thanks in advance.
Back to top
View user's profile Send private message
hughson
PostPosted: Thu Aug 27, 2020 7:54 pm    Post subject: Reply with quote

Padawan

Joined: 09 May 2013
Posts: 1914
Location: Bay of Plenty, New Zealand

wes212 wrote:
My question is how now do I filter it by topic. So what I mean is how can I give a Topic string and return all only subscriptions associated with that topic string.


Again, play around with runmqsc to figure out exactly the command you want, but I imagine you are looking for something like this:

Code:
DISPLAY SUB(*) WHERE(TOPICSTR EQ 'xx/yy/zz') SUBID TOPICSTR


Cheers,
Morag
_________________
Morag Hughson @MoragHughson
IBM MQ Technical Education Specialist
Get your IBM MQ training here!
MQGem Software
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Using PCF and .Net to query queue manager
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.