Sha256: 01bb8babc2d74dde1b46ecd7da0cfc0f116536aa8bf9004302e6025b4cf294f2

Contents?: true

Size: 1.45 KB

Versions: 6

Compression:

Stored size: 1.45 KB

Contents

# frozen_string_literal: true

# :reek:UtilityFunction

module RubyRabbitmqJanus
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>

  # # RubyRabbitmqJanus - RRJAdmin
  #
  # This class inherite to a classic initializer but it's used for
  # admin request sending to janus (Admin/Monitor API).
  #
  # **Is used just for sending a message to Janus Monitor/Admin API.**.
  # **The queue is always ***exclusive*** for not transmitting data to
  # anyone.**
  #
  # @see https://janus.conf.meetecho.com/docs/admin.html
  class RRJAdmin < RRJ
    # Create a transaction between Apps and Janus
    #
    # @param [Hash] options
    #   Give a session number for use another session in Janus
    #
    # @example List all sessions in Janus Instance
    #   instance = { 'instance' => 42 }
    #   @rrj.admin_endpoint(instance) do |transaction|
    #     response = transaction.publish_message('admin:sessions').sessions
    #   end
    #
    # @example Change log level to Janus Instance
    #   instance = { 'instance' => 42 }
    #   options = instance.merge({ 'level' => 5 })
    #   @rrj.admin_endpoint(options) do |transaction|
    #     response = transaction.publish_message('admin:set_log_level', options)
    #   end
    #
    # @since 2.7.0
    def admin_endpoint(options = {})
      transaction = Janus::Transactions::Admin.new(options)
      transaction.connect { yield(transaction) }
    rescue
      raise Errors::RRJAdmin::StartTransactionAdmin, options
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-3.0.0.pre.336 lib/rrj/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.335 lib/rrj/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.334 lib/rrj/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.330 lib/rrj/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.328 lib/rrj/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.327 lib/rrj/admin.rb