Sha256: 24c081c39444564a163fd6b664ca9cb9f69aaea760a244fb00a08014a3cf9d25

Contents?: true

Size: 984 Bytes

Versions: 4

Compression:

Stored size: 984 Bytes

Contents

#
# Common Stomp 1.1 code.
#
require "rubygems" if RUBY_VERSION < "1.9"
require "stomp"
#
module Stomp11Common
  #
  def login()
    ENV['STOMP_USER'] || 'guest'
  end
  #
  def passcode()
    ENV['STOMP_PASSCODE'] || 'guest'
  end
  #
  def host()
    ENV['STOMP_HOST'] || "localhost" # The connect host name
  end
  #
  def port()
    (ENV['STOMP_PORT'] || 62613).to_i # !! The author runs Apollo listening here
  end
  #
  def virt_host()
        ENV['STOMP_VHOST'] || "localhost" # The 1.1 virtual host name
  end
  #
  def get_connection()
    conn_hdrs = {"accept-version" => "1.1",    # 1.1 only
          "host" => virt_host,                 # the vhost
        }
    conn_hash = { :hosts => [ 
          {:login => login, :passcode => passcode, :host => host, :port => port},
          ],
          :connect_headers => conn_hdrs,
        }
    conn = Stomp::Connection.new(conn_hash)
  end
  #
  def nmsgs()
    (ENV['STOMP_NMSGS'] || 1).to_i # Number of messages
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
stomp-1.2.3 examples/stomp11_common.rb
stomp-1.2.2 examples/stomp11_common.rb
stomp-1.2.1 examples/stomp11_common.rb
stomp-1.2.0 examples/stomp11_common.rb