Author |
Message
|
mustang |
Posted: Tue Apr 18, 2006 1:09 pm Post subject: Running a message flow at night |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
We have WMB 6, and would like to run some message flows only at night (after business hours). Messages would queue up during the day, then run through the message flow at night. Is there a common process or best practice to implement something like this?
Thank you very much. |
|
Back to top |
|
 |
sirsi |
Posted: Tue Apr 18, 2006 2:27 pm Post subject: |
|
|
Disciple
Joined: 11 Mar 2005 Posts: 177
|
|
Back to top |
|
 |
mustang |
Posted: Wed Apr 19, 2006 6:00 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
Thanks!!!!!!! Sorry I didn't see this when I searched the forum. |
|
Back to top |
|
 |
wschutz |
Posted: Wed Apr 19, 2006 7:01 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
I'd be interested in knowing how you design this.
One possible pattern would be to use one of the patterns defined in the referenced paper to setup a TimeoutNotification node to run after business hours that then would use a MQGet node in a loop to process your messages. The loop would terminate when the MQGet node drives to the "No Message" terminal. _________________ -wayne |
|
Back to top |
|
 |
mustang |
Posted: Wed Apr 19, 2006 12:03 pm Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
That is exactly how I designed it. It is similar to scenarios 2 and 4 in the reference paper, but with an MQGet between the Make_MQ_Tree and the MQOutput. If it is working as intended, it would read a message off the MQGet queue and put it on the MQOutput queue, which would trigger a message flow that is not on a timer. This would loop until all the messages were read from the MQGet queue or OutputLocalEnvironment.TimeoutRequest.Action = 'CANCEL'
Unfortunately, I am running into some problems.
1) When a message is put on the MQGet queue, WMQ logs messages "The requested operation failed because the program could not find a definition of channel 'ABC'." and "Channel program 'ABC' ended abnormally." The messages are successfully written to the queue, however.
2) I am using Set OutputLocalEnvironment.TimeoutRequest.StartTime = 'NOW';
WMB errors out and logs "received a timeout request that did not contain a valid timeout start time. The request message was correctly navigated to the specified timeout request location, and this location contained a StartTime element, but the element did not have a valid value. The value contained was ''12:58:16.442''. Ensure the supplied timeout StartTime is not in the past. NOW is a valid value."
3) The messages on the MQGet queue are not removed. |
|
Back to top |
|
 |
wschutz |
Posted: Wed Apr 19, 2006 4:39 pm Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Quote: |
1) When a message is put on the MQGet queue, WMQ logs messages "The requested operation failed because the program could not find a definition of channel 'ABC'." and "Channel program 'ABC' ended abnormally." The messages are successfully written to the queue, however. |
How are you putting the message on the queue? It looks like you are using an MQ client program. Are you sure this message is related?
Quote: |
2) I am using Set OutputLocalEnvironment.TimeoutRequest.StartTime = 'NOW';
WMB errors out and logs "received a timeout request that did not contain a valid timeout start time. The request message was correctly navigated to the specified timeout request location, and this location contained a StartTime element, but the element did not have a valid value. The value contained was ''12:58:16.442''. Ensure the supplied timeout StartTime is not in the past. NOW is a valid value." |
Thats strange. Are you sure request Location on the TC node is set to LocalEnvironment.TimeoutRequest? It looks like you're picking up some other timeout request tree...
Quote: |
The messages on the MQGet queue are not removed. |
Which output terminal is being driven? Are you specifying any "Request" info on the request tab? _________________ -wayne |
|
Back to top |
|
 |
mustang |
Posted: Thu Apr 20, 2006 6:31 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
Quote: |
How are you putting the message on the queue? |
RFHUTIL
Quote: |
Are you sure this message is related? |
I am not sure what you mean by 'related'. The purpose of the timed message flow will be to move a message from one queue to another (which will trigger a message flow that is not on a timer). The content of the message is irrellevant. Maybe I do not have enough of an understanding of the MQGet node.
Quote: |
Are you sure request Location on the TC node is set to LocalEnvironment.TimeoutRequest? |
I leave it blank. According to the timeoutcontrol node documentation, this defaults to InputLocalEnvironment.TimeoutRequest. Also, in the compute node I set OutputLocalEnvironment.TimeoutRequest.Action = 'CANCEL' when I want to stop the flow. When I watch it in debug mode, the LocalEnvironment.TimeoutRequest.Action changes to 'SET' when the message leaves the compute node.
Quote: |
Which output terminal is being driven? |
Out
Quote: |
Are you specifying any "Request" info on the request tab? |
No.
I just noticed your name (wschultz) is the same as the author of the timer nodes design pattern reference paper. Great job! |
|
Back to top |
|
 |
mustang |
Posted: Mon Apr 24, 2006 6:52 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
I don't know why, but switching the request location to the body worked. I don't know why I could not get the control to work by passing it in the local environment. Here is the main function of the esql coming into the control, if you are interested.
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
Declare start character;
Declare settimer boolean;
Declare nexthour_c character;
Declare nexthour_i integer;
Set OutputRoot = InputRoot;
Set OutputRoot.MQMD.Format = 'MQHRF2 ';
Set OutputLocalEnvironment = InputLocalEnvironment;
Set start = BuildStartTime();
-- grab just the hour out of the current time ...
Set nexthour_c = cast(CURRENT_TIME as character format 'HH');
Set nexthour_i = cast(nexthour_c as integer);
-- set the timer for the next hour
Set nexthour_i = nexthour_i + 1;
Case nexthour_i
When 19 Then
-- If it is between 6PM and 7PM, start running the batch job.
Set OutputRoot.XML.TimeoutRequest.Identifier = 'CalendrNite';
Set OutputRoot.XML.TimeoutRequest.Action = 'SET';
Set OutputRoot.XML.TimeoutRequest.StartTime = start;
-- Run this batch job until the action is set to 'CANCEL'.
Set OutputRoot.XML.TimeoutRequest.Count = -1;
-- Send a message every second.
Set OutputRoot.XML.TimeoutRequest.Interval = 1;
Set OutputRoot.XML.TimeoutRequest.AllowOverwrite = TRUE;
Set settimer = TRUE;
When 7 Then
-- If it is between 6AM and 7AM, stop running the batch job.
Set OutputRoot.XML.TimeoutRequest.Identifier = 'CalendrNite';
Set OutputRoot.XML.TimeoutRequest.Action = 'CANCEL';
Set OutputRoot.XML.TimeoutRequest.AllowOverwrite = TRUE;
Set OutputRoot.XML.TimeoutRequest.StartTime = start;
Set settimer = TRUE;
Else
Set settimer = FALSE;
End Case;
Return settimer;
END; |
|
Back to top |
|
 |
wschutz |
Posted: Mon Apr 24, 2006 6:57 am Post subject: |
|
|
 Jedi Knight
Joined: 02 Jun 2005 Posts: 3316 Location: IBM (retired)
|
Sorry, I missed your append from last Thursday. Thanks for the update. Is everything working now the way you want it to? _________________ -wayne |
|
Back to top |
|
 |
mustang |
Posted: Mon Apr 24, 2006 9:12 am Post subject: |
|
|
Acolyte
Joined: 07 Feb 2006 Posts: 72
|
You are very welcome, and no need to apologize. Everything appears to be working the way we want it. Thank you very much for your assistance and the article on ibm.com. |
|
Back to top |
|
 |
|