Sha256: f14baaa4cb10a5e595b400c474a87c9c4badb37d40999e2eff7854a954007270

Contents?: true

Size: 884 Bytes

Versions: 2

Compression:

Stored size: 884 Bytes

Contents

module Kcl
  class Process
    def initialize record_processor,
                   input: $stdin,
                   output: $stdout,
                   error: $stderr
      @record_processor = record_processor
      @io_handler = IOHandler.new input, output, error
      @checkpointer = Checkpointer.new @io_handler
    end

    def run
      loop do
        action = io_handler.read_action
        perform action
        report_done action

        break if action.nil?
      end
    end

    private

    attr_reader :record_processor, :io_handler, :checkpointer

    def perform action
      action_handler.handle action
    end

    def action_handler
      @action_handler ||=
        ActionHandler.new record_processor, checkpointer, io_handler
    end

    def report_done action
      io_handler.write_action action: 'status', responseFor: action['action']
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
amazon-kinesis-client-ruby-0.0.3 lib/kcl/process.rb
amazon-kinesis-client-ruby-0.0.1 lib/kcl/process.rb