set_timer/3—set a timer on an event object that will expire after a specified delay
Note
This primitive cannot be used in refine
, filter
, regulate
, or propagate
rules.
The syntax for set_timer/3
is as follows:
set_timer($OBJECT,$DURATION,$INFO)
set_timer/3 arguments
Argument | Mode | Type | Description |
---|---|---|---|
| Input | OBJECT | Specifies the event object |
| Input | INTEGER | Specifies the duration until timer expiration, in seconds |
| Input | STRING | Specifies the information item as |
Use the set_timer/3
to set a timer on event $OBJECT
that will expire after $DURATION
seconds and to trigger a timer rule with timer information matching $INFO
.
The value of $INFO
will be substituted for the timer_info
in matching timer rules when the timer expires.
set_timer/3 example
new TimeoutNew: EVENT($E) where [ {{$E}}.mc_timeout > 0 ]
triggers
{
set_timer($E,$E.mc_timeout,EventTimeout);
}
END
timer TimeoutTimer: EVENT($E) where [ $E.status != CLOSED ]
timer_info: == EventTimeout
{
$E.status = CLOSED;
}
END
When a new event is received and its mc_timeout
slot is greater than 0, a timer will be set on the event to expire after that timeout period. The timer rule in the example will match, because it tests timer_info
to ensure that it is equal to EventTimeout
.
Comments
Log in or register to comment.