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 » Design Issue - Using Timer Nodes to introduce delay

Post new topic  Reply to topic
 Design Issue - Using Timer Nodes to introduce delay « View previous topic :: View next topic » 
Author Message
satya2481
PostPosted: Thu Jul 02, 2009 8:19 pm    Post subject: Design Issue - Using Timer Nodes to introduce delay Reply with quote

Disciple

Joined: 26 Apr 2007
Posts: 170
Location: Bengaluru

Hi All,
We have a requirement of designing a WebService Retry Message Flow. This flow has to perform below actions.

1. Send the incoming WebService Request message to WebServer
2. Check the response from the WebService, if the response is Success then send the message to next node for further processing. Else send the request back to WebService after 10 Minutes of delay for 5 times.
3. Check the response and report error after 50 Minutes

We have designed a Subflow to introduce delay using the TimeOutControl and Notification nodes. The SubFlow looks like below.

Input --> Compute Node (To Read Delay value from UDP) --> Compute Node (To save the required tree details and construct the Timer Control message) --> TimeOutControl Node

TimeoutNotification Node --> Restore back the details --> Output

The Control message creation part looks like below

Code:
   CREATE PROCEDURE CreateTimerMessage() BEGIN
      DECLARE RetryDelay INTERVAL;
      DECLARE outTimeStamp TIMESTAMP;
      
      SET RetryDelay   = CAST(Environment.Variables.RetryDetails.RetryInterval AS INTERVAL SECOND);
      SET outTimeStamp = CURRENT_TIMESTAMP + RetryDelay;

      SET OutputLocalEnvironment.TimeoutRequest.Action         = 'SET';
      SET OutputLocalEnvironment.TimeoutRequest.Identifier     = UUIDASCHAR;
      SET OutputLocalEnvironment.TimeoutRequest.StartDate      = CAST(outTimeStamp AS DATE);
      SET OutputLocalEnvironment.TimeoutRequest.StartTime      = CAST(outTimeStamp AS TIME);
      SET OutputLocalEnvironment.TimeoutRequest.Interval       = 0;
      SET OutputLocalEnvironment.TimeoutRequest.Count          = 1;
      SET OutputLocalEnvironment.TimeoutRequest.IgnoreMissed   = FALSE;
      SET OutputLocalEnvironment.TimeoutRequest.AllowOverwrite = FALSE;
   END;



This subflow is been used to introduce required amount of delay for required number of times.

The requirement is like - If there are 10 messages in the Input queue then first message has to be read by the message flow and complete the retry mechanism (up to 50 Minutes) and then if the webservice response is not correct send it to Error queue. Pick the next message only after 50 Minutes (Or after sending the 1st message to error queue).

If I use the above subflow then I can see that all the 10 messages picked up by the flow and all gets processed simultaneously. I think the transaction between TimeOutControl and TimeoutNotification breaks hence the flow picks all the mesages.

Is it possible to achieve this requirement using Timer Nodes? If yes, how to resolve above issue?

Thanks for your reply.....
Satya
_________________
IBM Certified Solution Developer WebSphere Message Broker V6.0
IBM Certified System Administrator WebSphere MQ V6.0
Back to top
View user's profile Send private message Send e-mail
rekarm01
PostPosted: Fri Jul 03, 2009 1:37 pm    Post subject: Re: Design Issue - Using Timer Nodes to introduce delay Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

satya2481 wrote:
We have a requirement of designing a WebService Retry Message Flow. This flow has to perform below actions.
  1. Send the incoming WebService Request message to WebServer
  2. Check the response from the WebService, if the response is Success then send the message to next node for further processing. Else send the request back to WebService after 10 Minutes of delay for 5 times.
  3. Check the response and report error after 50 Minutes

Is that delay/retry logic just for responses, or does it also apply to errors and failures? Is it likely that the web service is going to return a different response for the same request 10 minutes later?

satya2481 wrote:
Pick the next message only after 50 Minutes (Or after sending the 1st message to error queue).

Someone else will surely be along shortly to discuss the perils of "message affinity".

satya2481 wrote:
I think the transaction between TimeOutControl and TimeoutNotification breaks hence the flow picks all the messages.

Transactions do not span across Timer nodes. The TimeoutControl node typically ends the current transaction. The TimeoutNotification node begins a separate transaction.

satya2481 wrote:
Is it possible to achieve this requirement using Timer Nodes? If yes, how to resolve above issue?

It may be possible, but not recommended, as delay/retry logic runs contrary to the broker design. One possible solution involves throwing an Exception to back out the current message, and using a second message flow, JavaCompute node, CMP, and Timer nodes to stop and start the first message flow, but that can get ... complicated.

A better approach might be to move the delay/retry logic to an external MQ application.
Back to top
View user's profile Send private message
Vitor
PostPosted: Sat Jul 04, 2009 1:12 am    Post subject: Re: Design Issue - Using Timer Nodes to introduce delay Reply with quote

Grand High Poobah

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

rekarm01 wrote:
satya2481 wrote:
Pick the next message only after 50 Minutes (Or after sending the 1st message to error queue).

Someone else will surely be along shortly to discuss the perils of "message affinity".


There are enough discussions in here already. Suffice it to say it's a bad idea because of the problems it causes.

rekarm01 wrote:
satya2481 wrote:
I think the transaction between TimeOutControl and TimeoutNotification breaks hence the flow picks all the messages.

Transactions do not span across Timer nodes. The TimeoutControl node typically ends the current transaction. The TimeoutNotification node begins a separate transaction.



_________________
Honesty is the best policy.
Insanity is the best defence.
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 » Design Issue - Using Timer Nodes to introduce delay
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.