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 Polling

Post new topic  Reply to topic
 MQ Polling « View previous topic :: View next topic » 
Author Message
MarkDev
PostPosted: Tue Jul 20, 2004 6:40 am    Post subject: MQ Polling Reply with quote

Newbie

Joined: 28 Jul 2003
Posts: 8

I am looking to write a program to poll a queue and process messages as they come in. Is there a standard way to do this? Any sample code out there? Any pitfalls to watch out for?

Thanks
Back to top
View user's profile Send private message Send e-mail
gunter
PostPosted: Tue Jul 20, 2004 7:19 am    Post subject: Reply with quote

Partisan

Joined: 21 Jan 2004
Posts: 307
Location: Germany, Frankfurt

There are many examples shipped with mq and in the repository on this site.
p.e. amqsget, amqsgetc, amqsbc, amqsbcg ( C )
You'll find also samples in C++, Java, Cobol, Perl...
_________________
Gunter Jeschawitz
IBM Certified System Administrator - Websphere MQ, 5.3
Back to top
View user's profile Send private message
kirani
PostPosted: Tue Jul 20, 2004 8:21 am    Post subject: Reply with quote

Jedi Knight

Joined: 05 Sep 2001
Posts: 3779
Location: Torrance, CA, USA

Don't forget to use MQGMO_WAIT option which is better than polling the queue constantly.
_________________
Kiran


IBM Cert. Solution Designer & System Administrator - WBIMB V5
IBM Cert. Solutions Expert - WMQI
IBM Cert. Specialist - WMQI, MQSeries
IBM Cert. Developer - MQSeries

Back to top
View user's profile Send private message Visit poster's website
bower5932
PostPosted: Tue Jul 20, 2004 10:04 am    Post subject: Reply with quote

Jedi Knight

Joined: 27 Aug 2001
Posts: 3023
Location: Dallas, TX, USA

And don't forget the fail if quiescing option either. You'd like to break-out of your get if the qmgr is coming down.
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger
kingsley
PostPosted: Tue Jul 20, 2004 10:32 am    Post subject: amqstrg0.c Reply with quote

Disciple

Joined: 30 Sep 2001
Posts: 175
Location: Hursley

go through the program amqstrg0.c that comes with standard mq installation.

It is a code for client trigger monitor.

You will come to know how to code for polling, other basics like fail if quiescing , using different os while polling & others.

Best of luck

kingsley.
Back to top
View user's profile Send private message Visit poster's website
zpat
PostPosted: Wed Jul 21, 2004 12:39 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

When I hear the words "MQ Polling" - I think Oh No - not again....

If you loop around in your application "polling" the queue - you will either have a high latency when messages arrive before they are processed (with a long wait) or a high MQI overhead (short waits).

As mentioned above - use the MQGMO WAIT option so that MQ "calls back" immediately on message arrival.

To retain some control in the application (eg for system closedown) make the wait a sensible value and repeat the request (eg a MQGMO WAIT interval of 60 seconds). If no message data then check for closedown and if not re-issue the MQGET and so on.
Back to top
View user's profile Send private message
techno
PostPosted: Tue Aug 31, 2004 9:45 pm    Post subject: Reply with quote

Chevalier

Joined: 22 Jan 2003
Posts: 429

Though I do not know exactly why it is needed, how about triggering being used in this context?
Back to top
View user's profile Send private message
zpat
PostPosted: Wed Sep 01, 2004 12:41 am    Post subject: Reply with quote

Jedi Council

Joined: 19 May 2001
Posts: 5866
Location: UK

Triggering is suitable when messages arrive relatively infrequently as the trigger monitor waits for you and dispatches your program on message arrival.

However it does cause extra MQ overhead (puts and gets on the init queue) and can also end up running more than one copy of the application if you are not careful.

I would say more than one message a second - don't trigger. Less than one message a minute, probably a good case for it. In between will depend on cirumstances, need more details.
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 Polling
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.