Class: Promiscuous::Subscriber::Worker

Inherits:
Object
  • Object
show all
Extended by:
Autoload
Defined in:
lib/promiscuous/subscriber/worker.rb

Defined Under Namespace

Classes: EventualDestroyer, Pump, Recorder, Runner, Stats

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Autoload

autoload

Constructor Details

#initializeWorker

Returns a new instance of Worker.



7
8
9
10
11
12
# File 'lib/promiscuous/subscriber/worker.rb', line 7

def initialize
  @pump = Pump.new(self)
  @runner = Runner.new(self)
  @stats = Stats.new
  @eventual_destroyer = EventualDestroyer.new
end

Instance Attribute Details

#eventual_destroyerObject

Returns the value of attribute eventual_destroyer.



5
6
7
# File 'lib/promiscuous/subscriber/worker.rb', line 5

def eventual_destroyer
  @eventual_destroyer
end

#pumpObject

Returns the value of attribute pump.



5
6
7
# File 'lib/promiscuous/subscriber/worker.rb', line 5

def pump
  @pump
end

#runnerObject

Returns the value of attribute runner.



5
6
7
# File 'lib/promiscuous/subscriber/worker.rb', line 5

def runner
  @runner
end

#statsObject

Returns the value of attribute stats.



5
6
7
# File 'lib/promiscuous/subscriber/worker.rb', line 5

def stats
  @stats
end

Instance Method Details

#show_stop_statusObject



28
29
30
31
32
# File 'lib/promiscuous/subscriber/worker.rb', line 28

def show_stop_status
  @num_show_stop_requests ||= 0
  @num_show_stop_requests += 1
  @runner.show_stop_status(@num_show_stop_requests)
end

#startObject



14
15
16
17
18
19
# File 'lib/promiscuous/subscriber/worker.rb', line 14

def start
  @pump.connect
  @runner.start
  @stats.connect
  @eventual_destroyer.try(:start)
end

#stopObject



21
22
23
24
25
26
# File 'lib/promiscuous/subscriber/worker.rb', line 21

def stop
  @stats.disconnect
  @runner.stop
  @pump.disconnect
  @eventual_destroyer.try(:stop)
end