Class: Trinidad::Extensions::WorkerWebAppExtension

Inherits:
WebAppExtension
  • Object
show all
Defined in:
lib/trinidad_worker_extension.rb

Defined Under Namespace

Classes: WorkerLifecycle

Instance Method Summary collapse

Instance Method Details

#configure(context) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/trinidad_worker_extension.rb', line 9

def configure(context)
  if ! options || options.size == 0
    context.logger.info "No worker(s) seems to be configured"
  else
    worker_config = options.first
    if options.size > 1
      context.logger.info "Currently only 1 worker configuration per " <<
      "web-app is supported, will use first: #{worker_config.inspect}"
    end
    if worker_config.is_a?(Array) # [ key, val ]
      configure_worker context, worker_config[0], worker_config[1]
    else
      configure_worker context, nil, worker_config
    end
  end
end