Sha256: aed1335d384ea928936a5afa8214c6e1cd5d9cda0c1b6caf023ce1860ffe2215

Contents?: true

Size: 1 KB

Versions: 4

Compression:

Stored size: 1 KB

Contents

#
# The current require dance for different Ruby versions.
# Change this to suit your requirements.
#
if Kernel.respond_to?(:require_relative)
  require_relative("./stomp11_common")
else
  $LOAD_PATH << File.dirname(__FILE__)
  require "stomp11_common"
end
include Stomp11Common
#
# Stomp 1.1 Publish Example
# =========================
#
# Purpose: to demonstrate sending messages using Stomp 1.1.
#
conn = get_connection() # Use helper method to obtain a Stomp#connection
raise "Unexpected protocol level" if conn.protocol != Stomp::SPL_11
#
# Publishing simple data is as it was with Stomp 1.0.
#
# Note: Stomp 1.1 brokers seem to prefer using '.' as delimiters in queue
# name spaces. Hence, the queue name used here.
#
qname = "/queue/nodea.nodeb.nodec"
data = "message payload"
headers = {}
#
# The 'data' and 'headers' may be omitted, as with Stomp 1.0
#
1.upto(nmsgs()) do |i|
  msg = "#{data}: #{i}"
  conn.publish qname, msg , headers
  puts "Sent data: #{msg}"
end
#
# And finally, disconnect.
#
conn.disconnect



Version data entries

4 entries across 4 versions & 1 rubygems

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