123456789_123456789_123456789_123456789_123456789_

Class: Concurrent::Actor::Behaviour::Abstract

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Super Chains via Extension / Inclusion / Inheritance
Instance Chain:
Inherits: Object
Defined in: lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb

Constant Summary

Concern::Logging - Included

SEV_LABEL

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(core, subsequent, core_options) ⇒ Abstract

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 14

def initialize(core, subsequent, core_options)
  @core       = Type! core, Core
  @subsequent = Type! subsequent, Abstract, NilClass
end

Instance Attribute Details

#core (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 12

attr_reader :core, :subsequent

#subsequent (readonly)

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 12

attr_reader :core, :subsequent

Instance Method Details

#broadcast(public, event)

broadcasts event to all behaviours and context

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 39

def broadcast(public, event)
  core.broadcast(public, event)
end

#on_envelope(envelope)

Note:

super needs to be called not to break the chain

override to add extra behaviour

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 21

def on_envelope(envelope)
  pass envelope
end

#on_event(public, event)

Note:

super needs to be called not to break the chain

override to add extra behaviour

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 32

def on_event(public, event)
  subsequent.on_event public, event if subsequent
end

#pass(envelope)

Parameters:

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 26

def pass(envelope)
  subsequent.on_envelope envelope
end

#reject_envelope(envelope)

[ GitHub ]

  
# File 'lib/concurrent-ruby-edge/concurrent/actor/behaviour/abstract.rb', line 43

def reject_envelope(envelope)
  envelope.reject! ActorTerminated.new(reference)
  dead_letter_routing << envelope unless envelope.future
  log(DEBUG) { "rejected #{envelope.message} from #{envelope.sender_path}"}
end