Sha256: 324a243f7ab0bb696130109264da3790d9ca235b26634b4e19596fe571ff656b

Contents?: true

Size: 1.1 KB

Versions: 7

Compression:

Stored size: 1.1 KB

Contents

# frozen_string_literal: true

module RubyRabbitmqJanus
  module Rabbit
    module Publisher
      # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
      # This publisher send and read an message in admin queues
      class PublisherAdmin < Publisher
        # Intialize an queue non eclusive for admin/monitor API with Janus
        #
        # @param [String] exchange Exchange used for the transaction
        def initialize(exchange)
          @reply = exchange.queue(queue_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::Standard] response for an request reading
        #   by janus instance
        def publish(request)
          super(request)
          return_response
        end

        private

        attr_reader :reply

        # Define queue used for posting a message to API admin
        def queue_from
          Tools::Config.instance.queue_admin_from
        end
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-1.2.9 lib/rrj/rabbit/publish/admin.rb
ruby_rabbitmq_janus-1.2.8 lib/rrj/rabbit/publish/admin.rb
ruby_rabbitmq_janus-1.2.7 lib/rrj/rabbit/publish/admin.rb
ruby_rabbitmq_janus-1.2.7.pre.alpha lib/rrj/rabbit/publish/admin.rb
ruby_rabbitmq_janus-1.2.6 lib/rrj/rabbit/publish/admin.rb
ruby_rabbitmq_janus-1.2.5 lib/rrj/rabbit/publish/admin.rb
ruby_rabbitmq_janus-1.2.4 lib/rrj/rabbit/publish/admin.rb