Class: Conductor::Worker::Events::GlobalDispatcher
- Inherits:
-
Object
- Object
- Conductor::Worker::Events::GlobalDispatcher
- Defined in:
- lib/conductor/worker/events/global_dispatcher.rb
Overview
Process-wide default event dispatcher.
Used by library layers (e.g. HTTP client) that don't have an obvious owner to receive a dispatcher reference. Listeners can subscribe to this singleton to receive events regardless of which RestClient/ApiClient instance generated them.
Class Method Summary collapse
Class Method Details
.http_metrics_enabled? ⇒ Boolean
28 29 30 31 32 |
# File 'lib/conductor/worker/events/global_dispatcher.rb', line 28 def http_metrics_enabled? instance.has_listeners?(HttpApiRequest) rescue StandardError false end |
.instance ⇒ Object
16 17 18 |
# File 'lib/conductor/worker/events/global_dispatcher.rb', line 16 def instance @instance ||= SyncEventDispatcher.new end |
.publish(event) ⇒ Object
24 25 26 |
# File 'lib/conductor/worker/events/global_dispatcher.rb', line 24 def publish(event) instance.publish(event) end |
.reset! ⇒ Object
20 21 22 |
# File 'lib/conductor/worker/events/global_dispatcher.rb', line 20 def reset! @instance = SyncEventDispatcher.new end |