Sha256: 8cf5585925d1246e2f62a44c82f713443f18ccf1cc7e514fd8a7ae0b114418bb

Contents?: true

Size: 775 Bytes

Versions: 43

Compression:

Stored size: 775 Bytes

Contents

# frozen_string_literal: true

module RubyRabbitmqJanus
  module Rabbit
    module Publisher
      # Publisher to queue `janus-instance`
      class JanusInstance
        def initialize
          @rabbit = RubyRabbitmqJanus::Rabbit::Connect.new
        rescue
          raise Errors::Rabbit::Publisher::JanusInstance::Initialize
        end

        def publish(data)
          @rabbit.start
          channel = @rabbit.channel
          queue = channel.queue(Tools::Config.instance.queue_janus_instance)
          channel.default_exchange.publish(data.to_json,
                                           routing_key: queue.name)
          @rabbit.close
        rescue
          raise Errors::Rabbit::Publisher::JanusInstance::Publish
        end
      end
    end
  end
end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
ruby_rabbitmq_janus-2.7.2.pre.320 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.319 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.318 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.317 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.316 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.315 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.314 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.312 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.310 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.309 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.308 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.307 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.306 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.305 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.302 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.297 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.296 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.286 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.285 lib/rrj/rabbit/publisher/janus_instance.rb
ruby_rabbitmq_janus-2.7.2.pre.284 lib/rrj/rabbit/publisher/janus_instance.rb