Sha256: c39d754cd617a3c18bd896b33b861ff8aba135f290e3470d614971f4c2d46a33
Contents?: true
Size: 1.39 KB
Versions: 32
Compression:
Stored size: 1.39 KB
Contents
# frozen_string_literal: true module RubyRabbitmqJanus module Tools # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv> # # Manage Janus instance class Cluster include Singleton # Initialize object for managing each instance to Janus def initialize @current_instance = nil end # Create session (just one Janus Instance) def create_session @current_instance = 1 Models::JanusInstance.create(instance: @current_instance) rescue raise Errors::Tools::Cluster::CreateSession end # Restart a thread keepalive for an instance def restart_session Models::JanusInstance.enabled.each do |ji| ji.send(:create_a_session_in_janus_instance) end rescue raise Errors::Tools::Cluster::RestartInstance end # Specify a name to queue def queue_to(instance = nil) Tools::Config.instance.options['queues']['standard']['to'] + \ "-#{instance.blank? ? @current_instance : instance}" rescue raise Errors::Tools::Cluster::QueueTo end # Specify a name to admin queue def queue_admin_to(instance = nil) Tools::Config.instance.options['queues']['admin']['to'] + \ "-#{instance.blank? ? @current_instance : instance}" rescue raise Errors::Tools::Cluster::QueueAdminTo end end end end
Version data entries
32 entries across 32 versions & 1 rubygems