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 » Escape an unlimited Get

Post new topic  Reply to topic
 Escape an unlimited Get « View previous topic :: View next topic » 
Author Message
elvis_gn
PostPosted: Sat Jun 17, 2006 3:24 am    Post subject: Escape an unlimited Get Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi guys,

I have a java app which waits on a queue for unlimited time to fetch messages based on matching correlId...This is working perfectly.

Now, over this i need to implement a timeout set by user...I am currently taking this interval and running a scheduled TimerTask...using the scheduled task, I am closing the queue and the QM connections...Even this is working.

The problem is that the get does not fail....it still keeps waiting on the queue and even picks a message when i put it...it only fails the second time.

Can I stop the get while in use or will I have to look for roundabouts ?

Regards.
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sat Jun 17, 2006 5:11 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Yes, you can stop a Get with Unlimited Wait while it is in use.

You do this by putting a message on the queue that it will get.

If you want the Get to terminate on it's own, without a message, then don't use an unlimited wait.

You should know this stuff!
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Sat Jun 17, 2006 10:59 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi jefflowrey,

Just want to confirm that there is not simpler way out.

I did finally arrive at the two solutions that u suggested....also thought of something like making the get in a new thread and killing that on timeout....how does that sound ?

Or should i use the standard way of calulating the time left that i can wait on the queue...if i pick a message then calculate the time left for the second get...and so on...

Regards.
Back to top
View user's profile Send private message Send e-mail
jefflowrey
PostPosted: Sun Jun 18, 2006 6:18 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Killing the thread should work, but it's a bad idea. It will leave things in an undecided state, and may leave the connection hanging.

I don't understand what you mean by "calculating the time left that you can wait".

In a request/response scenario, where you need to ensure that a response comes within a certain timeframe, you end up using a combination of get-with-wait and expiry. You set the expiry on the request to a certain period of time, and then you immediately do a get-with-wait for that same period of time. Then if the request comes back, you know it, and if it doesn't come back, you know it and nothing is really left hanging around afterwards.

If you have some different kind of timeout, where several operations need to occur within a specific timeframe... then, yes, you'll need to coordinate those operations and keep track of elapsed time... but I can't see why you'd even be using unlimited wait time for that in the first place.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
LuisFer
PostPosted: Sun Jun 18, 2006 11:36 am    Post subject: Reply with quote

Partisan

Joined: 17 Aug 2002
Posts: 302

Putting the get disabled of the Q, an app in a MQGET with waitinterval -1 exit the API with 2016.
Regards
Back to top
View user's profile Send private message
kevinf2349
PostPosted: Sun Jun 18, 2006 12:01 pm    Post subject: Reply with quote

Grand Master

Joined: 28 Feb 2003
Posts: 1311
Location: USA

Luisfer

You are indeed correct but then something has to set the queue back to being get enabled.

Although given the awful design he is considering already he may just like this idea
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Sun Jun 18, 2006 4:25 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/topic/com.ibm.mq.csqzak.doc/csqzak10306.htm?resultof=%22%4d%51%46%42%5f%51%55%49%54%22%20

Quote:

Applications must test for the feedback code MQFB_QUIT in the Feedback field of the MsgDesc parameter, and end if they find this value. See MQMD - Feedback field for more information.


Any app that does Get with waits where the wait interval is significant should, MUST, follow the above rule if they are to be considered a properly designed MQ app.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
LuisFer
PostPosted: Sun Jun 18, 2006 5:18 pm    Post subject: Reply with quote

Partisan

Joined: 17 Aug 2002
Posts: 302

kevinf2349 wrote:
Luisfer

You are indeed correct but then something has to set the queue back to being get enabled.

Although given the awful design he is considering already he may just like this idea

My only intention is to help him.
Regards
Back to top
View user's profile Send private message
elvis_gn
PostPosted: Sun Jun 18, 2006 8:30 pm    Post subject: Reply with quote

Padawan

Joined: 08 Oct 2004
Posts: 1905
Location: Dubai

Hi guys,

[quote="LuisFer"]Putting the get disabled of the Q, an app in a MQGET with waitinterval -1 exit the API with 2016.
Regards
By disabled i guess u meant get inhibited....i tried that, but that only effects the second get that i try...the one is progress is not effected...


kevinf2349 wrote:
Although given the awful design he is considering already he may just like this idea

Hmm...ok i think i need to explain the scenario...I'm trying to develop a plugin node which would pick messages from a queue, similar to the MQGet node, ONLY that it would be capable of picking multiple messages, the number can be specified by the user, or the time to wait or even both together...

So now when i'm in the process of getting messages, incase the timeout occurs...what would be the best wy to close and leave...

And don't tell me that I should use aggregation ....this is a "learning in progress" so tell me a solution for this...

And jeff, by multiple gets i meant that i will go for the gets one by one, and wait for a time which will be the time specified by the user minus the time taken by previous gets...And i have implemented it, it seems to be working...

Regards.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ API Support » Escape an unlimited Get
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.