2011-10-20 21:12:10 +00:00
|
|
|
java_import 'backtype.storm.testing.TestWordSpout'
|
2011-12-12 22:16:49 +00:00
|
|
|
|
2013-05-14 20:32:58 +00:00
|
|
|
require 'red_storm'
|
2011-11-16 21:47:37 +00:00
|
|
|
require 'examples/native/exclamation_bolt'
|
2011-10-20 21:12:10 +00:00
|
|
|
|
2011-11-07 20:43:46 +00:00
|
|
|
# this example topology uses the Storm TestWordSpout and our own JRuby ExclamationBolt
|
|
|
|
|
2011-12-12 22:16:49 +00:00
|
|
|
module RedStorm
|
|
|
|
module Examples
|
|
|
|
class LocalExclamationTopology
|
|
|
|
RedStorm::Configuration.topology_class = self
|
2011-12-09 20:28:23 +00:00
|
|
|
|
2011-12-12 22:16:49 +00:00
|
|
|
def start(base_class_path, env)
|
|
|
|
builder = TopologyBuilder.new
|
2013-01-10 09:28:59 +00:00
|
|
|
|
2013-05-14 20:32:58 +00:00
|
|
|
builder.setSpout('TestWordSpout', TestWordSpout.new, 1)
|
|
|
|
builder.setBolt('ExclamationBolt1', JRubyBolt.new(base_class_path, 'RedStorm::Examples::ExclamationBolt', []), 2).shuffleGrouping('TestWordSpout')
|
|
|
|
builder.setBolt('ExclamationBolt2', JRubyBolt.new(base_class_path, 'RedStorm::Examples::ExclamationBolt', []), 2).shuffleGrouping('ExclamationBolt1')
|
2013-01-10 09:28:59 +00:00
|
|
|
|
2012-06-05 21:11:02 +00:00
|
|
|
conf = Backtype::Config.new
|
2011-12-12 22:16:49 +00:00
|
|
|
conf.setDebug(true)
|
2013-01-10 09:28:59 +00:00
|
|
|
|
2011-12-12 22:16:49 +00:00
|
|
|
cluster = LocalCluster.new
|
|
|
|
cluster.submitTopology("exclamation", conf, builder.createTopology)
|
|
|
|
sleep(5)
|
|
|
|
cluster.killTopology("exclamation")
|
|
|
|
cluster.shutdown
|
|
|
|
end
|
|
|
|
end
|
2011-10-20 21:12:10 +00:00
|
|
|
end
|
2013-01-10 09:28:59 +00:00
|
|
|
end
|