Class: RedStorm::SimpleTopology::BoltDefinition
- Inherits:
-
ComponentDefinition
- Object
- Configurator
- ComponentDefinition
- RedStorm::SimpleTopology::BoltDefinition
- Defined in:
- lib/red_storm/simple_topology.rb
Instance Attribute Summary collapse
-
#sources ⇒ Object
Returns the value of attribute sources.
Attributes inherited from ComponentDefinition
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.
40 41 42 43 |
# File 'lib/red_storm/simple_topology.rb', line 40 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
#sources ⇒ Object
Returns the value of attribute sources.
38 39 40 |
# File 'lib/red_storm/simple_topology.rb', line 38 def sources @sources end |
Instance Method Details
#define_grouping(declarer) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/red_storm/simple_topology.rb', line 49 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
74 75 76 |
# File 'lib/red_storm/simple_topology.rb', line 74 def new_instance(base_class_path) is_java? ? @clazz.new : JRubyBolt.new(base_class_path, @clazz.name) end |
#source(source_id, grouping) ⇒ Object
45 46 47 |
# File 'lib/red_storm/simple_topology.rb', line 45 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 |