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 » C# and MQQueueManager instances

Post new topic  Reply to topic
 C# and MQQueueManager instances « View previous topic :: View next topic » 
Author Message
joehuber
PostPosted: Fri Oct 22, 2004 5:40 am    Post subject: C# and MQQueueManager instances Reply with quote

Newbie

Joined: 08 Oct 2004
Posts: 7

Hello,

I am using the IBM provided MQ .NET classes to access a z/OS queue server from a windows XP machine. I use multiple instances of the MQQueueManager class at a time but I have discovered that disconnecting from one causes all the other manager instances to become invalid with 2018 Connection Handle Not Valid.

Here is how my app works. I create an instance of MQQueueManger and read a message from a queue. I then send that message to a thread to be processed. When the thread is complete it commits the manager and disconnects. While it is processing other instances of MQQueueManager are created and used to read additional messages from the same queue. The first thread does a commit without problem then disconnects. However, the second queue fails when it tries to commit (with error 2018).

It appears that disconnection one manager causes the connection to be broken for all existing managers. Is this how it is supposed to work or do I have some kind of configuration/setup problem?

Also, I could change the program to create only one MQQueueManager instance and use it across all threads. In that case, I could commit at the end of each thread but I would never disconnect. My application is a service so it could run indefinitely. Do you see a problem with keeping the manager connected over long periods of time?

Thanks,

Joe Huber
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 22, 2004 6:05 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Create each instance inside your "processing" thread.

But it is a much better idea to connect once, do lots of work, and then disconnect, than it is to connect and disconnect many times.

So, yeah, share the connection.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
joehuber
PostPosted: Fri Oct 22, 2004 6:26 am    Post subject: Another question Reply with quote

Newbie

Joined: 08 Oct 2004
Posts: 7

Thanks Jeff.

I have found another problem. I tried using just one QueueManager that was shared by all threads. It worked fine when I was accessing only one queue. However, when I expanded my app to reading from 3 different queues I again got the 2018 error whenever I tried to read from the 2nd or 3rd queue (the first queue worked throughout the test). Is there some connection between a QueueManager and a queue? I assumed a manager could be used to read many queues.

Also, do you see any potential issues with keeping the manager connected for long periods of time such as days or weeks?
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Fri Oct 22, 2004 6:46 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You'll want to make sure your connection will FAIL_IF_QUIESCING, so you can shut down your queue manager.

Otherwise, it's not a big deal to leave it open. Trigger Monitors do it all the time!

You might be running into issues where you have not opened the handle to allow for sharing. That's a usual cause of 2018s when working with threads.
_________________
I am *not* the model of the modern major general.
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 » General IBM MQ Support » C# and MQQueueManager instances
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.