Module: Celluloid::Notifications

Included in:
IncidentReporter, Probe
Defined in:
lib/celluloid/notifications.rb

Defined Under Namespace

Classes: Fanout, Subscriber

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.notifierObject



3
4
5
# File 'lib/celluloid/notifications.rb', line 3

def self.notifier
  Actor[:notifications_fanout] || fail(DeadActorError, "notifications fanout actor not running")
end

.publish(pattern, *args) ⇒ Object



7
8
9
10
11
12
# File 'lib/celluloid/notifications.rb', line 7

def publish(pattern, *args)
  Celluloid::Notifications.notifier.publish(pattern, *args)
rescue DeadActorError
  # Bad shutdown logic. Oh well....
  # TODO: needs a tests
end

Instance Method Details

#subscribe(pattern, method) ⇒ Object



16
17
18
# File 'lib/celluloid/notifications.rb', line 16

def subscribe(pattern, method)
  Celluloid::Notifications.notifier.subscribe(Actor.current, pattern, method)
end

#unsubscribe(*args) ⇒ Object



20
21
22
# File 'lib/celluloid/notifications.rb', line 20

def unsubscribe(*args)
  Celluloid::Notifications.notifier.unsubscribe(*args)
end