Class: Ruote::Exp::ForgetExpression

Inherits:
FlowExpression show all
Defined in:
lib/ruote/exp/fe_forget.rb

Overview

Forgets all of its children.

This expression is somehow deprecated in favour of the :forget attribute that any expression understands.

sequence do
  participant 'alpha'
  forget do
    sequence do
      participant 'bravo'
      participant 'charly'
    end
  end
  participant 'delta'
end

In this example above, the flow goes from alpha to bravo and delta. The bravo-charly segment is independent of the main process flow. Charly’s reply will be forgotten.

Now the equivalent process definition, but using the :forget attribute :

sequence do
  participant 'alpha'
  sequence :forget => true do
    participant 'bravo'
    participant 'charly'
  end
  participant 'delta'
end

This expression can be useful for fire-and-forget parallelism in processes.

forget vs lose

forget : replies to parent expression immediately, is not cancellable (not reachable).

lose : never replies to parent expression, is cancellable.

Constant Summary

Constants inherited from FlowExpression

Ruote::Exp::FlowExpression::COMMON_ATT_KEYS

Instance Attribute Summary

Attributes inherited from FlowExpression

#context, #error, #h

Instance Method Summary collapse

Methods inherited from FlowExpression

#ancestor?, #att, #attribute, #attribute_text, #attributes, #cancel, #compile_atts, #compile_variables, do_action, #do_apply, #do_cancel, #do_fail, #do_pause, #do_persist, #do_reply, #do_resume, #do_unpersist, #expand_atts, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #iterative_var_lookup, #launch_sub, #lookup_on_error, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #persist_or_raise, #reply_to_parent, #set_variable, #to_h, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables

Methods included from WithMeta

#class_def, included

Methods included from WithH

included

Constructor Details

This class inherits a constructor from Ruote::Exp::FlowExpression

Instance Method Details

#applyObject



73
74
75
76
77
78
79
80
# File 'lib/ruote/exp/fe_forget.rb', line 73

def apply

  tree_children.each_with_index do |t, index|
    apply_child(index, Ruote.fulldup(h.applied_workitem), true)
  end

  reply_to_parent(h.applied_workitem)
end

#reply(workitem) ⇒ Object



82
83
84
85
# File 'lib/ruote/exp/fe_forget.rb', line 82

def reply(workitem)

  # never gets called
end