Class: Concurrent::Actor::Utils::AbstractWorker

Inherits:
RestartingContext show all
Defined in:
lib/concurrent/actor/utils/pool.rb

Instance Attribute Summary

Attributes inherited from AbstractContext

#core

Instance Method Summary collapse

Methods inherited from RestartingContext

#behaviour_definition

Methods inherited from AbstractContext

#ask, #behaviour_definition, #dead_letter_routing, #default_reference_class, #envelope, #on_envelope, #on_event, #pass, #tell

Methods included from InternalDelegations

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

Methods included from PublicDelegations

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

Methods included from TypeCheck

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

Constructor Details

#initialize(balancer) ⇒ AbstractWorker

Returns a new instance of AbstractWorker.



42
43
44
45
# File 'lib/concurrent/actor/utils/pool.rb', line 42

def initialize(balancer)
  @balancer = balancer
  @balancer << :subscribe
end

Instance Method Details

#on_message(message) ⇒ Object



47
48
49
50
51
# File 'lib/concurrent/actor/utils/pool.rb', line 47

def on_message(message)
  work message
ensure
  @balancer << :subscribe
end

#work(message) ⇒ Object

Raises:

  • (NotImplementedError)


53
54
55
# File 'lib/concurrent/actor/utils/pool.rb', line 53

def work(message)
  raise NotImplementedError
end