Sha256: acbd21d4dca73b3ed4c9a39db2fbf3761e19c0ed3c595c11ba7ba4cc53a9138c

Contents?: true

Size: 694 Bytes

Versions: 5

Compression:

Stored size: 694 Bytes

Contents

# Module responsible for managing all listeners
module EventBus
  module Listeners
    module Manager
      class << self
        def bind_all_listeners
          listener_configurations.each do |config|
            EventBus::Listener.on(config[:routing_key]) do |event, channel, delivery_info|
              config[:listener_class].new(channel).send(config[:method], event, delivery_info)
            end
          end
        end

        def register_listener_configuration(configuration)
          listener_configurations.push(configuration)
        end

        private

        def listener_configurations
          @listener_configurations ||= []
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
event_bus_rb-2.1.0 lib/event_bus/listeners/manager.rb
event_bus_rb-2.0.3 lib/event_bus/listeners/manager.rb
event_bus_rb-2.0.2 lib/event_bus/listeners/manager.rb
event_bus_rb-2.0.1 lib/event_bus/listeners/manager.rb
event_bus_rb-2.0.0 lib/event_bus/listeners/manager.rb