Skip to content

Commit 3287d11

Browse files
Expose locales, authentication mechanisms & extra capabilities broker supports in the public API
1 parent ba36f90 commit 3287d11

File tree

1 file changed

+24
-5
lines changed

1 file changed

+24
-5
lines changed

lib/amq/client/adapter.rb

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,31 @@ def self.included(host)
4747
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.2.1)
4848
attr_accessor :client_properties
4949

50-
# Server capabilities
50+
# Server properties
5151
#
5252
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
5353
attr_reader :server_properties
5454

55+
# Server capabilities
56+
#
57+
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
58+
attr_reader :server_capabilities
59+
60+
# Locales server supports
61+
#
62+
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.3)
63+
attr_reader :server_locales
64+
5565
# Authentication mechanism used.
5666
#
5767
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.2)
5868
attr_reader :mechanism
5969

70+
# Authentication mechanisms broker supports.
71+
#
72+
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.2)
73+
attr_reader :server_authentication_mechanisms
74+
6075
# Channels within this connection.
6176
#
6277
# @see http://bit.ly/hw2ELX AMQP 0.9.1 specification (Section 2.2.5)
@@ -386,7 +401,11 @@ def on_error(&block)
386401
# @api plugin
387402
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.1.)
388403
def handle_start(connection_start)
389-
@server_properties = connection_start.server_properties
404+
@server_properties = connection_start.server_properties.dup.freeze
405+
@server_capabilities = @server_properties["capabilities"].dup.freeze
406+
407+
@server_authentication_mechanisms = connection_start.mechanisms.split(" ").freeze
408+
@server_locales = Array(connection_start.locales).freeze
390409

391410
username = @settings[:user] || @settings[:username]
392411
password = @settings[:pass] || @settings[:password]
@@ -405,8 +424,8 @@ def handle_start(connection_start)
405424
# @api plugin
406425
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.6)
407426
def handle_tune(tune_ok)
408-
@channel_max = tune_ok.channel_max
409-
@frame_max = tune_ok.frame_max
427+
@channel_max = tune_ok.channel_max.freeze
428+
@frame_max = tune_ok.frame_max.freeze
410429
@heartbeat_interval = self.heartbeat_interval || tune_ok.heartbeat
411430

412431
self.send_frame(Protocol::Connection::TuneOk.encode(@channel_max, [settings[:frame_max], @frame_max].min, @heartbeat_interval))
@@ -418,7 +437,7 @@ def handle_tune(tune_ok)
418437
# @api plugin
419438
# @see http://bit.ly/htCzCX AMQP 0.9.1 protocol documentation (Section 1.4.2.8.)
420439
def handle_open_ok(open_ok)
421-
@known_hosts = open_ok.known_hosts
440+
@known_hosts = open_ok.known_hosts.dup.freeze
422441

423442
opened!
424443
self.connection_successful if self.respond_to?(:connection_successful)

0 commit comments

Comments
 (0)