flux
Interface DelayTrigger

All Superinterfaces:
Action, java.lang.Cloneable, RuntimeDataMap, java.io.Serializable, Trigger

public interface DelayTrigger
extends Trigger

This delay trigger pauses, or sleeps, for a while after an execution flow reaches this trigger. The difference between this trigger and timer trigger is that timer trigger fires on a set schedule. For example, it attempts to fire every 15 seconds, regardless of whether an execution flow has returned to the timer trigger. On the other hand, this trigger begins sleeping at the moment an execution flow reaches this trigger, not on a pre-determined schedule.

The delay trigger is appropriate for delays, pauses, and sleeps, whereas timer trigger is appropriate for schedules.

Delay triggers are especially useful in default flow chart error handlers. When an error occurs in an action and a default error handler is invoked, the error handler typically pauses for a while before the retrying the action. The delay trigger is perfect for this scenario, whereas a timer trigger fires on a schedule, and a proper delay cannot be achieved.

When used as a default error handler, this delay trigger can also be configured to retry a certain number of times or until an expiration date.

By default, this delay trigger pauses for 3 seconds. This delay can be configured with the setDelayTimeExpression() method. Also by default, the count is set to infinity and there is no expiration time expression.

When this trigger finishes, a flux.DelayTrigger.DelayResult object is returned into the execution flow context.

The Delay Trigger returns its result in the flow context variable "RESULT". The following table contains more information on accessing and using the result.

Flow Context Variable Field Java Type Description
RESULTresultbooleanA boolean value indicating whether the delay trigger has expired. If true, the delay trigger fired normally; if false, the delay trigger has expired.

Author:
Copyright 2014 Flux Corporation. All rights reserved.

Nested Class Summary
static class DelayTrigger.Delay_Result
          Deprecated. Use DelayTriggerResult instead. Deprecated in Flux 7.2. Will be removed in Flux 8.0.
static class DelayTrigger.DelayTriggerResult
          The result when a delay trigger fires.
 
Field Summary
static int INFINITY
          Use this constant in the setCount() method to allow this trigger to run forever or until the expiration.
 
Method Summary
 void expire()
          Resets the state of this delay trigger as though it had expired and control had flowed down the expiration path.
 long getCount()
          Returns the total number of times this trigger is configured to repeat until it expires.
 java.lang.String getDelayTimeExpression()
          Returns a time expression that describes how long to wait.
 java.util.Date getExpirationDate()
          Returns the date when this trigger expires.
 java.lang.String getExpirationTimeExpression()
          Returns the time expression that governs when this trigger expires.
 long getRemainingCount()
          Returns the remaining number of times this trigger has yet to repeat before it expires.
 java.util.Date getScheduledTriggerDate()
          Returns the date when this delay trigger is scheduled to fire.
 void setCount(long count)
          Sets the total number of times this trigger is configured to repeat until it expires.
 void setDelayTimeExpression(java.lang.String delayTimeExpression)
          Sets a time expression that describes how long to wait.
 void setExpirationFlow(Action action)
          The flow that is followed when this delay trigger expires.
 void setExpirationTimeExpression(java.lang.String expirationTimeExpression)
          Sets the time expression that governs when this trigger expires.
 
Methods inherited from interface flux.Action
addFlow, addFlow, addSignalFlow, clone, execute, getDescription, getFlows, getHiddenVariableNames, getJoinExpression, getName, getPostscript, getPostscriptLanguage, getPrescript, getPrescriptLanguage, getResultInfo, getSignalsToMonitor, getTimeoutBusinessInterval, getTimeoutBusinessIntervalNamespace, getTimeoutExpression, getVariableManager, isEndOfRun, isJoinPoint, isSkippable, isStartAction, isStartOfRun, isTransactionBreak, removeFlow, reset, setDescription, setElseFlow, setEndOfRun, setErrorFlow, setErrorFlowWithoutRollback, setErrorFlowWithRollback, setJoinExpression, setJoinPoint, setName, setPostscript, setPostscriptLanguage, setPrescript, setPrescriptLanguage, setSignalsToMonitor, setSkippable, setStartAction, setStartOfRun, setTimeoutBusinessInterval, setTimeoutBusinessIntervalNamespace, setTimeoutExpression, setTimeoutFlow, setTransactionBreak, verify, verifyOnClient
 
Methods inherited from interface flux.runtimedatamap.RuntimeDataMap
getRuntimeDataMap, setRuntimeDataMap
 

Field Detail

INFINITY

static final int INFINITY
Use this constant in the setCount() method to allow this trigger to run forever or until the expiration.

See Also:
getCount(), setCount(long), Constant Field Values
Method Detail

expire

void expire()
Resets the state of this delay trigger as though it had expired and control had flowed down the expiration path. Useful for flow charts that use delay triggers in such a way that delay trigger expirations must be performed at points in the flow chart away from the delay trigger itself.


getCount

long getCount()
Returns the total number of times this trigger is configured to repeat until it expires. By default, INFINITY is returned.

Returns:
The total number of times this trigger is configured to repeat until it expires. By default, INFINITY is returned.
See Also:
INFINITY

getDelayTimeExpression

java.lang.String getDelayTimeExpression()
Returns a time expression that describes how long to wait. By default, the time expression "+3s" (3 seconds) is returned.

Returns:
A time expression that describes how long to wait.

getExpirationDate

java.util.Date getExpirationDate()
Returns the date when this trigger expires. Returns null if there is no expiration date or if this trigger has already expired.

Returns:
The date when this trigger expires. Returns null if there is no expiration date or if this trigger has already expired.

getExpirationTimeExpression

java.lang.String getExpirationTimeExpression()
Returns the time expression that governs when this trigger expires. The first time this trigger executes, or the first time it executes after having expired, the expiration time expression is used to calculate when this trigger expires. By default, null is returned.

For example, if a flow chart execution flow enters this trigger for the first time at 14:41 and the expiration time expression is set to +15m, the trigger will expire at 14:56.

Returns:
The time expression that governs when this trigger expires. By default, null is returned.

getRemainingCount

long getRemainingCount()
Returns the remaining number of times this trigger has yet to repeat before it expires. Returns the same value returned by getCount() if a running flow has not entered this trigger yet or if this trigger has already expired.

Returns:
The remaining number of times this trigger has yet to repeat before it expires.
See Also:
INFINITY

getScheduledTriggerDate

java.util.Date getScheduledTriggerDate()
Returns the date when this delay trigger is scheduled to fire. After this delay trigger fires at the scheduled trigger date, the next scheduled trigger date is set to null. The scheduled trigger date will then remain null until an executing flow context reaches this delay trigger again.

Returns null if this method is called after the flow chart has been added to the engine but before the engine has had a chance to start running the flow chart, reach this delay trigger, and set the scheduled trigger date.

Returns:
The date when this delay trigger is scheduled to fire.

setCount

void setCount(long count)
Sets the total number of times this trigger is configured to repeat until it expires. By default, INFINITY is returned.

Parameters:
count - The total number of times this trigger is configured to repeat until it expires.
See Also:
INFINITY

setDelayTimeExpression

void setDelayTimeExpression(java.lang.String delayTimeExpression)
                            throws EngineException
Sets a time expression that describes how long to wait. By default, the delay time expression is "+3s" (3 seconds).

Parameters:
delayTimeExpression - A time expression that describes how long to wait.
Throws:
EngineException - If a system error occurs.

setExpirationFlow

void setExpirationFlow(Action action)
The flow that is followed when this delay trigger expires. Delegates to setElseFlow().

Parameters:
action - The flow that is followed when this delay trigger expires.

setExpirationTimeExpression

void setExpirationTimeExpression(java.lang.String expirationTimeExpression)
                                 throws EngineException
Sets the time expression that governs when this trigger expires. The first time this trigger executes, or the first time it executes after having expired, the expiration time expression is used to calculate when this trigger expires. By default, the expiration time expression is null.

For example, if this flow chart execution enters this trigger for the first time at 14:41 and the expiration time expression is set to +15m, the trigger will expire at 14:56.

Parameters:
expirationTimeExpression - The time expression that governs when this trigger expires.
Throws:
EngineException - If a system error occurs.


© 2014 Flux Corporation. All rights reserved.