redstorm/examples/native/local_exclamation_topology.rb

32 lines
1.0 KiB
Ruby
Raw Normal View History

2011-10-20 21:12:10 +00:00
java_import 'backtype.storm.testing.TestWordSpout'
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
module RedStorm
module Examples
class LocalExclamationTopology
RedStorm::Configuration.topology_class = self
def start(base_class_path, env)
builder = TopologyBuilder.new
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')
conf = Backtype::Config.new
conf.setDebug(true)
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
end