Sha256: 093124ebf1983927fb892c045e686b30e71a312d79f7f06fb222449236199c71

Contents?: true

Size: 722 Bytes

Versions: 1

Compression:

Stored size: 722 Bytes

Contents

require 'bunny'
require 'singleton'

module Rack
  module AMQP
    module Client

      def self.with_client(*args, &block)
        yield client(*args)
      end

      def self.client(*args)
        Synchronizer.instance.client(*args)
      end

      class Synchronizer
        include Singleton
        def initialize
          @mutex = Mutex.new
          super
        end

        def client(*args)
          @mutex.synchronize do # TODO this probably doesn't help anything here
            @mgr ||= Manager.new(*args)
          end
        end
      end

    end
  end
end

require "rack/amqp/client/request"
require "rack/amqp/client/response"
require "rack/amqp/client/manager"
require "rack/amqp/client/version"

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-amqp-client-0.0.2 lib/rack/amqp/client.rb