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 Discussion » How long connection will be active

Post new topic  Reply to topic Goto page 1, 2  Next
 How long connection will be active « View previous topic :: View next topic » 
Author Message
umaphani
PostPosted: Tue Jan 22, 2008 3:28 am    Post subject: How long connection will be active Reply with quote

Newbie

Joined: 18 Jan 2008
Posts: 4

How much time the connection will be active if the MQ Queue was not closed programmatically?
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jan 22, 2008 3:31 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

AFAIK until the queue manager is restarted. I'm not certain you can set a disconnect interval on a client channel.

And connections are to the queue manager, not to the queue.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
umaphani
PostPosted: Tue Jan 22, 2008 3:53 am    Post subject: Reply with quote

Newbie

Joined: 18 Jan 2008
Posts: 4

i have written a sample code like this
Code:

int openOptions = MQC.MQOO_OUTPUT;
         Hashtable env = new Hashtable();
         env.put(MQC.HOST_NAME_PROPERTY, "localHost");
         env.put(MQC.PORT_PROPERTY, new Integer(1414));
         env.put(MQC.CHANNEL_PROPERTY, "testChannel");
          qMgr = new MQQueueManager("test", env);

MQQueueManager qMgr  = null;
MQQueue q1  =null;

 qMgr = new MQQueueManager("test", env);


q1 = qMgr.accessQueue("testQueue", openOptions,               null, null, null);



after this i am posting message to queue.
but not calling the qmgr.disconnect() method.

since i am not calling qmgr.disconnect(), does this connection will be unavailable for next message or after some time the qmgr will automatically gets disconnected. if so after how much time, it will be available
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jan 22, 2008 3:57 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

umaphani wrote:
since i am not calling qmgr.disconnect(), does this connection will be unavailable for next message or after some time the qmgr will automatically gets disconnected. if so after how much time, it will be available


I stand by my previous post until someone corrects me. AFAIK you can't set a disconnect interval on a client channel.

I think an important question is why are you not calling qmgr.disconnect()?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jan 22, 2008 3:58 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

It will be available until the time when you try to use it and it throws an exception that tells you it's not available, or when you call disconnect.

There are timeouts that can be configured on client channels, at the MQ server side or in the network layer (this one is usually frowned on). HeartBeat intervals, Disconnect Intervals, etc.

But generally speaking, it's not your program's concern about that. Assume the connection is open until you decide to close it or it throws an exception that says it's been closed. Then either quit or reconnect, based on what you need to do.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Jan 22, 2008 4:09 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

jefflowrey wrote:
But generally speaking, it's not your program's concern about that. Assume the connection is open until you decide to close it or it throws an exception that says it's been closed. Then either quit or reconnect, based on what you need to do.


I'd still say it's better to disconnect at the end of the application and explicitly free up the connection than wait for it to time out.

But if you've opened a connection and you're getting/putting as part of your process I agree with my most learned associate that you should assume it's open until you actually close it or get an exception indicating it's been closed.

Experience indicates you're likely to get a 2009 or 2019 long before any timeout interval expires...
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Tue Jan 22, 2008 4:35 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Vitor wrote:
jefflowrey wrote:
But generally speaking, it's not your program's concern about that. Assume the connection is open until you decide to close it or it throws an exception that says it's been closed. Then either quit or reconnect, based on what you need to do.


I'd still say it's better to disconnect at the end of the application and explicitly free up the connection than wait for it to time out.


It's not only better, it's the Right Thing to do. Wearing my MQ admin hat, failing to disconnect is #1 on the Trout List for app developers.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Jan 22, 2008 4:46 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

MQ V6 has a client channel inactive disconnect interval.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Jan 22, 2008 5:06 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

I'd even go as far as to try a disconnect on a qmgr connection that throws an exception (i.e.) tcp has cut the connection but it is still open on the qmgr...
This on the odd chance that you can close the connection on the qmgr.

_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
PeterPotkay
PostPosted: Tue Jan 22, 2008 1:31 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

zpat wrote:
MQ V6 has a client channel inactive disconnect interval.


The KAINT parm?
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Tue Jan 22, 2008 1:33 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Vitor wrote:
AFAIK you can't set a disconnect interval on a client channel.

The ClientIdle environmental variable will accomplish this. Distributed platforms only though. And all SVRCONNs on that server get the same value whether you like it or not.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Nigelg
PostPosted: Tue Jan 22, 2008 11:15 pm    Post subject: Reply with quote

Grand Master

Joined: 02 Aug 2004
Posts: 1046

ClientIdle is a qm.ini parameter in the Channels stanza, not an env var.
If you use CientIdle be aware that is not an officially supported parameter.
_________________
MQSeries.net helps those who help themselves..
Back to top
View user's profile Send private message
JLRowe
PostPosted: Wed Jan 23, 2008 2:58 am    Post subject: Reply with quote

Yatiri

Joined: 25 May 2002
Posts: 664
Location: South East London

umaphani wrote:
i have written a sample code like this
Code:

int openOptions = MQC.MQOO_OUTPUT;
         Hashtable env = new Hashtable();
         env.put(MQC.HOST_NAME_PROPERTY, "localHost");
         env.put(MQC.PORT_PROPERTY, new Integer(1414));
         env.put(MQC.CHANNEL_PROPERTY, "testChannel");
          qMgr = new MQQueueManager("test", env);

MQQueueManager qMgr  = null;
MQQueue q1  =null;

 qMgr = new MQQueueManager("test", env);


q1 = qMgr.accessQueue("testQueue", openOptions,               null, null, null);



after this i am posting message to queue.
but not calling the qmgr.disconnect() method.

since i am not calling qmgr.disconnect(), does this connection will be unavailable for next message or after some time the qmgr will automatically gets disconnected. if so after how much time, it will be available


From a java perspective:

The QueueManager class has a finalize() method that closes itself down, this will be called by the garbage collector after the object goes out of scope, but before it is garbage collected.

It is however bad practice to rely on finalization.
Back to top
View user's profile Send private message Send e-mail
PeterPotkay
PostPosted: Wed Jan 23, 2008 8:59 am    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

Nigelg wrote:
ClientIdle is a qm.ini parameter in the Channels stanza, not an env var.


Oh yeah.

So it effects all the SVRCONN channels on a Queue Manager equally. Other QMs that might be on the same server would not be effected.

Personally I would not use it. Its not official like Nigel said (although a lot of official features nowadays probably started out like that). More importantly you don't get a "ClientIdle" specific reason code when your connection is dropped.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
MucheIsMyHero
PostPosted: Wed Jan 23, 2008 11:56 am    Post subject: Reply with quote

Novice

Joined: 29 Jun 2005
Posts: 14

jefflowrey wrote:


It's not only better, it's the Right Thing to do. Wearing my MQ admin hat, failing to disconnect is #1 on the Trout List for app developers.


THANK YOU.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » General Discussion » How long connection will be active
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.