Sha256: 88e980786095e5337b3eeb8e7839114165ff9b09de942e765ecf4bcf186166bd
Contents?: true
Size: 981 Bytes
Versions: 8
Compression:
Stored size: 981 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:61613") 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
8 entries across 8 versions & 1 rubygems