Class: RedStorm::DSL::Topology::BoltDefinition
- Inherits:
-
ComponentDefinition
- Object
- Configurator
- ComponentDefinition
- RedStorm::DSL::Topology::BoltDefinition
- Defined in:
- lib/red_storm/dsl/topology.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#command ⇒ Object
Returns the value of attribute command.
-
#sources ⇒ Object
Returns the value of attribute sources.
Attributes inherited from ComponentDefinition
#clazz, #constructor_args, #id, #parallelism
Attributes inherited from Configurator
Instance Method Summary collapse
- #define_grouping(declarer) ⇒ Object
-
#initialize(*args) ⇒ BoltDefinition
constructor
A new instance of BoltDefinition.
- #new_instance ⇒ Object
- #source(source_id, grouping) ⇒ Object
Methods inherited from ComponentDefinition
Methods inherited from Configurator
Constructor Details
#initialize(*args) ⇒ BoltDefinition
Returns a new instance of BoltDefinition.
57 58 59 60 |
# File 'lib/red_storm/dsl/topology.rb', line 57 def initialize(*args) super @sources = [] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class RedStorm::Configurator
Instance Attribute Details
#command ⇒ Object
Returns the value of attribute command.
55 56 57 |
# File 'lib/red_storm/dsl/topology.rb', line 55 def command @command end |
#sources ⇒ Object
Returns the value of attribute sources.
55 56 57 |
# File 'lib/red_storm/dsl/topology.rb', line 55 def sources @sources end |
Instance Method Details
#define_grouping(declarer) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/red_storm/dsl/topology.rb', line 66 def define_grouping(declarer) @sources.each do |source_id, grouping| grouper, params = grouping.first # declarer.fieldsGrouping(source_id, Fields.new()) case grouper when :fields declarer.fieldsGrouping(source_id, Fields.new(*([params].flatten.map(&:to_s)))) when :global declarer.globalGrouping(source_id) when :shuffle declarer.shuffleGrouping(source_id) when :local_or_shuffle declarer.localOrShuffleGrouping(source_id) when :none declarer.noneGrouping(source_id) when :all declarer.allGrouping(source_id) when :direct declarer.directGrouping(source_id) else raise("unknown grouper=#{grouper.inspect}") end end end |
#new_instance ⇒ Object
91 92 93 94 95 96 97 98 99 100 |
# File 'lib/red_storm/dsl/topology.rb', line 91 def new_instance # WARNING non-dry see BoltDefinition#new_instance if @clazz.name == "Java::RedstormStormJruby::JRubyShellBolt" @clazz.new(constructor_args, @output_fields) elsif is_java? @clazz.new(*constructor_args) else JRubyBolt.new(@clazz.base_class_path, @clazz.name, @output_fields) end end |
#source(source_id, grouping) ⇒ Object
62 63 64 |
# File 'lib/red_storm/dsl/topology.rb', line 62 def source(source_id, grouping) @sources << [source_id.is_a?(Class) ? Topology.underscore(source_id) : source_id.to_s, grouping.is_a?(Hash) ? grouping : {grouping => nil}] end |