Sha256: ddaccd57ed99043af6855efc7cd1b4bf0e15d6a71afebc10b4b3ffef400cd1f4

Contents?: true

Size: 1.62 KB

Versions: 53

Compression:

Stored size: 1.62 KB

Contents

# encoding: utf-8

module AMQP
  # A utility class that makes inspection of broker capabilities easier.
  class Broker

    #
    # API
    #

    RABBITMQ_PRODUCT = "RabbitMQ".freeze

    # Broker information
    # @return [Hash]
    # @see Session#server_properties
    attr_reader :properties

    # @return [Hash] properties Broker information
    # @see Session#server_properties
    def initialize(properties)
      @properties = properties
    end # initialize(properties)

    # @group Product information

    # @return [Boolean] true if broker is RabbitMQ
    def rabbitmq?
      self.product == RABBITMQ_PRODUCT
    end # rabbitmq?

    # @return [String] Broker product information
    def product
      @product ||= @properties["product"]
    end # product

    # @return [String] Broker version
    def version
      @version ||= @properties["version"]
    end # version

    # @endgroup



    # @group Product capabilities

    # @return [Boolean]
    def supports_publisher_confirmations?
      @properties["capabilities"]["publisher_confirms"]
    end # supports_publisher_confirmations?

    # @return [Boolean]
    def supports_basic_nack?
      @properties["capabilities"]["basic.nack"]
    end # supports_basic_nack?

    # @return [Boolean]
    def supports_consumer_cancel_notifications?
      @properties["capabilities"]["consumer_cancel_notify"]
    end # supports_consumer_cancel_notifications?

    # @return [Boolean]
    def supports_exchange_to_exchange_bindings?
      @properties["capabilities"]["exchange_exchange_bindings"]
    end # supports_exchange_to_exchange_bindings?


    # @endgroup


  end # Broker
end # AMQP

Version data entries

53 entries across 53 versions & 1 rubygems

Version Path
amqp-1.8.0 lib/amqp/broker.rb
amqp-1.7.0 lib/amqp/broker.rb
amqp-1.6.0 lib/amqp/broker.rb
amqp-1.5.3 lib/amqp/broker.rb
amqp-1.5.2 lib/amqp/broker.rb
amqp-1.5.1 lib/amqp/broker.rb
amqp-1.5.0 lib/amqp/broker.rb
amqp-1.4.2 lib/amqp/broker.rb
amqp-1.4.1 lib/amqp/broker.rb
amqp-1.4.0 lib/amqp/broker.rb
amqp-1.3.0 lib/amqp/broker.rb
amqp-1.2.1 lib/amqp/broker.rb
amqp-1.2.0 lib/amqp/broker.rb
amqp-1.1.8 lib/amqp/broker.rb
amqp-1.1.7 lib/amqp/broker.rb
amqp-1.1.6 lib/amqp/broker.rb
amqp-1.1.5 lib/amqp/broker.rb
amqp-1.1.4 lib/amqp/broker.rb
amqp-1.1.3 lib/amqp/broker.rb
amqp-1.0.4 lib/amqp/broker.rb