Sha256: a26944dc9a356495694300d0afc2910d82e2f0798708e4b84842905b946363f4
Contents?: true
Size: 975 Bytes
Versions: 6
Compression:
Stored size: 975 Bytes
Contents
# -*- encoding: utf-8 -*- $:.unshift(File.expand_path('../../lib', __FILE__)) require 'onstomp' puts "Starting demo" puts "----------------------------" running = true client = OnStomp::Client.new("stomp://localhost") client.connect puts "Connected to broker using protocol #{client.connection.version}" client.subscribe("/queue/onstomp/test") do |message| puts "Received: '#{message.body}'" if message.body == 'finished' running = false end end client.send("/queue/onstomp/test", "hello world") client.send("/queue/onstomp/test", "this is a simple demo of onstomp") client.send("/queue/onstomp/test", "finished") Thread.pass while running client.disconnect puts "----------------------------" puts "End of demo" # Example output: # # # Starting demo # ---------------------------- # Connected to broker using protocol 1.0 # Received: hello world # Received: this is a simple demo of onstomp # Received: finished # ---------------------------- # End of demo
Version data entries
6 entries across 6 versions & 1 rubygems