Class: Concurrent::Actor::Behaviour::Awaits

Inherits:
Abstract
  • Object
show all
Defined in:
lib/concurrent/actor/behaviour/awaits.rb

Overview

Accepts ‘:await` messages. Which allows to wait on Actor to process all previously send messages.

actor << :a << :b
actor.ask(:await).wait # blocks until :a and :b are processed

Instance Attribute Summary

Attributes inherited from Abstract

#core, #subsequent

Instance Method Summary collapse

Methods inherited from Abstract

#broadcast, #initialize, #on_event, #pass, #reject_envelope

Methods included from InternalDelegations

#behaviour, #behaviour!, #children, #context, #dead_letter_routing, #log, #redirect, #terminate!, #terminated?

Methods included from PublicDelegations

#context_class, #executor, #name, #parent, #path, #reference

Methods included from TypeCheck

#Child!, #Child?, #Match!, #Match?, #Type!, #Type?

Constructor Details

This class inherits a constructor from Concurrent::Actor::Behaviour::Abstract

Instance Method Details

#on_envelope(envelope) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/concurrent/actor/behaviour/awaits.rb', line 11

def on_envelope(envelope)
  if envelope.message == :await
    true
  else
    pass envelope
  end
end