Sha256: 205977e4f2e33ea609795d38c6dad7925a4362c70111126d4ecd7338f143de5d

Contents?: true

Size: 1.3 KB

Versions: 43

Compression:

Stored size: 1.3 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
        rescue
          raise Errors::Rabbit::Publisher::Admin::Initialize
        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
        rescue
          raise Errors::Rabbit::Publisher::Admin::Pusblish
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-3.0.0.pre.336 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.335 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.334 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.330 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.328 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-3.0.0.pre.327 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.322 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.320 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.319 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.318 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.317 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.316 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.315 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.314 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.312 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.310 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.309 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.308 lib/rrj/rabbit/publisher/admin.rb
ruby_rabbitmq_janus-2.7.2.pre.307 lib/rrj/rabbit/publisher/admin.rb