Created
November 8, 2011 05:12
-
-
Save PlasticLizard/1347062 to your computer and use it in GitHub Desktop.
Ruby DSL sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "redis_word_count_toplogy" | |
cluster = StormCluster.submit RedisWordCountToplogy.create do |config| | |
config.debug true | |
config.num_workers 20 | |
config.max_spout_pending 1000 | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "redis_word_count_topology" | |
cluster = LocalCluster.submit RedisWordCountTopology.create do |config| | |
config.debug true | |
config.max_task_parallelism 3 | |
end | |
sleep(600) | |
cluster.shutdown | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class RedisWordCountToplogy | |
include RedStorm::DSL::Topology | |
def create | |
topology :redis_word_count do | |
#convention could transform :redis_word_count to RedisWordCount, with an optional :class => RedisWordCount if the convention didn't match the name | |
spout :redis_word_spout, :concurrency => 1 | |
bolt :word_count_bolt, :concurrency => 3 do | |
source :redis_word_count #maybe this could be the last defined component if omitted | |
group_by :redis_word_count, :fields => ["word"] | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment