|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
.NET API Question - MQQueueManager.Name property is blank. |
« View previous topic :: View next topic » |
Author |
Message
|
J.Davis |
Posted: Thu Jun 10, 2010 1:00 pm Post subject: .NET API Question - MQQueueManager.Name property is blank. |
|
|
Newbie
Joined: 10 Jun 2010 Posts: 1
|
Good afternoon all,
I am in the process of debugging web service that uses the MQ.NET API. I am doing this with WinDbg since our application is in production; we can't recreate the problem on a test system so no attaching a debugger. I do know what is happening but I do not know completely why; the issue is with the Name property value returned from the MQQueueManager.
Here is the setup, we have a central inhouse library(wrapper) that "simplifies" the use of MQ; this wrapper is being called by a webservice. Our webservice processes thousands of messages per day, per web server.
What the library will do is open a new connection to MQ and hold it in a shared collection, that way we're not opening up 100s of connections an hour. The shared collection is properly syncronized using try/finally with Monitor.Enter/Exit. We do not share connections for transactions, they are a one to one queue manager.
When the new instance of our library is called it creates a QueueManager with a name. It will then add this to a collection with the same name. If another thread comes alive before the service is recycled it will check that collection and attempt to reuse the MQQueueManager object.
Code: |
// Our psuedo code to create and add the mq object
string someName = "SomeName";
IBM.WMQ.MQQueueManager ourQueue = IBM.WMQ.MQQueueManager(someName);
VisualBasic.Collection vbCol = new VisualBasic.Collection();
vbCol.Add(ourQueue, someName);
// Our psuedo code to check the collection
// Be aware that VisualBasic.Collection starts at index 1 not 0
int index = 1;
Monitor.Enter(vbCol);
while (vbCol.Count <= index)
{
IBM.WMQ.MQQueueManager oMgr = vbCol(index);
if oMgr.Name.Equals(someName)
{
// set the return connection to reuse
}
}
Monitor.Exit(vbCol);
// further down the code we handle any exceptions
// After this check the code will check the IsConnected property with the
// returned manager, then it will Put() the message. |
Now that we all know what my code is doing, I can only speculate as to why MQ returns a blank Name property. I have a feeling its because the MQQueueManager object is never explicity locked itself. It should be noted that this application was written long before I came along, and was VB6 code converted to VB.NET and eventually into C#.
If anyone has any insight as to why this occurs I would be very appreciative.
James |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 10, 2010 1:56 pm Post subject: Re: .NET API Question - MQQueueManager.Name property is blan |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
J.Davis wrote: |
If anyone has any insight as to why this occurs I would be very appreciative. |
What version(s) of WMQ are in use here? Has any recent maintenance been applied? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
fatherjack |
Posted: Thu Jun 10, 2010 3:33 pm Post subject: Re: .NET API Question - MQQueueManager.Name property is blan |
|
|
 Knight
Joined: 14 Apr 2010 Posts: 522 Location: Craggy Island
|
A good job you added
J.Davis wrote: |
It should be noted that this application was written long before I came along, and was VB6 code converted to VB.NET and eventually into C#. |
Because I'd have to question the wisdom of
J.Davis wrote: |
a central inhouse library(wrapper) that "simplifies" the use of MQ |
Particularly one that doesn't work and one you can't easily figure out why it doesn't work. Strange concept of 'simplification'.  _________________ Never let the facts get in the way of a good theory. |
|
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
|
|
|
|