rod mclaughlinRuby Asynchronous Messaging (05 jul 10)
'Distributed Programming With Ruby' by Mark Bates, Addison Wesley 2010. It took me a while to get the examples in the book working Along with the book, I got a free online version at http://informit.com/safarifree - it doesn't let you copy and paste from it (at least on Firefox 3 under Linux) - so it was no use to me If you make a mistake in the URL, for example putting a semicolon instead of a colon before the port, you get this helpful error message /usr/lib64/ruby/gems/1.8/gems/starling-0.10.1/lib/starling.rb:138:in `get_server_for_key': No servers available (all dead) (MemCache::MemCacheError) and I had some issues getting distributed Ruby to run on more than one machine, however I quickly found two solutions by posting on the Google group for Starling: http://groups.google.com/group/starlingmq/browse_thread/thread/700a6264eb9096b4 It enables fast reliable simple distributed systems without the overhead of Ruby on Rails if you don't need it: # client_and_server.rb require 'rubygems' require 'starling'
QUE = 'my_queue'
starling = Starling.new URL 10.times do |i| starling.set QUE, i.to_s sleep 0.5 exit if i == 9 end else starling = Starling.new URL 11.times do |i| sleep 0.5 puts starling.get QUE puts `ps auxw | grep client_and_server | grep -v grep` if i == 5 exit if i == 9 end end Back
|