Class: RubyRabbitmqJanus::Janus::Transactions::Admin

Inherits:
Session show all
Defined in:
lib/rrj/janus/transactions/admin.rb

Overview

This class work with janus and send a series of message

Instance Method Summary collapse

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

#connectObject

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 publish_message(type, options = {})
  msg = Janus::Messages::Admin.new(type, options.merge(opts2))
  response = read_response(publisher.publish(msg))
  Janus::Responses::Admin.new(response)
end