|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
Using C# to determine Q depth. |
« View previous topic :: View next topic » |
Author |
Message
|
sadamahan |
Posted: Sun Jul 21, 2002 4:09 pm Post subject: Using C# to determine Q depth. |
|
|
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 |
|
 |
kolban |
Posted: Mon Jul 22, 2002 3:34 am Post subject: |
|
|
 Grand Master
Joined: 22 May 2001 Posts: 1072 Location: Fort Worth, TX, USA
|
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|