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) ⇒ Agent

Returns a new instance of Agent.



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

def initialize(engine)
  @engine = engine
  @context = nil
  install_listeners
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



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

def context
  @context
end

#engineObject (readonly)

Returns the value of attribute engine.



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

def engine
  @engine
end