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 » MQ .NET - Disconnecting from a Queue Manager

Post new topic  Reply to topic
 MQ .NET - Disconnecting from a Queue Manager « View previous topic :: View next topic » 
Author Message
doug
PostPosted: Tue May 27, 2003 12:47 am    Post subject: MQ .NET - Disconnecting from a Queue Manager Reply with quote

Novice

Joined: 27 May 2003
Posts: 11

I'm a bit confused how to disconnect from a queue manager so that I can connect to another in a single threaded program. If I try:-

MQQueueManager mqMgr;
...
mqMgr = new MQQueueManager("OldMgr");
mqMgr.Connect("OldMgr");
mqMgr.Disconnect();
mqMgr.Connect("NewMgr");

... mqMgr.Name is still "OldMgr". OK...this figures - an MQQueueManager instance is associated with a given queue manager and this can't be changed. So now the problem is how to delete the instance.

mqMgr = new MQQueueManager("OldMgr");
mqMgr.Connect("OldMgr");
mqMgr.Disconnect();
mqMgr = null;
mqMgr = new MQQueueManager("NewMgr");
mqMgr.Connect("NewMgr");

Well this appears to work but it worries me as resources won't get freed until the GC gets round to it. Won't there be the possiblilty of getting an "Already connected" error here?

The Close() method is a bit of a tease and might be what I want, however:-

mqMgr = new MQQueueManager("OldMgr");
mqMgr.Connect("OldMgr");
mqMgr.Disconnect();
mqMgr.Close();
mqMgr = null;
mqMgr = new MQQueueManager("NewMgr");
mqMgr.Connect("NewMgr");

The Close always fails with MQRC_HCONN_ERROR. How am I supposed to use this (and what does it do?). What is the recommended way of closing a connection and opening a new one?

As an aside, is the Connect() method completely redundant? I (wrongly) made the assumption that if you didn't specify a queue manager name on the constructor then no connection is made until Connect(Name) was made. However you do this, you just end up with a connection to the default queue manager and Connect doesn't seem to do anything at all.

Thanks,
Doug
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 » MQ .NET - Disconnecting from a 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.