Class Qpid::Messaging::Connection
In: lib/qpid_messaging/connection.rb
Parent: Object

Establishes a connection to a remote endpoint.

Methods

Public Class methods

Creates a connection object, but does not actually connect to the specified location.

Options

  :url - the URL for the broker (def. +"localhost"+)
  :options - connection options (def. +{}+)

Controlling Reconnect Behavior

The following connection options can be used to configure the reconnection behavior for this connection.

  • :username
  • :password
  • :heartbeat
  • :tcp_nodelay
  • :sasl_mechanism
  • :sasl_service
  • :sasl_min_ssf
  • :sasl_max_ssf
  • :transport
  • :reconnect - true or false; indicates wehtehr to attempt reconnections
  • :reconnect_timeout - the number of seconds to attempt reconnecting
  • :reconnect_limit - the number of retries before reporting failure
  • :reconnect_interval_min - initial delay, in seconds, before attempting a reconnection
  • :reconnect_interval_max - number of seconds to wait before additional reconnect attempts
  • :reconnect_interval - shorthand for setting both min and max values
  • :reconnect_urls - a list of alternate URLs to use for reconnection attempts

Examples

  conn = Qpid::Messaging::Connnection.new
  conn = Qpid::Messaging::Connection.new :url => "amqp:tcp:broker1.domain.com:5672"
  conn = Qpid::Messaging::Connection.new :options => {:username => "login", :password => "password"}

Public Instance methods

Returns the username used to authenticate with the connection.

Closes the connection.

Creates a new session.

Arguments

  • :name - specifies the name for this session
  • :transactional - if true then a creates a transaction session (def. false)

Examples

  session = conn.create_session :name => "session1"
  session = conn.create_session :transaction => true

Establishes the connection.

Examples

  conn.open unless conn.open?

Reports whether the connection is open.

Examples

  conn.close if conn.open?

Returns a session for the specified session name.

Examples

  begin
    session = conn.session "mysession"
  rescue SessionNameException => error
     puts "No such session."
  end

[Validate]