class Realm::Runtime

Attributes

container[R]

Public Class Methods

new(container = Container.new) click to toggle source
# File lib/realm/runtime.rb, line 10
def initialize(container = Container.new)
  @container = Container[container]
end

Public Instance Methods

active_queues() click to toggle source

Get all active messaging queues. For maintenance purpose only. TODO: Introduce component container and allow to call those method directly on components instead of polluting runtime Example: engine.realm.components.find(type: Realm::EventRouter::SNSGateway).try(:active_queues)

# File lib/realm/runtime.rb, line 37
def active_queues
  event_router.try(:active_queues) || []
end
context() click to toggle source
# File lib/realm/runtime.rb, line 14
def context
  @context ||= Context.new(@container)
end
health() click to toggle source
# File lib/realm/runtime.rb, line 26
def health
  component_statuses = container.each_with_object({}) do |(name, component), map|
    map[name] = component.health if component.respond_to?(:health) && !component.is_a?(Runtime)
  end
  HealthStatus.combine(component_statuses)
end
session(context = {}) click to toggle source
# File lib/realm/runtime.rb, line 18
def session(context = {})
  context.blank? ? self : Session.new(self, context)
end
worker(*args) click to toggle source
# File lib/realm/runtime.rb, line 22
def worker(*args)
  MultiWorker.new(event_router.try(:workers, *args) || [])
end

Private Instance Methods

dispatcher() click to toggle source
# File lib/realm/runtime.rb, line 43
def dispatcher
  @dispatcher ||= container.create(Dispatcher, self)
end
event_router() click to toggle source
# File lib/realm/runtime.rb, line 47
def event_router
  @container[EventRouter]
end