Class: BatchBolt

Inherits:
Object
  • Object
show all
Defined in:
lib/red_storm/proxy/batch_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

Constructor Details

#initialize(base_class_path, real_bolt_class_name) ⇒ BatchBolt

Returns a new instance of BatchBolt.



32
33
34
35
36
37
# File 'lib/red_storm/proxy/batch_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

#declareOutputFields(declarer) ⇒ Object



55
56
57
# File 'lib/red_storm/proxy/batch_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/batch_bolt.rb', line 45

def execute(tuple)
  @real_bolt.execute(tuple)
end

#finishBatchObject



50
51
52
# File 'lib/red_storm/proxy/batch_bolt.rb', line 50

def finishBatch
  @real_bolt.finish_batch if @real_bolt.respond_to?(:finish_batch)
end

#getComponentConfigurationObject



60
61
62
# File 'lib/red_storm/proxy/batch_bolt.rb', line 60

def getComponentConfiguration
  @real_bolt.get_component_configuration
end

#prepare(conf, context, collector, id) ⇒ Object



40
41
42
# File 'lib/red_storm/proxy/batch_bolt.rb', line 40

def prepare(conf, context, collector, id)
  @real_bolt.prepare(conf, context, collector, id)
end