Class: Daemon::Supervision::Definition::Handler

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Utils::Loggable
Defined in:
lib/onapp/engine/supervision/definition/handler.rb

Instance Attribute Summary (collapse)

Attributes included from Utils::Loggable

#logger

Instance Method Summary (collapse)

Methods included from Utils::Loggable

#debug, #error, #fatal, #info, #lwarn

Constructor Details

- (Handler) initialize(supervisor, processor, opts = {})

Returns a new instance of Handler



20
21
22
23
24
25
26
27
# File 'lib/onapp/engine/supervision/definition/handler.rb', line 20

def initialize(supervisor, processor, opts = {})
  @period = opts[:period]
  @level = opts[:level]
  @force = opts.fetch(:force, true)
  @handler = supervisor.new(processor, @level)
  @logger = Daemon.logger
  @facility = "#{handler.name}-handler"
end

Instance Attribute Details

- (Object) force (readonly)

Returns the value of attribute force



15
16
17
# File 'lib/onapp/engine/supervision/definition/handler.rb', line 15

def force
  @force
end

- (Object) handler (readonly)

Returns the value of attribute handler



15
16
17
# File 'lib/onapp/engine/supervision/definition/handler.rb', line 15

def handler
  @handler
end

- (Object) level (readonly)

Returns the value of attribute level



15
16
17
# File 'lib/onapp/engine/supervision/definition/handler.rb', line 15

def level
  @level
end

- (Object) period (readonly)

Returns the value of attribute period



15
16
17
# File 'lib/onapp/engine/supervision/definition/handler.rb', line 15

def period
  @period
end

Instance Method Details

- (Object) call



29
30
31
32
33
34
35
# File 'lib/onapp/engine/supervision/definition/handler.rb', line 29

def call
  handler.messages_manager.publish_command(PROCEED)
rescue => ex
  error {
    "Can't proceed! #{ex.class}: #{ex.message}"
  }
end