Hmm, I have a couple of thoughts on how this could be supported.
My current thinking is do the following.
1. Add a Retry GuardResult which will include the time to retry
2. Add support for Retry in Rubric (which already has some date support)
3. Add a built in predicate for isFirstGuardEval. Other predicates could use guardEvalCount.
4. Add an interface for a timer service, so users can plug in their timer service of choice
5. Provide a simple thread based timer service as a default
This would require adding some fields in wf_node_token:
guard_eval_count int not null,
next_guard_eval timestamp
Timer service would look something like:
public interface TimerService
{
void scheduleNodeTokenRetry(final NodeToken token)
}
BaseEngine would have a new method that could be overridden.
public TimerService getTimerService() { .. }
Usage:
<node type="node" name="delayedNode">
<guard>IF isFirstGuardEval THEN retry at 1 hour after currentTime ELSE ACCEPT</guard>
</node>
<node type="node" name="delayedNode">
<guard>IF shipmentReady
THEN Accept
ELSE IF tooManyEvals
THEN Skip TimeOut
ELSE retry at 1 day after currentTime
</guard>
</node>
Thoughts?
Cheers,
Paul