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.
33 34 35 36 37 38 |
# File 'lib/red_storm/proxy/bolt.rb', line 33 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
51 52 53 |
# File 'lib/red_storm/proxy/bolt.rb', line 51 def cleanup @real_bolt.cleanup if @real_bolt.respond_to?(:cleanup) end |
#declareOutputFields(declarer) ⇒ Object
56 57 58 |
# File 'lib/red_storm/proxy/bolt.rb', line 56 def declareOutputFields(declarer) @real_bolt.declare_output_fields(declarer) end |
#execute(tuple) ⇒ Object
46 47 48 |
# File 'lib/red_storm/proxy/bolt.rb', line 46 def execute(tuple) @real_bolt.execute(tuple) end |
#getComponentConfiguration ⇒ Object
61 62 63 |
# File 'lib/red_storm/proxy/bolt.rb', line 61 def getComponentConfiguration @real_bolt.get_component_configuration end |
#prepare(conf, context, collector) ⇒ Object
41 42 43 |
# File 'lib/red_storm/proxy/bolt.rb', line 41 def prepare(conf, context, collector) @real_bolt.prepare(conf, context, collector) end |