Class: RubyRabbitmqJanus::Rabbit::Publisher::Publisher
- Inherits:
-
BasePublisher
- Object
- BasePublisher
- RubyRabbitmqJanus::Rabbit::Publisher::Publisher
- Defined in:
- lib/rrj/rabbit/publish/publisher.rb
Overview
This publisher send and read an message in queues
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BasePublisher
Instance Method Summary collapse
-
#initialize(exchange) ⇒ Publisher
constructor
Intialize a publisher for sending and reading a message.
-
#publish(request) ⇒ Object
Publish an message in queue.
Constructor Details
#initialize(exchange) ⇒ Publisher
Intialize a publisher for sending and reading a message
16 17 18 19 20 21 22 |
# File 'lib/rrj/rabbit/publish/publisher.rb', line 16 def initialize(exchange) super() @exchange = exchange.default_exchange = nil rescue raise Errors::Rabbit::Publish::Initialize end |
Instance Method Details
#publish(request) ⇒ Object
Publish an message in queue
30 31 32 33 34 35 36 |
# File 'lib/rrj/rabbit/publish/publisher.rb', line 30 def publish(request) = request @exchange.publish(.to_json, request..merge!(reply_to: reply.name)) rescue raise Errors::Rabbit::Publish::Publish end |