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 » WebSphere Message Broker (ACE) Support » Sleep when Queue have message

Post new topic  Reply to topic
 Sleep when Queue have message « View previous topic :: View next topic » 
Author Message
arunkumar1989
PostPosted: Mon Apr 27, 2015 2:53 am    Post subject: Sleep when Queue have message Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

Hi All,


I wants to check whether the queue have message with similar message

which i`m processing. if the message i wants to sleep for a while.


Could any one help me on this.


Thanks,
Arun
_________________
Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd.
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Mon Apr 27, 2015 4:46 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

MQ does not let you search a queue based on the contents of messages.

If you want your program to perform a given action on receiving a given action, then you should write your code to identify whether the current message is the right message to perform that action.
Back to top
View user's profile Send private message
arunkumar1989
PostPosted: Mon Apr 27, 2015 11:59 pm    Post subject: Reply with quote

Voyager

Joined: 21 Nov 2012
Posts: 98
Location: Chennai

Not content based ... need to search by message id. If it has same message id should be sleep for some time. If does not have message id it will process continuously.
_________________
Being in a crowd when you are alone is ignorance. Enlightenment is being alone in a crowd; a feeling of oneness in a crowd.
Back to top
View user's profile Send private message Send e-mail
iibmate
PostPosted: Tue Apr 28, 2015 12:46 am    Post subject: Reply with quote

Apprentice

Joined: 17 Mar 2015
Posts: 38
Location: Perth, WA

arunkumar1989 wrote:
need to search by message id. If it has same message id should be sleep for some time. If does not have message id it will process continuously.


Below answer matches your query.

mqjeff wrote:
If you want your program to perform a given action on receiving a given action, then you should write your code to identify whether the current message is the right message to perform that action.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Tue Apr 28, 2015 5:07 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

If you simply want to WAIT until a message with a specific message id is on the queue, then you should use an MQGet node that is set to match the message ID.

This is basic MQ programming and basic IIB flow development.
Back to top
View user's profile Send private message
zpat
PostPosted: Tue Apr 28, 2015 6:22 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

MQ is fundamentally event driven.

You should unconditionally process messages as they arrive on the queue in most cases (especially in WMB or IIB flows).

Unless you have just sent a request and want to see the reply to it (on a non-dedicated queue).

MQ can only wait on content for you when the selection is by msgid or correlid matching.

Otherwise you are looking at polling and browsing the queue (or using JMS selectors). None of which are particularly efficient but if used carefully can be OK - don't poll too frequently though.

WMB/IIB does not have a browse queue input node. It might be possible to use the JMS input node with a selector (I've never tried).

The MQGET node cannot be used to start a message flow.

It sounds like your requirements are wrong - or your approach to meeting them is fundamentally wrong.

Consider processing all messages in a flow and storing them into a database table.

Then you might use a database trigger or something like that.
_________________
Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 28, 2015 10:25 am    Post subject: Reply with quote

Grand High Poobah

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

arunkumar1989 wrote:
Not content based ... need to search by message id. If it has same message id should be sleep for some time. If does not have message id it will process continuously.


This sounds a lot like the messages have an id with some business meaning, i.e. if you have a message with an id "IBMSharePrice" n seconds after the last message with "IBMSharePrice" you sleep (and what I wonder happens to that message?) but if it has "MicrosoftSharePrice" you process it.

This is a very bad design choice.

You should read all the messages as they arrive, put this kind of content in the payload and then evaluate if you want to process it or ignore it. As other posters have correctly pointed out.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
smdavies99
PostPosted: Tue Apr 28, 2015 10:59 am    Post subject: Reply with quote

Jedi Council

Joined: 10 Feb 2003
Posts: 6076
Location: Somewhere over the Rainbow this side of Never-never land.

Vitor wrote:


This sounds a lot like the messages have an id with some business meaning, i.e. if you have a message with an id "IBMSharePrice" n seconds after the last message with "IBMSharePrice" you sleep (and what I wonder happens to that message?) but if it has "MicrosoftSharePrice" you process it.


Sound like an excellent Pub/Sub solution to me....
_________________
WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995

Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Apr 28, 2015 11:14 am    Post subject: Reply with quote

Grand High Poobah

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

smdavies99 wrote:
Vitor wrote:


This sounds a lot like the messages have an id with some business meaning, i.e. if you have a message with an id "IBMSharePrice" n seconds after the last message with "IBMSharePrice" you sleep (and what I wonder happens to that message?) but if it has "MicrosoftSharePrice" you process it.


Sound like an excellent Pub/Sub solution to me....




But didn't want to muddy the waters by suggesting it.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
iibmate
PostPosted: Tue Apr 28, 2015 7:18 pm    Post subject: Reply with quote

Apprentice

Joined: 17 Mar 2015
Posts: 38
Location: Perth, WA

How about this ......

(1) Browse message from queue using MQInput node
(2) Check if message id equal to message id in context queue using MQGet node
(3) If matches, browse from context queue , send to out and in compute node, sleep and no message processing
(4) If no matching, then process message


Environment should be IIB v9 / IIB v10 and MQ v 7.5 / 8.0.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Wed Apr 29, 2015 4:28 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

iibmate wrote:
How about this ......

(1) Browse message from queue using MQInput node
(2) Check if message id equal to message id in context queue using MQGet node
(3) If matches, browse from context queue , send to out and in compute node, sleep and no message processing
(4) If no matching, then process message


Make sure to deploy one message flow instance for each expected sleep.

Or accept that the sleep in one instance of a message flow can interrupt the processing of other messages.

Or send the matching message to a timeout control node...
http://www.ibm.com/developerworks/websphere/library/techarticles/0603_schutz/0603_schutz.html
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 » WebSphere Message Broker (ACE) Support » Sleep when Queue have message
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.