Class OpenWFE::TimeoutExpression
In: lib/openwfe/expressions/fe_timeout.rb
Parent: FlowExpression

The timeout concept begun with the participant expression. When a participant doesn‘t reply for a certain amount of time, a specified timeout can get triggered. Sometimes something more complex than a single participant needs a timeout setting, this expression sets a timeout for the expression[s] nested within it.

    <timeout after="2d">
        <sequence>
            (...)
        </sequence>
    </timeout>

Methods

apply   cancel   reply   trigger  

Included Modules

TimeoutMixin

Attributes

applied_workitem  [RW] 

Public Instance methods

[Source]

    # File lib/openwfe/expressions/fe_timeout.rb, line 72
72:         def apply (workitem)
73: 
74:             if @children.size < 1
75:                 reply_to_parent workitem
76:                 return
77:             end
78: 
79:             @applied_workitem = workitem.dup
80: 
81:             schedule_timeout(:after)
82: 
83:             get_expression_pool.apply @children[0], workitem
84:         end

Cancel order : cancels the child expression (if applied) and unschedule the timeout (if any).

[Source]

     # File lib/openwfe/expressions/fe_timeout.rb, line 101
101:         def cancel
102: 
103:             get_expression_pool.cancel(@children[0]) if @applied_workitem
104: 
105:             unschedule_timeout()
106: 
107:             super
108:         end

The child expression replies, make sure to unschedule the timeout before replying (to our own parent expression).

[Source]

    # File lib/openwfe/expressions/fe_timeout.rb, line 90
90:         def reply (workitem)
91: 
92:             unschedule_timeout()
93: 
94:             super
95:         end

The timeout trigger, cancels the nested process segment (the nested expression).

[Source]

     # File lib/openwfe/expressions/fe_timeout.rb, line 114
114:         def trigger (scheduler)
115: 
116:             ldebug { "trigger() timeout requested for #{@fei.to_debug_s}" }
117: 
118:             set_timedout_flag(@applied_workitem)
119: 
120:             cancel()
121: 
122:             reply_to_parent @applied_workitem
123:         end

[Validate]