Class: Dynflow::Config::QueuesConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/dynflow/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeQueuesConfig

Returns a new instance of QueuesConfig.



54
55
56
# File 'lib/dynflow/config.rb', line 54

def initialize
  @queues = { :default => {} }
end

Instance Attribute Details

#queuesObject (readonly)

Returns the value of attribute queues.



52
53
54
# File 'lib/dynflow/config.rb', line 52

def queues
  @queues
end

Instance Method Details

#add(name, queue_options = {}) ⇒ Object

Add a new queue to the configuration

Parameters:

  • queue_options (Hash) (defaults to: {})

Options Hash (queue_options):

  • :pool_size (Object)

    The amount of workers available for the queue. By default, it uses global pool_size config option.

Raises:

  • (ArgumentError)


63
64
65
66
67
68
# File 'lib/dynflow/config.rb', line 63

def add(name, queue_options = {})
  Utils.validate_keys!(queue_options, :pool_size)
  name = name.to_sym
  raise ArgumentError, "Queue #{name} is already defined" if @queues.key?(name)
  @queues[name] = queue_options
end

#finalized_config(config_for_world) ⇒ Object



70
71
72
73
74
75
# File 'lib/dynflow/config.rb', line 70

def finalized_config(config_for_world)
  @queues.values.each do |queue_options|
    queue_options[:pool_size] ||= config_for_world.pool_size
  end
  @queues
end