Class: LocalBus::Publication

Inherits:
Object
  • Object
show all
Defined in:
lib/local_bus/publication.rb

Overview

Wraps an Async::Barrier and a list of Subscribers that are processing a Message.

Instance Method Summary collapse

Constructor Details

#initialize(barrier, *subscribers) ⇒ Publication

Constructor



9
10
11
12
# File 'lib/local_bus/publication.rb', line 9

def initialize(barrier, *subscribers)
  @barrier = barrier
  @subscribers = subscribers
end

Instance Method Details

#subscribersObject

Note:

Blocks until all subscribers complete

List of Subscribers that are processing a Message



24
25
26
27
# File 'lib/local_bus/publication.rb', line 24

def subscribers
  wait
  @subscribers
end

#waitObject

Blocks and waits for the barrier (i.e. all subscribers to complete)



16
17
18
19
# File 'lib/local_bus/publication.rb', line 16

def wait
  @barrier.wait
  self
end