| author | Tony Garnock-Jones <tonyg@lshift.net> |
| Tue Sep 09 13:36:11 2008 +0100 (2008-09-09) | |
| changeset 52 | 8972d204473a |
| child 237 | 1001ca6867cf |
| permissions | -rw-r--r-- |
1 require 'rubygems'
2 require 'stomp' # this is a gem
3 require 'uuidtools' # this is a gem
5 conn = Stomp::Connection.open('guest', 'guest', 'localhost')
6 subid = UUID.random_create.to_s
7 puts "Subscribing to #{subid}..."
8 conn.subscribe('', :id => subid, :exchange => 'amq.topic', :routing_key => "x.#")
9 puts 'Receiving...'
10 mesg = conn.receive
11 puts mesg.body
12 puts "Unsubscribing from #{subid}..."
13 conn.unsubscribe('', :id => subid)
14 puts 'Sleeping 5 seconds...'
15 sleep 5