def initialize(connection_string_or_opts = Hash.new, opts = Hash.new)
opts = case connection_string_or_opts
when String then
AMQ::Client::Settings.parse_amqp_url(connection_string_or_opts)
when Hash then
connection_string_or_opts
else
Hash.new
end.merge(opts)
@__opts__ = opts
@host = opts[:host] || 'localhost'
@user = opts[:user] || 'guest'
@pass = opts[:pass] || 'guest'
@vhost = opts[:vhost] || '/'
@logfile = opts[:logfile] || nil
@logging = opts[:logging] || false
@ssl = opts[:ssl] || false
@verify_ssl = opts[:verify_ssl].nil? || opts[:verify_ssl]
@status = :not_connected
@frame_max = opts[:frame_max] || 131072
@channel_max = opts[:channel_max] || 0
@heartbeat = opts[:heartbeat] || 0
@connect_timeout = opts[:connect_timeout] || CONNECT_TIMEOUT
@read_write_timeout = opts[:socket_timeout]
@read_write_timeout = nil if @read_write_timeout == 0
@disconnect_timeout = @read_write_timeout || @connect_timeout
@logger = nil
create_logger if @logging
@message_in = false
@message_out = false
@connecting = false
@channels ||= []
@channel = create_channel()
@exchanges ||= {}
@queues ||= {}
end