Class: Startback::Event::Agent

Inherits:
Object
  • Object
show all
Includes:
Support::OperationRunner, Support::Robustness
Defined in:
lib/startback/event/agent.rb

Overview

An agent listen to specific events and react with its ‘call` method.

This class is intended to be subclasses and the following methods overriden:

- install_listeners that installs sync and async listeners
- call to create a context and implement reaction behavior

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Support::Robustness

#log, #monitor, #stop_errors, #try_max_times

Methods included from Support::OperationRunner

included, #run

Constructor Details

#initialize(engine, type = :all) ⇒ Agent

Returns a new instance of Agent.



17
18
19
20
21
22
# File 'lib/startback/event/agent.rb', line 17

def initialize(engine, type = :all)
  @engine = engine
  @context = nil
  @type = type
  install_listeners
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



24
25
26
# File 'lib/startback/event/agent.rb', line 24

def context
  @context
end

#engineObject (readonly)

Returns the value of attribute engine.



23
24
25
# File 'lib/startback/event/agent.rb', line 23

def engine
  @engine
end