class RubyRabbitmqJanus::Rabbit::Publisher::Admin

@author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv> This publisher send and read an message in admin queues

Public Class Methods

new(exchange) click to toggle source

Initialize an queue non eclusive for admin/monitor API with Janus

@param [String] exchange Exchange used for the transaction

Calls superclass method
# File lib/rrj/rabbit/publisher/admin.rb, line 14
def initialize(exchange)
  @reply = exchange.queue(Tools::Config.instance.queue_admin_from)
  super(exchange)
  subscribe_to_queue
end

Public Instance Methods

publish(request) click to toggle source

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
# File lib/rrj/rabbit/publisher/admin.rb, line 27
def publish(request)
  @message = request
  @exchange.publish(@message.to_json,
                    request.options.merge!(reply_to: reply.name))
  return_response
end