public class Converter extends Object
| Constructor and Description |
|---|
Converter(org.apache.avro.Schema avroSchema,
String[] headerFields)
Create a converter that can be used to convert stream events into avro records.
|
| Modifier and Type | Method and Description |
|---|---|
org.apache.avro.generic.GenericRecord |
convert(Object streamBody,
long timestamp,
Map<String,String> headers)
Convert a
StructuredRecord of the stream event body, the stream event timestamp, and the headers
for the stream event into a GenericRecord of the given schema. |
public Converter(org.apache.avro.Schema avroSchema,
String[] headerFields)
avroSchema - the schema for generated avro recordsheaderFields - fields of the schema that should take their values from a stream event's headerspublic org.apache.avro.generic.GenericRecord convert(Object streamBody, long timestamp, Map<String,String> headers)
StructuredRecord of the stream event body, the stream event timestamp, and the headers
for the stream event into a GenericRecord of the given schema.streamBody - the body of the stream eventtimestamp - the timestamp of the stream eventheaders - headers of the stream eventUnexpectedFormatException - if there was an error during conversion due to incompatible fieldsCopyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.