issue #26 fixed examples/native for 0.5.1 compatibility
This commit is contained in:
parent
9c0b41af43
commit
607b49bb88
|
@ -0,0 +1,2 @@
|
|||
source :rubygems
|
||||
gem 'redis'
|
|
@ -14,7 +14,7 @@ module RedStorm
|
|||
builder.setBolt('SplitSentenceBolt', JRubyBolt.new(base_class_path, "RedStorm::Examples::SplitSentenceBolt"), 4).shuffleGrouping('RandomSentenceSpout')
|
||||
builder.setBolt('WordCountBolt', JRubyBolt.new(base_class_path, "RedStorm::Examples::WordCountBolt"), 4).fieldsGrouping('SplitSentenceBolt', Fields.new("word"))
|
||||
|
||||
conf = Config.new
|
||||
conf = Backtype::Config.new
|
||||
conf.setDebug(true)
|
||||
conf.setNumWorkers(20);
|
||||
conf.setMaxSpoutPending(1000);
|
||||
|
|
|
@ -10,6 +10,9 @@ module RedStorm
|
|||
@collector.ack(tuple)
|
||||
end
|
||||
|
||||
def get_component_configuration
|
||||
end
|
||||
|
||||
def declare_output_fields(declarer)
|
||||
declarer.declare(Fields.new("word"))
|
||||
end
|
||||
|
|
|
@ -17,7 +17,7 @@ module RedStorm
|
|||
builder.setBolt('ExclamationBolt1', JRubyBolt.new(base_class_path, 'RedStorm::Examples::ExclamationBolt'), 3).shuffleGrouping('TestWordSpout')
|
||||
builder.setBolt('ExclamationBolt2', JRubyBolt.new(base_class_path, 'RedStorm::Examples::ExclamationBolt'), 3).shuffleGrouping('ExclamationBolt1')
|
||||
|
||||
conf = Config.new
|
||||
conf = Backtype::Config.new
|
||||
conf.setDebug(true)
|
||||
|
||||
cluster = LocalCluster.new
|
||||
|
|
|
@ -14,6 +14,9 @@ module RedStorm
|
|||
@collector.ack(tuple)
|
||||
end
|
||||
|
||||
def get_component_configuration
|
||||
end
|
||||
|
||||
def declare_output_fields(declarer)
|
||||
declarer.declare(Fields.new("word"))
|
||||
end
|
||||
|
@ -31,7 +34,7 @@ module RedStorm
|
|||
builder.setBolt('ExclamationBolt21', JRubyBolt.new(base_class_path, "RedStorm::Examples::ExclamationBolt2"), 3).shuffleGrouping('TestWordSpout')
|
||||
builder.setBolt('ExclamationBolt22', JRubyBolt.new(base_class_path, "RedStorm::Examples::ExclamationBolt2"), 2).shuffleGrouping('ExclamationBolt21')
|
||||
|
||||
conf = Config.new
|
||||
conf = Backtype::Config.new
|
||||
conf.setDebug(true)
|
||||
|
||||
cluster = LocalCluster.new
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
require 'bundler/setup'
|
||||
require 'redis'
|
||||
require 'thread'
|
||||
require 'lib/red_storm'
|
||||
|
@ -23,6 +24,9 @@ module RedStorm
|
|||
end
|
||||
end
|
||||
|
||||
def get_component_configuration
|
||||
end
|
||||
|
||||
def declare_output_fields(declarer)
|
||||
declarer.declare(Fields.new("word"))
|
||||
end
|
||||
|
@ -51,7 +55,7 @@ module RedStorm
|
|||
builder.setSpout('RedisWordSpout', JRubySpout.new(base_class_path, "RedStorm::Examples::RedisWordSpout"), 1)
|
||||
builder.setBolt('WordCountBolt', JRubyBolt.new(base_class_path, "RedStorm::Examples::WordCountBolt"), 3).fieldsGrouping('RedisWordSpout', Fields.new("word"))
|
||||
|
||||
conf = Config.new
|
||||
conf = Backtype::Config.new
|
||||
conf.setDebug(true)
|
||||
conf.setMaxTaskParallelism(3)
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ module Examples
|
|||
builder.setBolt('SplitSentenceBolt', JRubyBolt.new(base_class_path, "RedStorm::Examples::SplitSentenceBolt"), 8).shuffleGrouping('RandomSentenceSpout')
|
||||
builder.setBolt('WordCountBolt', JRubyBolt.new(base_class_path, "RedStorm::Examples::WordCountBolt"), 12).fieldsGrouping('SplitSentenceBolt', Fields.new("word"))
|
||||
|
||||
conf = Config.new
|
||||
conf = Backtype::Config.new
|
||||
conf.setDebug(true)
|
||||
conf.setMaxTaskParallelism(3)
|
||||
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
module RedStorm
|
||||
module Examples
|
||||
class RandomSentenceSpout
|
||||
attr_reader :is_distributed
|
||||
|
||||
def initialize
|
||||
@is_distributed = true
|
||||
@sentences = [
|
||||
"the cow jumped over the moon",
|
||||
"an apple a day keeps the doctor away",
|
||||
|
@ -22,6 +19,9 @@ module RedStorm
|
|||
@collector.emit(Values.new(@sentences[rand(@sentences.length)]))
|
||||
end
|
||||
|
||||
def get_component_configuration
|
||||
end
|
||||
|
||||
def declare_output_fields(declarer)
|
||||
declarer.declare(Fields.new("word"))
|
||||
end
|
||||
|
|
|
@ -9,6 +9,9 @@ module RedStorm
|
|||
tuple.getString(0).split(" ").each {|w| @collector.emit(Values.new(w)) }
|
||||
end
|
||||
|
||||
def get_component_configuration
|
||||
end
|
||||
|
||||
def declare_output_fields(declarer)
|
||||
declarer.declare(Fields.new("word"))
|
||||
end
|
||||
|
|
|
@ -15,6 +15,9 @@ module RedStorm
|
|||
@collector.emit(Values.new(word, @counts[word]))
|
||||
end
|
||||
|
||||
def get_component_configuration
|
||||
end
|
||||
|
||||
def declare_output_fields(declarer)
|
||||
declarer.declare(Fields.new("word", "count"))
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue