Class: RedStorm::SimpleTopology::BoltDefinition
- Inherits:
-
ComponentDefinition
- Object
- Configurator
- ComponentDefinition
- RedStorm::SimpleTopology::BoltDefinition
- Defined in:
- lib/red_storm/simple_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(base_class_path) ⇒ 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.
56 57 58 59 |
# File 'lib/red_storm/simple_topology.rb', line 56 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.
54 55 56 |
# File 'lib/red_storm/simple_topology.rb', line 54 def command @command end |
#sources ⇒ Object
Returns the value of attribute sources.
54 55 56 |
# File 'lib/red_storm/simple_topology.rb', line 54 def sources @sources end |
Instance Method Details
#define_grouping(declarer) ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/red_storm/simple_topology.rb', line 65 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(base_class_path) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/red_storm/simple_topology.rb', line 90 def new_instance(base_class_path) # 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(base_class_path, @clazz.name, @output_fields) end # is_java? ? @clazz.new : @clazz.is_a?(SimpleBolt) ? JRubyBolt.new(base_class_path, @clazz.name) : @clazz.new end |
#source(source_id, grouping) ⇒ Object
61 62 63 |
# File 'lib/red_storm/simple_topology.rb', line 61 def source(source_id, grouping) @sources << [source_id.is_a?(Class) ? SimpleTopology.underscore(source_id) : source_id.to_s, grouping.is_a?(Hash) ? grouping : {grouping => nil}] end |