Class: Aws::KCLrb::KCLProcess

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/kclrb/kcl_process.rb

Overview

Entry point for a KCL application in Ruby.

Implementers of KCL applications in Ruby should instantiate this class and invoke the #run method to start processing records.

Instance Method Summary collapse

Constructor Details

#initialize(processor, input = $stdin, output = $stdout, error = $stderr) ⇒ KCLProcess

Returns a new instance of KCLProcess.

Parameters:

  • processor (RecordProcessorBase)

    A record processor to use for processing a shard.

  • input (IO) (defaults to: $stdin)

    An IO-like object to read input lines from.

  • output (IO) (defaults to: $stdout)

    An IO-like object to write output lines to.

  • error (IO) (defaults to: $stderr)

    An IO-like object to write error lines to.



34
35
36
37
38
# File 'lib/aws/kclrb/kcl_process.rb', line 34

def initialize(processor, input=$stdin, output=$stdout, error=$stderr)
  @processor = processor
  @io_proxy = IOProxy.new(input, output, error)
  @checkpointer = CheckpointerImpl.new(@io_proxy)
end

Instance Method Details

#runObject

Starts this KCL processor's main loop.



41
42
43
44
45
46
47
# File 'lib/aws/kclrb/kcl_process.rb', line 41

def run
  action = @io_proxy.read_action
  while action do
    process_action(action)
    action = @io_proxy.read_action
  end
end