Sha256: 0515b0e6714ad2147ba0e90c96ff604b39d54c58423ea1e3505f75c31e1cbcf5
Contents?: true
Size: 1.38 KB
Versions: 36
Compression:
Stored size: 1.38 KB
Contents
# frozen_string_literal: true module RubyRabbitmqJanus module Janus module Transactions # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv> # This class work with janus and send a series of message class Admin < Session def initialize(session) super(true, session) rescue raise Errors::Janus::TransactionAdmin::Initialize end # Begin connection with RabbitMQ def connect rabbit.transaction_short do @publisher = Rabbit::Publisher::PublisherAdmin.new(rabbit.channel) yield end rescue raise Errors::Janus::TransactionAdmin::Connect end # Write a message in queue in RabbitMQ def publish_message(type, options = {}) msg = Janus::Messages::Admin.new(type, opts.merge(options)) response = read_response(publisher.publish(msg)) Janus::Responses::Admin.new(response) rescue raise Errors::Janus::TransactionAdmin::PublishMessage end private def send_a_message Janus::Responses::Admin.new(publisher.publish(yield)) end def admin_secret Tools::Config.instance.options['rabbit']['admin_pass'] end def opts { 'session_id' => session, 'admin_secret' => admin_secret } end end end end end
Version data entries
36 entries across 36 versions & 1 rubygems