new hello world example

This commit is contained in:
Colin Surprenant 2013-05-15 13:48:47 -04:00
parent 701f1c8386
commit 8221ab2b90
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
require 'red_storm'
class HelloWorldSpout < RedStorm::SimpleSpout
on_init {@words = ["hello", "world"]}
on_send {@words.shift unless @words.empty?}
end
class HelloWorldBolt < RedStorm::SimpleBolt
on_receive :emit => false do |tuple|
log.info(tuple.getString(0))
end
end
class HelloWorldTopology < RedStorm::SimpleTopology
spout HelloWorldSpout do
output_fields :word
end
bolt HelloWorldBolt do
source HelloWorldSpout, :global
end
end