Skip to content

Instantly share code, notes, and snippets.

@PlasticLizard
Created November 8, 2011 05:12
Show Gist options
  • Save PlasticLizard/1347062 to your computer and use it in GitHub Desktop.
Save PlasticLizard/1347062 to your computer and use it in GitHub Desktop.
Ruby DSL sketch
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
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
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