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 IBM MQ Support » [SOLVED] code change/triggertype from "every" - &q

Post new topic  Reply to topic
 [SOLVED] code change/triggertype from "every" - &q « View previous topic :: View next topic » 
Author Message
mca
PostPosted: Tue Apr 19, 2005 8:34 am    Post subject: [SOLVED] code change/triggertype from "every" - &q Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

MQGet Program(java):

String QM = "QM";
String QUEUE = "Q";

//code for connecting to the specified Queue and Queue Manager.

//call the message parser program and come back with the parsed values

//send the parsed values and Invoke application program and do the work

// ---->code to check if any more messages in Q.
YES --> Invoke MQGet again
NO --> OutQueue.close(); qmgr.disconnect() ;

This is what my MQGet program is doing where it is getting triggered everytime. But i wanna change my code in such a way that it uses trigger type "first" and after doing the work and before disconnecting, it must check for any more messages messages in Q and if any it must execute MQGet again recursively until the Q is empty.

Can anyone tell what is the inbuilt function that checks for any more XML messages in Q? and how to call the same program in which its executing now ...


Last edited by mca on Wed May 11, 2005 7:23 am; edited 1 time in total
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
jefflowrey
PostPosted: Tue Apr 19, 2005 8:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

You write a loop around the mq get call.

When mqget returns a reason code of MQRC_NO_MORE_MESSAGES... you end your program.

Have you considered reading the Application Programming Guide?
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vennela
PostPosted: Tue Apr 19, 2005 8:44 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Quote:
Can anyone tell what is the inbuilt function that checks for any more XML messages in Q?

The function is called for loop or while loop.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
mca
PostPosted: Tue Apr 19, 2005 8:52 am    Post subject: Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

Thanks jefflowrey and vennela for repling. What i mean by built-in function is some thing like:

if (built-in function to check for messges = TRUE) // if any message then return TRUE
CALL MQGet;
else
Disconnect Q;

and wait for trigger messge again.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
jefflowrey
PostPosted: Tue Apr 19, 2005 8:57 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

jefflowrey wrote:
Have you considered reading the Application Programming Guide?

_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
mca
PostPosted: Tue Apr 19, 2005 8:59 am    Post subject: Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

I am going through that jefflowrey. Thanks for the suggestion. It is of sure use for my question
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
vennela
PostPosted: Tue Apr 19, 2005 9:51 am    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

jefflowrey wrote:
You write a loop around the mq get call.

When mqget returns a reason code of MQRC_NO_MORE_MESSAGES... you end your program.


MCA:

In the while loop, keep getting messages until you get an exception like 2033 or MQRC_NO_MORE_MESSAGES and end the program when you get that error. That means, you have no more messages.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
EddieA
PostPosted: Tue Apr 19, 2005 10:18 am    Post subject: Reply with quote

Jedi

Joined: 28 Jun 2001
Posts: 2453
Location: Los Angeles

Quote:
keep getting messages until you get an exception like 2033 or MQRC_NO_MORE_MESSAGES and end the program when you get that error

I would suggest that you use a GET with WAIT for this. To avoid re-triggering the application if another message comes in seconds after you have processed the last one.

How long a wait will depend on the rate you expect messages to arrive. If they are very infrequent, then a short wait would be appropriate. However, if the messagers are more frequent, then a longer wait will avoid re-triggering the application too many times.

Cheers,
_________________
Eddie Atherton
IBM Certified Solution Developer - WebSphere Message Broker V6.1
IBM Certified Solution Developer - WebSphere Message Broker V7.0
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Apr 19, 2005 5:44 pm    Post subject: Reply with quote

Grand High Poobah

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

And anyways there should be no coding difference in the application for a trigger every or a trigger first. Read the books !!
Back to top
View user's profile Send private message Send e-mail
mca
PostPosted: Wed May 11, 2005 7:22 am    Post subject: Reply with quote

Disciple

Joined: 09 Mar 2005
Posts: 196

Thanks all for the replies.

What i meant by change code from "every" to "first" is keeping my MQGet program in loop until end of messages. If end of messages in Q, disconnect and wait for next "first" message. If i am using trigger type "first" i dont put my program in loop, but instead process the message and disconnect and wait for next "every" message. Now i am able to do this. by just adding one line before getting message:

Code:

while(true)
    MQGet
catch(error 2033-end of messages)
    disconnect Q


Even though this is easy, initially i wasnot sure how to do this. So, need to post. Now got clear idea of how this works. thanks all for the replies.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » [SOLVED] code change/triggertype from "every" - &q
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.