Author |
Message
|
ali |
Posted: Tue May 06, 2003 1:42 pm Post subject: MQGET/MQPUT Timeouts |
|
|
Newbie
Joined: 06 May 2003 Posts: 4
|
If I am issuing an MQGET or an MQPUT in a loop continously,
and a network error happens(e.g., cable unplugged), what
is default behavior with no error handling in the application?
Currently its hangs for long period of time. Is there a way to find
out right way with simple GET/PUT for any error conditions or do
I need to build application logic to handle that?
Thanks
Ali |
|
Back to top |
|
 |
kolthorr |
Posted: Tue May 06, 2003 5:06 pm Post subject: Timeouts |
|
|
Apprentice
Joined: 09 Mar 2002 Posts: 31
|
Hi Ali,
Specifying the MQGMO_WAIT option, and also setting the Get Message Options Timeout field will cause the call to fail once no messages are available for that amount of time. Some sample C code:
Code: |
MQGMO gmo = {MQGMO_DEFAULT}; /* get message options */
gmo.Options = MQGMO_WAIT /* wait for new messages */
+ MQGMO_ACCEPT_TRUNCATED_MSG /* remove long messages */
+ MQGMO_FAIL_IF_QUIESCING /* or until MQM stopping */
+ MQGMO_CONVERT; /* convert if necessary */
gmo.WaitInterval = 10000; /* 10 seconds, value is in ms */
|
Then use that 'gmo' variable in your MQGET call.
I suspect there is something similar for the MQPUT. Make sure you specify fail if quiescing for both.
If the network itself is disappearing you might receive a return code of 2009 (CONNECTION_BROKEN).
Hope this helps. Regards,
Andrew |
|
Back to top |
|
 |
Keka |
Posted: Tue May 06, 2003 8:18 pm Post subject: |
|
|
Voyager
Joined: 28 Dec 2002 Posts: 96
|
I am not sure if I got your question right.. But I think you are asking 2 things..
1. How long you should wait for the message in the queue while doing a get operation.. If so, Andrew's explanation answers that..
2. What happens if a put operation is done and a network failure happnes..
MQ hides the network from the application and even if the channel is down due to a network failure, your put operation will succeed.. There is no wait time while doing a put operation as it will always return with success as long as the Queue you are trying to put your message to. exists.. If the message is non-persistent and the network failure occurs (i.e channel goes down) during transit, you will lose the message. The only way to know if the message reached destination is not is to put a request messagte and wait for a reply or a report..
Hope this helps _________________ Keka |
|
Back to top |
|
 |
JohnMN |
Posted: Wed May 07, 2003 6:34 am Post subject: |
|
|
Novice
Joined: 26 Feb 2003 Posts: 19
|
Keka wrote: |
If the message is non-persistent and the network failure occurs (i.e channel goes down) during transit, you will lose the message. The only way to know if the message reached destination is not is to put a request messagte and wait for a reply or a report..
Hope this helps |
I disagree with this part of your answer.
The channel does not consider the message to be "delivered" until the receiving side has acknowledged that it has received the full message.
If a channel goes down, the message will remain on the trasmit queue until it can be retried.
Non-persistent messages will be removed from the transmit queue if the Queue Manager terminates.
John |
|
Back to top |
|
 |
Keka |
Posted: Wed May 07, 2003 7:06 am Post subject: |
|
|
Voyager
Joined: 28 Dec 2002 Posts: 96
|
Thanks for the correction.. You are right. _________________ Keka |
|
Back to top |
|
 |
ali |
Posted: Wed May 07, 2003 10:51 am Post subject: |
|
|
Newbie
Joined: 06 May 2003 Posts: 4
|
I'll clarify little bit.
MQPUT/GET are at application layers. OS is not giving notification that connection is broken. On TPF environment, OS gives no notification. On AIX, the notification comes after 5 minutes.
Timeout interval is only used for retrying. With a restraint that application is single threaded, how would you deal with this situation?
Thanks
Ali |
|
Back to top |
|
 |
RogerLacroix |
Posted: Wed May 07, 2003 9:29 pm Post subject: |
|
|
 Jedi Knight
Joined: 15 May 2001 Posts: 3264 Location: London, ON Canada
|
JohnMN, you are missing a piece to complete your answer.
If the Server Channel has the NPMSPEED(FAST) attribute set and the channel hiccups (for whatever reason) while transmitting a non-persistent message then that particular message can / will be thrown away (discarded).
later
Roger... _________________ Capitalware: Transforming tomorrow into today.
Connected to MQ!
Twitter |
|
Back to top |
|
 |
|