Class: RubyRabbitmqJanus::Janus::Transactions::Admin
- Inherits:
-
Session
- Object
- Transaction
- Session
- RubyRabbitmqJanus::Janus::Transactions::Admin
- Defined in:
- lib/rrj/janus/transactions/admin.rb
Overview
This class work with janus and send a series of message
Instance Method Summary collapse
-
#connect ⇒ Object
Begin connection with RabbitMQ.
-
#initialize(session) ⇒ Admin
constructor
A new instance of Admin.
-
#publish_message(type, options = {}) ⇒ Object
Write a message in queue in RabbitMQ.
Constructor Details
#initialize(session) ⇒ Admin
Returns a new instance of Admin.
12 13 14 |
# File 'lib/rrj/janus/transactions/admin.rb', line 12 def initialize(session) super(true, session) end |
Instance Method Details
#connect ⇒ Object
Begin connection with RabbitMQ
17 18 19 20 21 22 |
# File 'lib/rrj/janus/transactions/admin.rb', line 17 def connect rabbit.transaction_short do @publisher = Rabbit::Publisher::Admin.new(rabbit.channel) yield end end |
#publish_message(type, options = {}) ⇒ Object
Write a message in queue in RabbitMQ
25 26 27 28 29 |
# File 'lib/rrj/janus/transactions/admin.rb', line 25 def (type, = {}) msg = Janus::Messages::Admin.new(type, .merge(opts2)) response = read_response(publisher.publish(msg)) Janus::Responses::Admin.new(response) end |