Class: Bolt
- Inherits:
-
Object
- Object
- Bolt
- Defined in:
- lib/red_storm/proxy/bolt.rb
Overview
the Bolt class is a proxy to the real bolt to avoid having to deal with all the Java artifacts when creating a bolt.
The real bolt class implementation must define these methods:
-
prepare(conf, context, collector)
-
execute(tuple)
-
declare_output_fields
and optionnaly:
-
cleanup
Instance Method Summary collapse
- #cleanup ⇒ Object
- #declareOutputFields(declarer) ⇒ Object
- #execute(tuple) ⇒ Object
- #getComponentConfiguration ⇒ Object
-
#initialize(base_class_path, real_bolt_class_name) ⇒ Bolt
constructor
A new instance of Bolt.
- #prepare(conf, context, collector) ⇒ Object
Constructor Details
#initialize(base_class_path, real_bolt_class_name) ⇒ Bolt
Returns a new instance of Bolt.
32 33 34 35 36 37 |
# File 'lib/red_storm/proxy/bolt.rb', line 32 def initialize(base_class_path, real_bolt_class_name) @real_bolt = Object.module_eval(real_bolt_class_name).new rescue NameError require base_class_path @real_bolt = Object.module_eval(real_bolt_class_name).new end |
Instance Method Details
#cleanup ⇒ Object
50 51 52 |
# File 'lib/red_storm/proxy/bolt.rb', line 50 def cleanup @real_bolt.cleanup if @real_bolt.respond_to?(:cleanup) end |
#declareOutputFields(declarer) ⇒ Object
55 56 57 |
# File 'lib/red_storm/proxy/bolt.rb', line 55 def declareOutputFields(declarer) @real_bolt.declare_output_fields(declarer) end |
#execute(tuple) ⇒ Object
45 46 47 |
# File 'lib/red_storm/proxy/bolt.rb', line 45 def execute(tuple) @real_bolt.execute(tuple) end |
#getComponentConfiguration ⇒ Object
60 61 62 |
# File 'lib/red_storm/proxy/bolt.rb', line 60 def getComponentConfiguration @real_bolt.get_component_configuration end |
#prepare(conf, context, collector) ⇒ Object
40 41 42 |
# File 'lib/red_storm/proxy/bolt.rb', line 40 def prepare(conf, context, collector) @real_bolt.prepare(conf, context, collector) end |