Class: BatchSpout
- Inherits:
-
Object
- Object
- BatchSpout
- Defined in:
- lib/red_storm/proxy/batch_spout.rb
Overview
the BatchSpout class is a proxy to the real batch spout to avoid having to deal with all the Java artifacts when creating a spout.
The real batch spout class implementation must define these methods:
-
open(conf, context, collector)
-
emitBatch
-
getOutputFields
-
ack(batch_id)
and optionnaly:
-
close
Instance Method Summary collapse
- #ack(batch_id) ⇒ Object
- #close ⇒ Object
- #emitBatch(batch_id, collector) ⇒ Object
- #getComponentConfiguration ⇒ Object
- #getOutputFields ⇒ Object
-
#initialize(base_class_path, real_spout_class_name) ⇒ BatchSpout
constructor
A new instance of BatchSpout.
- #open(conf, context) ⇒ Object
Constructor Details
#initialize(base_class_path, real_spout_class_name) ⇒ BatchSpout
Returns a new instance of BatchSpout.
34 35 36 37 38 39 |
# File 'lib/red_storm/proxy/batch_spout.rb', line 34 def initialize(base_class_path, real_spout_class_name) @real_spout = Object.module_eval(real_spout_class_name).new rescue NameError require base_class_path @real_spout = Object.module_eval(real_spout_class_name).new end |
Instance Method Details
#ack(batch_id) ⇒ Object
57 58 59 |
# File 'lib/red_storm/proxy/batch_spout.rb', line 57 def ack(batch_id) @real_spout.ack(batch_id) end |
#close ⇒ Object
47 48 49 |
# File 'lib/red_storm/proxy/batch_spout.rb', line 47 def close @real_spout.close if @real_spout.respond_to?(:close) end |
#emitBatch(batch_id, collector) ⇒ Object
52 53 54 |
# File 'lib/red_storm/proxy/batch_spout.rb', line 52 def emitBatch(batch_id, collector) @real_spout.emit_batch(batch_id, collector) end |
#getComponentConfiguration ⇒ Object
67 68 69 |
# File 'lib/red_storm/proxy/batch_spout.rb', line 67 def getComponentConfiguration @real_spout.get_component_configuration end |
#getOutputFields ⇒ Object
62 63 64 |
# File 'lib/red_storm/proxy/batch_spout.rb', line 62 def getOutputFields @real_spout.get_output_fields() end |
#open(conf, context) ⇒ Object
42 43 44 |
# File 'lib/red_storm/proxy/batch_spout.rb', line 42 def open(conf, context) @real_spout.open(conf, context) end |