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 API Support » Using C# to determine Q depth.

Post new topic  Reply to topic
 Using C# to determine Q depth. « View previous topic :: View next topic » 
Author Message
sadamahan
PostPosted: Sun Jul 21, 2002 4:09 pm    Post subject: Using C# to determine Q depth. Reply with quote

Newbie

Joined: 23 May 2002
Posts: 6
Location: Simi Valley,CA

Hi,

Here is a very simple application that uses COM Interop in C# to generate wrapper classes to MQAI.dll and MQAX.dll to make them available to my C# program. I want to know why I get the "System.NullReferenceException" every time at the indicated line.

1. Created a new C# console application.
2. Used COM interop to generate wrapper classes for MQAI.dll and MQAX.dll as detailed in
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconimportingtypelibraryasassembly.asp

3. Here is the sample code:

MQSession Session;
MQQueueManager QueueManager;
MQBag adminBag;
MQBag responseBag;
MQBag qAttrsBag;
MQBag errorBag;

//connect
Session = new MQSession();
QueueManager = (MQQueueManager)Session.AccessQueueManager("CRNQ");
if (!QueueManager.IsOpen) return;

//Create an admin bag for the mqExecute call
adminBag = new MQBag();
adminBag.Options = (int)MQ.MQCBO_ADMIN_BAG;

//Create a response bag for the mqExecute call
responseBag = new MQBag();
responseBag.Options = (int)MQ.MQCBO_ADMIN_BAG;

//Put the generic queue name into the admin bag
adminBag.Add("*", MQ.MQCA_Q_NAME);

//Put the local queue type into the admin bag
adminBag.Add(MQ.MQQT_LOCAL, MQ.MQIA_Q_TYPE);

//Add an inquiry for current queue depths
adminBag.AddInquiry((int)MQ.MQIA_CURRENT_Q_DEPTH);

responseBag = (MQBag)adminBag.Execute(QueueManager, (int)MQ.MQCMD_INQUIRE_Q, MQ.MQHB_NONE, MQ.MQHO_NONE , MQ.MQHO_NONE);
<-- System.NullReferenceException

I find that I have sent in all the parameters (non null). Is there anything that I am missing here?

Thanks

Sada
Back to top
View user's profile Send private message Send e-mail
kolban
PostPosted: Mon Jul 22, 2002 3:34 am    Post subject: Reply with quote

Grand Master

Joined: 22 May 2001
Posts: 1072
Location: Fort Worth, TX, USA

When I get a chance, I will be posting a refresh of my MQSeries.NET package (see http://www.mqseries.net/phpBB/viewtopic.php?t=3981)

This has qdepth inquiry capabilities built in.[/url]
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 API Support » Using C# to determine Q depth.
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.