AWS::KCL::IOProxy
Inherits Reference < Object
Internal class used by {Driver} and {Checkpointer} to communicate with the the {https://github.com/awslabs/amazon-kinesis-client/blob/master/src/main/java/com/amazonaws/services/kinesis/multilang/package-info.java MultiLangDaemon} via the input and output streams.
Constructors
@param input [IO, #read_line] An IO-like object to read input lines from (e.g. STDIN).
@param output [IO] An IO-like object to write output lines to (e.g. STDOUT).
@param error [IO] An IO-like object to write error lines to (e.g. STDERR).
Instance methods
Reads a line and decodes it as a message from the {https://github.com/awslabs/amazon-kinesis-client/blob/master/src/main/java/com/amazonaws/services/kinesis/multilang/package-info.java MultiLangDaemon}.
@return [AWS::KCL::Action | Nil] A Action hash representing the contents of the line, e.g.
InitializeAction({"action" => "initialize", "shardId" => "shardId-000001"})
Reads one line from the input IO, strips it from any leading/trailing whitespaces, skipping empty lines.
@return [String, nil] The line read from the input IO or nil
if end of stream was reached.
Writes a response action to the {https://github.com/awslabs/amazon-kinesis-client/blob/master/src/main/java/com/amazonaws/services/kinesis/multilang/package-info.java MultiLangDaemon},
in JSON of the form:
{"action":"<action>","detail1":"value1",...}
where the details depend on the type of the action. See {https://github.com/awslabs/amazon-kinesis-client/blob/master/src/main/java/com/amazonaws/services/kinesis/multilang/package-info.java MultiLangDaemon documentation} for more infortmation.
@param action [String] The action name that will be put into the output JSON's action attribute.
@param details [Hash(String, String)] Additional key-value pairs to be added to the action response.
Writes a line to the error file.
@param error [String] An error message
Writes a line to the error file.
@param error [Exception] An exception
Writes a line to the output stream. The line is preceded and followed by a
new line because other libraries could be writing to the output stream as
well (e.g. some libs might write debugging info to STDOUT) so we would
like to prevent our lines from being interlaced with other messages so
the MultiLangDaemon can understand them.
@param line [String] A line to write to the output stream, e.g.
{"action":"status","responseFor":"<someAction>"}