Class: Realm::Runtime
- Inherits:
-
Object
- Object
- Realm::Runtime
- Defined in:
- lib/realm/runtime.rb,
lib/realm/runtime/session.rb
Defined Under Namespace
Classes: Session
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
Instance Method Summary collapse
-
#active_queues ⇒ Object
Get all active messaging queues.
- #context ⇒ Object
- #health ⇒ Object
-
#initialize(container = Container.new) ⇒ Runtime
constructor
A new instance of Runtime.
- #session(context = {}) ⇒ Object
- #worker(*args) ⇒ Object
Constructor Details
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
18 19 20 |
# File 'lib/realm/runtime.rb', line 18 def container @container end |
Instance Method Details
#active_queues ⇒ Object
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)
47 48 49 |
# File 'lib/realm/runtime.rb', line 47 def active_queues event_router.try(:active_queues) || [] end |
#context ⇒ Object
24 25 26 |
# File 'lib/realm/runtime.rb', line 24 def context @context ||= Context.new(@container) end |
#health ⇒ Object
36 37 38 39 40 41 |
# File 'lib/realm/runtime.rb', line 36 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 = {}) ⇒ Object
28 29 30 |
# File 'lib/realm/runtime.rb', line 28 def session(context = {}) context.blank? ? self : Session.new(self, context) end |
#worker(*args) ⇒ Object
32 33 34 |
# File 'lib/realm/runtime.rb', line 32 def worker(*args) MultiWorker.new(event_router.try(:workers, *args) || []) end |