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 » Incrementing current time stamp within a compute node

Post new topic  Reply to topic
 Incrementing current time stamp within a compute node « View previous topic :: View next topic » 
Author Message
pratik_oze
PostPosted: Mon Dec 22, 2008 8:28 am    Post subject: Incrementing current time stamp within a compute node Reply with quote

Apprentice

Joined: 22 Jun 2004
Posts: 34

Hi,
I am trying to run a while loop for for few seconds. I was trying to calculate the time differnce between a time before it enters the while loop and the time after it enters the while loop. and was trying to increment the current_timestamp. But from the documentation i learnt that within a node the current_time stamp is always returned as the same value.
The code looks as below as if now which I know will not work

SET VersionNo = NULL;
SET LoopTime = 0 ;
SET StartTime = CURRENT_TIMESTAMP ;

X:WHILE VersionNo IS NULL AND LoopTime<=2 DO
SET VersionNo = THE (SELECT MAX (C.VERSION) FROM Database.TEST_DBA.VERSION_TABLE AS C
WHERE C.UNIQUE_ID = UniqueId);
IF VersionNo IS NOT NULL THEN
LEAVE X;
END IF;
SET CurrTime = CURRENT_TIMESTAMP ;
SET LoopTime = CAST((CurrTime - StartTime) SECOND AS INTEGER);
END WHILE;

Here in the loop the current time stamp is not going to change at all ( i have tested this) and hence the llop time is always =0. So in case where VersionNo is NULL this code goes into infinte loop.

Please suggest an alternative.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Dec 22, 2008 8:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You could get the timestamp from the database.

You could get the timestamp from a Java call.

Presumably you're trying to retry a few times until the database has been populated... There's a whole set of different ways to do this in Message Broker, including using backout/retry processing of the input message, Timeout* nodes, and other such things. Which is appropriate depends quite a bit on your business requirements.
Back to top
View user's profile Send private message
pratik_oze
PostPosted: Mon Dec 22, 2008 8:46 am    Post subject: Reply with quote

Apprentice

Joined: 22 Jun 2004
Posts: 34

Hi,

I cannot use the timestamp from database beacuse i am applying this logic to get rod of ORA01400 errors which are filling up the log space. Also I am not keen on using timeoutnotification node as this will held up the flow for that time.
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Dec 22, 2008 9:06 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You do not appear to have understood my suggestion about getting the timestamp from the database.

I did not say "use the timestamp as the VersionNo". I meant INSTEAD of using CURRENT_TIMESTAMP esql function, you could get the timestamp as part of your SELECT.

I do not say this is a good way to solve your problem, I do not say it is a bad way. It's merely a different way.

It's not clear why you are having to wait for the VERSION_TABLE to be populated with at least one value in the VERSION column for your unique id. Is it an entirely separate process that is filling in that table? How do you *know* that the row will be populated within the timeframe that your flow is allowed to run in?

More importantly, your loop will also "hold up the flow" for the time it takes for the loop to run, in exactly the same way that using Timeout nodes will "hold up" the flow for the time it takes to run. Either you need to wait for the row to be populated, or you don't. What mechanism you use to perform that wait shouldn't matter that much.
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 » Incrementing current time stamp within a compute node
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.