lib/amqp/session.rb in amqp-1.1.8 vs lib/amqp/session.rb in amqp-1.2.0

- old
+ new

@@ -146,29 +146,10 @@ # Turns loggin on or off. def logging=(boolean) settings[:logging] = boolean end - - # Establishes connection to AMQ broker and returns it. New connection object is yielded to - # the block if it is given. - # - # @example Specifying adapter via the :adapter option - # AMQP::Adapter.connect(:adapter => "socket") - # @example Specifying using custom adapter class - # AMQP::SocketClient.connect - # @param [Hash] Connection parameters, including :adapter to use. - # @api public - def connect(settings = nil, &block) - @settings = Settings.configure(settings) - - instance = self.new - instance.establish_connection(settings) - instance.register_connection_callback(&block) - - instance - end end # @group Connecting, reconnecting, disconnecting @@ -531,19 +512,10 @@ block.call(self) end end end - - - # For EventMachine adapter, this is a no-op. - # @api public - def establish_connection(settings) - # Unfortunately there doesn't seem to be any sane way - # how to get EventMachine connect to the instance level. - end - alias close disconnect # Whether we are in authentication state (after TCP connection was estabilished @@ -1054,9 +1026,15 @@ # # @api plugin # @see http://bit.ly/amqp091reference AMQP 0.9.1 protocol reference (Section 1.5.2.9) def handle_close(conn_close) closed! + # getting connection.close during connection negotiation means authentication + # has failed (RabbitMQ 3.2+): + # http://www.rabbitmq.com/auth-notification.html + if authenticating? + @on_possible_authentication_failure.call(@settings) if @on_possible_authentication_failure + end self.exec_callback_yielding_self(:error, conn_close) end # Handles Connection.Close-Ok.