Sha256: 8af965ccfe11560b190010e989fa460b641e6f14223e48199a92a4a8780e7cd2

Contents?: true

Size: 1.15 KB

Versions: 21

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true

module RubyRabbitmqJanus
  module Rabbit
    module Publisher
      # :reek:InstanceVariableAssumption

      # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
      # This publisher send and read an message in admin queues
      class Admin < Base
        # Initialize an queue non eclusive for admin/monitor API with Janus
        #
        # @param [String] exchange Exchange used for the transaction
        def initialize(exchange)
          @reply = exchange.queue('', exclusive: true)
          # @reply = exchange.queue(Tools::Config.instance.queue_admin_from)
          super(exchange)
          subscribe_to_queue
        end

        # Send an message to queue and waiting a response
        #
        #
        # @param [String] request JSON request sending to rabbitmq queue
        #
        # @return [Janus::Response::Admin] response for an request reading
        #   by janus instance
        def publish(request)
          @message = request
          @exchange.publish(@message.to_json,
                            request.options.merge!(reply_to: reply.name))
          return_response
        end
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-4.0.0.pre.949167646 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.946892338 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.946565704 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.939149205 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.939137013 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.939133437 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.939119110 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.939113634 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-4.0.0.pre.850041590 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.1 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.387 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.385 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.384 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.382 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.366 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.364 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.358 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.354 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.352 lib/rrj/rabbit/publisher/admin.rb