Class: RubyRabbitmqJanus::Rabbit::Publisher::PublisherAdmin
- Inherits:
-
Publisher
- Object
- BasePublisher
- Publisher
- RubyRabbitmqJanus::Rabbit::Publisher::PublisherAdmin
- Defined in:
- lib/rrj/rabbit/publish/publisher_admin.rb
Overview
This publisher send and read an message in admin queues
Instance Attribute Summary
Attributes inherited from BasePublisher
Instance Method Summary collapse
-
#initialize(exchange) ⇒ PublisherAdmin
constructor
Intialize an queue non eclusive for admin/monitor API with Janus.
-
#publish(request) ⇒ Janus::Response::Admin
Send an message to queue and waiting a response.
Constructor Details
#initialize(exchange) ⇒ PublisherAdmin
Intialize an queue non eclusive for admin/monitor API with Janus
14 15 16 17 18 19 20 21 |
# File 'lib/rrj/rabbit/publish/publisher_admin.rb', line 14 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::PublisherAdmin::Initialize end |
Instance Method Details
#publish(request) ⇒ Janus::Response::Admin
Send an message to queue and waiting a response
29 30 31 32 33 34 35 36 |
# File 'lib/rrj/rabbit/publish/publisher_admin.rb', line 29 def publish(request) @message = request @exchange.publish(@message.to_json, request..merge!(reply_to: reply.name)) return_response rescue raise Errors::Rabbit::PublisherAdmin::Pusblish end |