Class Stomp::Connection
In: lib/stomp/connection.rb
Parent: Object

Low level connection which maps commands and supports synchronous receives

Methods

Attributes

connection_frame  [R] 
disconnect_receipt  [R] 

Public Class methods

A new Connection object accepts the following parameters:

  login             (String,  default : '')
  passcode          (String,  default : '')
  host              (String,  default : 'localhost')
  port              (Integer, default : 61613)
  reliable          (Boolean, default : false)
  reconnect_delay   (Integer, default : 5)

  e.g. c = Connection.new("username", "password", "localhost", 61613, true)

Hash:

  hash = {
    :hosts => [
      {:login => "login1", :passcode => "passcode1", :host => "localhost", :port => 61616, :ssl => false},
      {:login => "login2", :passcode => "passcode2", :host => "remotehost", :port => 61617, :ssl => false}
    ],
    :initial_reconnect_delay => 0.01,
    :max_reconnect_delay => 30.0,
    :use_exponential_back_off => true,
    :back_off_multiplier => 2,
    :max_reconnect_attempts => 0,
    :randomize => false,
    :backup => false,
    :timeout => -1,
    :connect_headers => {},
    :parse_timeout => 5,
  }

  e.g. c = Connection.new(hash)

TODO Stomp URL :

  A Stomp URL must begin with 'stomp://' and can be in one of the following forms:

  stomp://host:port
  stomp://host.domain.tld:port
  stomp://user:pass@host:port
  stomp://user:pass@host.domain.tld:port

Public Instance methods

Receive a frame, block until the frame is received

Abort a transaction by name

Acknowledge a message, used when a subscription has specified client acknowledgement ( connection.subscribe "/queue/a", :ack => ‘client‘g

Accepts a transaction header ( :transaction => ‘some_transaction_id’ )

Begin a transaction, requires a name for the transaction

Is this connection closed?

Commit a transaction by name

Close this connection

Is this connection open?

Return a pending message if one is available, otherwise return nil

Publish message to destination

To disable content length header ( :suppress_content_length => true ) Accepts a transaction header ( :transaction => ‘some_transaction_id’ )

Subscribe to a destination, must specify a name

Send a message back to the source or to the dead letter queue

Accepts a dead letter queue option ( :dead_letter_queue => "/queue/DLQ" ) Accepts a limit number of redeliveries option ( :max_redeliveries => 6 ) Accepts a force client acknowledgement option (:force_client_ack => true)

Unsubscribe from a destination, must specify a name

[Validate]