lib/amq/client/adapter.rb in amq-client-0.7.0.alpha32 vs lib/amq/client/adapter.rb in amq-client-0.7.0.alpha33
- old
+ new
@@ -45,20 +45,35 @@
# Client capabilities
#
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.2.1)
attr_accessor :client_properties
- # Server capabilities
+ # Server properties
#
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
attr_reader :server_properties
+ # Server capabilities
+ #
+ # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
+ attr_reader :server_capabilities
+
+ # Locales server supports
+ #
+ # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
+ attr_reader :server_locales
+
# Authentication mechanism used.
#
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.2)
attr_reader :mechanism
+ # Authentication mechanisms broker supports.
+ #
+ # @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.2)
+ attr_reader :server_authentication_mechanisms
+
# Channels within this connection.
#
# @see http://bit.ly/hw2ELX AMQP 0.9.1 specification (Section 2.2.5)
attr_reader :channels
@@ -384,12 +399,16 @@
# Handles connection.start.
#
# @api plugin
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.)
def handle_start(connection_start)
- @server_properties = connection_start.server_properties
+ @server_properties = connection_start.server_properties.dup.freeze
+ @server_capabilities = @server_properties["capabilities"].dup.freeze
+ @server_authentication_mechanisms = connection_start.mechanisms.split(" ").freeze
+ @server_locales = Array(connection_start.locales).freeze
+
username = @settings[:user] || @settings[:username]
password = @settings[:pass] || @settings[:password]
# It's not clear whether we should transition to :opening state here
# or in #open but in case authentication fails, it would be strange to have
@@ -403,12 +422,12 @@
# Handles Connection.Tune-Ok.
#
# @api plugin
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.6)
def handle_tune(tune_ok)
- @channel_max = tune_ok.channel_max
- @frame_max = tune_ok.frame_max
+ @channel_max = tune_ok.channel_max.freeze
+ @frame_max = tune_ok.frame_max.freeze
@heartbeat_interval = self.heartbeat_interval || tune_ok.heartbeat
self.send_frame(Protocol::Connection::TuneOk.encode(@channel_max, [settings[:frame_max], @frame_max].min, @heartbeat_interval))
end # handle_tune(method)
@@ -416,10 +435,10 @@
# Handles Connection.Open-Ok.
#
# @api plugin
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.8.)
def handle_open_ok(open_ok)
- @known_hosts = open_ok.known_hosts
+ @known_hosts = open_ok.known_hosts.dup.freeze
opened!
self.connection_successful if self.respond_to?(:connection_successful)
end