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.

multi forget

Forget multiple children at once.

forget do
  alice :task => 'take out garbage'
  bob :task => 'clean living room'
end

The forget expression will reply immediately to its parent expression, it will thus not be cancellable (neither the children will be cancellable).

forget vs lose vs flank

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

lose : never replies to the parent expression, is cancellable.

flank : immediately replies to the 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?, #applied_workitem, #att, #att_text, #attribute, #attribute_text, #attributes, #await, #cancel, #cancel_flanks, #cfei_at, #child_id, #child_ids, #compile_atts, #compile_variables, #debug_id, #deflate, #do, do_action, #do_apply, #do_cancel, #do_fail, #do_pause, #do_persist, #do_reply, #do_reply_to_parent, #do_resume, #do_unpersist, dummy, #fei, fetch, from_h, #handle_on_error, #has_attribute, #initial_persist, #initialize, #is_concurrent?, #iterative_var_lookup, #launch_sub, #lookup_val, #lookup_val_prefix, #lookup_variable, #name, names, #parent, #parent_id, #pause_on_apply, #persist_or_raise, #reply_to_parent, #root, #root_id, #set_variable, #to_h, #tree, #tree_children, #try_persist, #try_unpersist, #unpersist_or_raise, #unset_variable, #update_tree, #variables, #wfid

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



90
91
92
93
94
95
96
97
# File 'lib/ruote/exp/fe_forget.rb', line 90

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



99
100
101
102
# File 'lib/ruote/exp/fe_forget.rb', line 99

def reply(workitem)

  # never gets called
end