class Realm::EventRouter::Gateway

Public Class Methods

auto_register_on_init() click to toggle source
# File lib/realm/event_router/gateway.rb, line 6
def self.auto_register_on_init
  false
end
new(event_factory:, namespace: :default, runtime: nil, **) click to toggle source
# File lib/realm/event_router/gateway.rb, line 10
def initialize(event_factory:, namespace: :default, runtime: nil, **)
  @namespace = namespace
  @event_factory = event_factory
  @runtime = runtime
end

Public Instance Methods

add_listener(event_type, listener) click to toggle source
# File lib/realm/event_router/gateway.rb, line 23
def add_listener(event_type, listener)
  raise NotImplementedError
end
cleanup() click to toggle source
# File lib/realm/event_router/gateway.rb, line 35
def cleanup
  # do nothing
end
queues() click to toggle source
# File lib/realm/event_router/gateway.rb, line 39
def queues
  []
end
register(handler_class) click to toggle source
# File lib/realm/event_router/gateway.rb, line 16
def register(handler_class)
  # TODO: validate event_types for existence of matching class
  handler_class.event_types.each do |event_type|
    add_listener(event_type, handler_class.bind_runtime(@runtime))
  end
end
trigger(event_type, attributes = {}) click to toggle source
# File lib/realm/event_router/gateway.rb, line 27
def trigger(event_type, attributes = {})
  raise NotImplementedError
end
worker(*) click to toggle source
# File lib/realm/event_router/gateway.rb, line 31
def worker(*)
  nil
end

Protected Instance Methods

create_event(event_type, attributes = {}) click to toggle source
# File lib/realm/event_router/gateway.rb, line 45
def create_event(event_type, attributes = {})
  @event_factory.create_event(event_type, **attributes)
end