Class: AMQP::Broker

Inherits:
Object
  • Object
show all
Defined in:
lib/amqp/broker.rb

Overview

A utility class that makes inspection of broker capabilities easier.

Constant Summary collapse

RABBITMQ_PRODUCT =

API

"RabbitMQ".freeze

Instance Attribute Summary collapse

Product information collapse

Product capabilities collapse

Instance Method Summary collapse

Constructor Details

#initialize(properties) ⇒ Hash

Returns properties Broker information.



20
21
22
# File 'lib/amqp/broker.rb', line 20

def initialize(properties)
  @properties = properties
end

Instance Attribute Details

#propertiesHash (readonly)

Broker information

Returns:

  • (Hash)

See Also:



16
17
18
# File 'lib/amqp/broker.rb', line 16

def properties
  @properties
end

Instance Method Details

#productString

Returns Broker product information.

Returns:

  • (String)

    Broker product information



32
33
34
# File 'lib/amqp/broker.rb', line 32

def product
  @product ||= @properties["product"]
end

#rabbitmq?Boolean

Returns true if broker is RabbitMQ.

Returns:

  • (Boolean)

    true if broker is RabbitMQ



27
28
29
# File 'lib/amqp/broker.rb', line 27

def rabbitmq?
  self.product == RABBITMQ_PRODUCT
end

#supports_basic_nack?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/amqp/broker.rb', line 53

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

#supports_consumer_cancel_notifications?Boolean

Returns:

  • (Boolean)


58
59
60
# File 'lib/amqp/broker.rb', line 58

def supports_consumer_cancel_notifications?
  @properties["capabilities"]["consumer_cancel_notify"]
end

#supports_exchange_to_exchange_bindings?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/amqp/broker.rb', line 63

def supports_exchange_to_exchange_bindings?
  @properties["capabilities"]["exchange_exchange_bindings"]
end

#supports_publisher_confirmations?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/amqp/broker.rb', line 48

def supports_publisher_confirmations?
  @properties["capabilities"]["publisher_confirms"]
end

#versionString

Returns Broker version.

Returns:

  • (String)

    Broker version



37
38
39
# File 'lib/amqp/broker.rb', line 37

def version
  @version ||= @properties["version"]
end