Sha256: 2d589f7e5d4c25c6aafbe6f4b0f294e36cff45300f1f64eaf3fa0f8964e3cba2

Contents?: true

Size: 1.07 KB

Versions: 23

Compression:

Stored size: 1.07 KB

Contents

# -*- encoding: utf-8 -*-

#
# Common Stomp 1.1 code.
#
require "rubygems" if RUBY_VERSION < "1.9"
require "stomp"
#
module Stomp11Common
  # User id
  def login()
    ENV['STOMP_USER'] || 'guest'
  end
  # Password
  def passcode()
    ENV['STOMP_PASSCODE'] || 'guest'
  end
  # Server host
  def host()
    ENV['STOMP_HOST'] || "localhost" # The connect host name
  end
  # Server port
  def port()
    (ENV['STOMP_PORT'] || 62613).to_i # !! The author runs Apollo listening here
  end
  # Required vhost name
  def virt_host()
    ENV['STOMP_VHOST'] || "localhost" # The 1.1 virtual host name
  end
  # Create a 1.1 commection
  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

  # Number of messages
  def nmsgs()
    (ENV['STOMP_NMSGS'] || 1).to_i # Number of messages
  end
end

Version data entries

23 entries across 21 versions & 2 rubygems

Version Path
stomp-1.3.5 examples/stomp11_common.rb
stomp-1.3.4 examples/stomp11_common.rb
stomp-1.3.3 examples/stomp11_common.rb
stomp-1.3.2 examples/stomp11_common.rb
stomp-1.3.1 examples/stomp11_common.rb
stomp-1.3.0 examples/stomp11_common.rb
stomp-1.2.16 examples/stomp11_common.rb
stomp-1.2.14 examples/stomp11_common.rb
stomp-1.2.13 examples/stomp11_common.rb
stomp-1.2.12 examples/stomp11_common.rb
torquebox-console-0.3.0 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/stomp11_common.rb
stomp-1.2.11 examples/stomp11_common.rb
stomp-1.2.10 examples/stomp11_common.rb
torquebox-console-0.2.5 vendor/bundle/ruby/1.8/gems/stomp-1.2.8/examples/stomp11_common.rb
torquebox-console-0.2.5 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/stomp11_common.rb
stomp-1.2.9 examples/stomp11_common.rb
torquebox-console-0.2.4 vendor/bundle/ruby/1.8/gems/stomp-1.2.8/examples/stomp11_common.rb
torquebox-console-0.2.4 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/stomp11_common.rb
torquebox-console-0.2.3 vendor/bundle/jruby/1.9/gems/stomp-1.2.8/examples/stomp11_common.rb
stomp-1.2.8 examples/stomp11_common.rb