Method: RabbitMQ::Client::Connection#initialize
- Defined in:
- lib/rabbitmq/client/connection.rb
#initialize(*args) ⇒ Connection
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Connection.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/rabbitmq/client/connection.rb', line 17 def initialize(*args) @ptr = FFI.amqp_new_connection @frame = FFI::Frame.new create_socket! info = Util.connection_info(*args) @options = { ssl: (info.fetch(:ssl) ? true : false), host: info.fetch(:host).to_s, port: Integer(info.fetch(:port)), user: info.fetch(:user).to_s, password: info.fetch(:password).to_s, vhost: info.fetch(:vhost).to_s, max_channels: Integer(info.fetch(:max_channels, FFI::CHANNEL_MAX_ID)), max_frame_size: Integer(info.fetch(:max_frame_size, 131072)), heartbeat_interval: 0, # not fully implemented in librabbitmq } @finalizer = self.class.create_finalizer_for(@ptr) ObjectSpace.define_finalizer(self, @finalizer) end |