Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge pull request #1 from jmettraux/master

integrated Kenneth's fix
  • Loading branch information...
commit 03a8506bd3b44392fc4f1edaee7d71c2b91122dd 2 parents 0c225e3 + 14dc51d
Hartog C. de Mik authored
View
28 README.rdoc
@@ -3,24 +3,34 @@
This is a personal investigation into all-of-the-above. Now that it
somewhat done, it can serve as an example for others.
+== If it doesn't work
+
+a) try to fix it by yourself and then notify us (or send a pull request)
+b) complain on the ruote mailing list (http://groups.google.com/group/openwferu-users)
+or
+c) complain in the ruote IRC channel (freenode.net #ruote)
+
== Lessons learned
* ruote is fairly complete, but the documentation isn't. Reading
carefully through the available resources (google-groups, and other
- mailing lists) can be very usefull.
+ mailing lists) can be very useful.
* ruote-amqp needs lot's more documentation
* ruote-amqp set's a default queue for listening on the receiver but
fails (for me anyway) to set a default reply_queue for participants
== Prerequisites
-[ruote] For the ping-pong-engine
-[ruote-amqp] For the sake of the investigation ;-)
-[daemon-kit] For ping and pong
[rabbitmq] Or another AMQP enabled Message Queue system
[bundler] The ping-pong-engine is set-up using this great piece of
software
+[ruote] For the ping-pong-engine
+[ruote-amqp] For the sake of the investigation ;-)
+[daemon-kit] For ping and pong
+
+(those 3 last are drawn thanks to bundler anyway)
+
== Installing, etc.
You're on your own... But reading up on the prerequisites should give
@@ -29,18 +39,17 @@ you all the info you need
== Running the demo
# start the ping daemon
- % chdir ping
+ % cd ping
% bin/ping
# now start the pong daemon
- % chdir ../pong
+ % cd ../pong
% bin/pong
# and now, let's play a match
- % chdir ../ping-pong-engine
+ % cd ../ping-pong-engine
% ruby lib/main.rb
-
== Parts
[ping-pong-enginge/] The engine. It sets up a process-definition and a
@@ -64,4 +73,5 @@ A lot of information and knowledge came from studying these projects:
The setup of this project is largely similar to that of meego-boss.
The ruote-rails-example gave an understanding in connecting all the
-pieces as I tried to get it to work
+pieces as I tried to get it to work.
+
View
16 ping-pong-engine/Gemfile
@@ -1,9 +1,11 @@
-source "http://rubygems.org"
-gem 'daemon-kit'
-gem 'amqp', :git =>"git://github.com/tmm1/amqp.git"
-gem 'ruote', :git => 'git://github.com/jmettraux/ruote.git', :branch => 'ruote2.1'
-gem 'ruote-amqp', :git => "git://github.com/kennethkalmer/ruote-amqp.git", :branch => 'ruote2.1'
+
+source 'http://rubygems.org'
+
gem 'rspec'
-gem 'eventmachine'
+
gem 'json'
-gem 'yajl-ruby'
+gem 'yajl-ruby'
+gem 'daemon-kit'
+gem 'ruote', :git => 'git://github.com/jmettraux/ruote.git'
+gem 'ruote-amqp', :git => 'git://github.com/kennethkalmer/ruote-amqp.git'
+
View
71 ping-pong-engine/Gemfile.lock
@@ -1,60 +1,69 @@
GIT
remote: git://github.com/jmettraux/ruote.git
- revision: 449210698d79cb906a96c84c117974c5cb988394
- branch: ruote2.1
+ revision: 5dd2be206313ed56463b2a16ff869f45fabff460
specs:
- ruote (2.1.11)
- rufus-cloche (>= 0.1.20)
- rufus-dollar
- rufus-json (>= 0.2.5)
+ ruote (2.2.1)
+ parslet (= 1.2.0)
+ rufus-cloche (>= 1.0.1)
+ rufus-dollar (>= 1.0.4)
+ rufus-json (>= 1.0.0)
rufus-mnemo (>= 1.1.0)
- rufus-scheduler (>= 2.0.5)
- rufus-treechecker (>= 1.0.3)
+ rufus-scheduler (>= 2.0.9)
+ rufus-treechecker (>= 1.0.6)
+ sourcify (= 0.5.0)
GIT
remote: git://github.com/kennethkalmer/ruote-amqp.git
- revision: 1ae324c661ca8608ac8ace7b3eb140079f20d5e6
- branch: ruote2.1
+ revision: 4ebaa27934a3181a5899cb035b60821bdc959d47
specs:
- ruote-amqp (2.1.10)
- amqp (>= 0.6.7)
- ruote (>= 2.1.10)
-
-GIT
- remote: git://github.com/tmm1/amqp.git
- revision: 8c757c364108b0fe0ae1b332bad28f741176fa00
- specs:
- amqp (0.6.7)
- eventmachine (>= 0.12.4)
+ ruote-amqp (2.2.0)
+ amqp (= 0.7.0)
+ ruote (>= 2.2.0)
GEM
remote: http://rubygems.org/
specs:
+ amqp (0.7.0)
+ eventmachine (>= 0.12.4)
+ blankslate (2.1.2.4)
daemon-kit (0.1.8.1)
eventmachine (>= 0.12.10)
eventmachine (0.12.10)
+ file-tail (1.0.5)
+ spruz (>= 0.1.0)
json (1.2.3)
+ parslet (1.2.0)
+ blankslate (~> 2.0)
rspec (1.3.0)
- ruby_parser (2.0.5)
+ ruby2ruby (1.2.5)
+ ruby_parser (~> 2.0)
+ sexp_processor (~> 3.0)
+ ruby_parser (2.0.6)
sexp_processor (~> 3.0)
- rufus-cloche (0.1.20)
- rufus-json (>= 0.2.5)
- rufus-dollar (1.0.2)
- rufus-json (0.2.5)
- rufus-mnemo (1.1.1)
- rufus-scheduler (2.0.6)
- rufus-treechecker (1.0.3)
- ruby_parser
+ rufus-cloche (1.0.1)
+ rufus-json (>= 0.2.7)
+ rufus-dollar (1.0.4)
+ rufus-json (1.0.0)
+ rufus-mnemo (1.2.0)
+ rufus-scheduler (2.0.9)
+ tzinfo (>= 0.3.23)
+ rufus-treechecker (1.0.6)
+ ruby_parser (>= 2.0.5)
sexp_processor (3.0.5)
+ sourcify (0.5.0)
+ file-tail (>= 1.0.5)
+ ruby2ruby (>= 1.2.5)
+ ruby_parser (>= 2.0.5)
+ sexp_processor (>= 3.0.5)
+ spruz (0.2.7)
+ tzinfo (0.3.27)
yajl-ruby (0.7.7)
PLATFORMS
ruby
DEPENDENCIES
- amqp!
daemon-kit
- eventmachine
json
rspec
ruote!
View
22 ping-pong-engine/lib/main.rb
@@ -1,6 +1,7 @@
require 'rubygems'
require 'bundler'
Bundler.setup
+require 'json'
require 'ruote'
require 'ruote/storage/fs_storage'
require 'ruote-amqp'
@@ -12,6 +13,12 @@
)
)
+# let's start from zero
+engine.storage.clear
+
+# uncomment for lots of noisy information
+#engine.noisy = true
+
# Configure AMQP
{ :host => 'localhost',
:vhost => 'ruote',
@@ -21,23 +28,23 @@
AMQP.settings[k]=v
}
-# uncomment for lots of usefull information
-# AMQP.logging = true
+# uncomment for lots of useful information
+#AMQP.logging = true
# listen to the ruote_workitems queue for return-messages
-receiver = RuoteAMQP::Receiver.new(
+RuoteAMQP::Receiver.new(
engine,
:launchitems => false
)
# register ping and pong as participants to the game
-engine.register_participant :ping, RuoteAMQP::Participant, :queue => "ping"
-engine.register_participant :pong, RuoteAMQP::Participant, :queue => "pong"
+engine.register_participant :ping, RuoteAMQP::ParticipantProxy, :queue => "ping"
+engine.register_participant :pong, RuoteAMQP::ParticipantProxy, :queue => "pong"
# we need a crowd as well
engine.register_participant :logger do |workitem|
- $stderr.puts "State: #{workitem.fields['state']}"
- $stderr.puts "Count: #{workitem.fields['count']}"
+ STDERR.puts "State: #{workitem.fields['state']}"
+ STDERR.puts "Count: #{workitem.fields['count']}"
end
# and we need some one to initiate the game
@@ -88,3 +95,4 @@
puts "process #{err.wfid}"
end
end
+
View
14 ping/Gemfile
@@ -1,14 +1,8 @@
-# If you need to 'vendor your gems' for deploying your daemons, bundler is a
-# great option. Update this Gemfile with any additional dependencies and run
-# 'bundle install' to get them all installed. Daemon-kit's capistrano
-# deployment will ensure that the bundle required by your daemon is properly
-# installed.
-source :gemcutter
+source 'http://rubygems.org'
-# daemon-kit
+gem 'safely'
gem 'daemon-kit'
-
-# For more information on bundler, please visit http://gembundler.com
-gem 'amqp' # Only needed if running the AMQP participant/listener pair
+gem 'amqp', '0.7.1'
gem 'json' # Can be replaced with json_pure
+
View
10 ping/Gemfile.lock
@@ -1,17 +1,19 @@
GEM
remote: http://rubygems.org/
specs:
- amqp (0.6.7)
+ amqp (0.7.1)
eventmachine (>= 0.12.4)
- daemon-kit (0.1.8.1)
+ daemon-kit (0.1.8.2)
eventmachine (>= 0.12.10)
eventmachine (0.12.10)
- json (1.2.3)
+ json (1.5.1)
+ safely (0.3.0)
PLATFORMS
ruby
DEPENDENCIES
- amqp
+ amqp (= 0.7.1)
daemon-kit
json
+ safely
View
2  ping/bin/ping
@@ -5,4 +5,6 @@
require File.expand_path('../../config/environment', __FILE__)
+#AMQP.logging = true
+
DaemonKit::Application.exec( DAEMON_ROOT + '/libexec/ping-daemon.rb' )
View
0  ping/lib/sample.rb
No changes.
View
14 pong/Gemfile
@@ -1,14 +1,8 @@
-# If you need to 'vendor your gems' for deploying your daemons, bundler is a
-# great option. Update this Gemfile with any additional dependencies and run
-# 'bundle install' to get them all installed. Daemon-kit's capistrano
-# deployment will ensure that the bundle required by your daemon is properly
-# installed.
-source :gemcutter
+source 'http://rubygems.org'
-# daemon-kit
gem 'daemon-kit'
-
-# For more information on bundler, please visit http://gembundler.com
-gem 'amqp' # Only needed if running the AMQP participant/listener pair
+gem 'safely'
+gem 'amqp', '0.7.1'
gem 'json' # Can be replaced with json_pure
+
View
10 pong/Gemfile.lock
@@ -1,17 +1,19 @@
GEM
remote: http://rubygems.org/
specs:
- amqp (0.6.7)
+ amqp (0.7.1)
eventmachine (>= 0.12.4)
- daemon-kit (0.1.8.1)
+ daemon-kit (0.1.8.2)
eventmachine (>= 0.12.10)
eventmachine (0.12.10)
- json (1.2.3)
+ json (1.5.1)
+ safely (0.3.0)
PLATFORMS
ruby
DEPENDENCIES
- amqp
+ amqp (= 0.7.1)
daemon-kit
json
+ safely
View
1  pong/lib/sample.rb
@@ -1 +0,0 @@
-
Please sign in to comment.
Something went wrong with that request. Please try again.