Permalink
Browse files

Add Ruby example. Depends on support for connect_headers.

  • Loading branch information...
1 parent 9d7cd56 commit 8986303e05c7c97e04ff87cea48fd4ab647e5cb8 @tonyg tonyg committed Feb 3, 2009
Showing with 13 additions and 0 deletions.
  1. +13 −0 examples/ruby/cb-slow-receiver.rb
@@ -0,0 +1,13 @@
+require 'rubygems'
+require 'stomp'
+
+# Note: requires support for connect_headers hash in the STOMP gem's connection.rb
+conn = Stomp::Connection.open('guest', 'guest', 'localhost', 61613, false, 5, {:prefetch => 1})
+conn.subscribe('carl', {:ack => 'client'})
+while mesg = conn.receive
+ puts mesg.body
+ puts 'Sleeping...'
+ sleep 0.2
+ puts 'Awake again. Acking.'
+ conn.ack mesg.headers['message-id']
+end

0 comments on commit 8986303

Please sign in to comment.