Module: Celluloid::ClassMethods

Extended by:
Forwardable
Defined in:
lib/celluloid/supervision/container/behavior/pool.rb

Instance Method Summary collapse

Instance Method Details

#pool(config = {}, &block) ⇒ Object

Create a new pool of workers. Accepts the following options:

  • size: how many workers to create. Default is worker per CPU core

  • args: array of arguments to pass when creating a worker


12
13
14
15
# File 'lib/celluloid/supervision/container/behavior/pool.rb', line 12

def pool(config={}, &block)
  _ = Celluloid.supervise(pooling_options(config, block: block, actors: self))
  _.actors.last
end

Same as pool, but links to the pool manager


18
19
20
# File 'lib/celluloid/supervision/container/behavior/pool.rb', line 18

def pool_link(klass, config={}, &block)
  Supervision::Container::Pool.new_link(pooling_options(config, block: block, actors: klass))
end