public class SimpleHeaderConverter extends Object implements HeaderConverter, Versioned
HeaderConverter
that serializes header values as strings and that deserializes header values to the most appropriate
numeric, boolean, array, or map representation. Schemas are not serialized, but are inferred upon deserialization when possible.Constructor and Description |
---|
SimpleHeaderConverter() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
org.apache.kafka.common.config.ConfigDef |
config()
Configuration specification for this set of header converters.
|
void |
configure(Map<String,?> configs) |
byte[] |
fromConnectHeader(String topic,
String headerKey,
Schema schema,
Object value)
|
SchemaAndValue |
toConnectHeader(String topic,
String headerKey,
byte[] value)
Convert the header name and byte array value into a
Header object. |
String |
version()
Get the version of this component.
|
public String version()
Versioned
public org.apache.kafka.common.config.ConfigDef config()
HeaderConverter
config
in interface HeaderConverter
public void configure(Map<String,?> configs)
configure
in interface org.apache.kafka.common.Configurable
public SchemaAndValue toConnectHeader(String topic, String headerKey, byte[] value)
HeaderConverter
Header
object.toConnectHeader
in interface HeaderConverter
topic
- the name of the topic for the record containing the headerheaderKey
- the header's key; may not be nullvalue
- the header's raw value; may be nullSchemaAndValue
; may not be nullpublic byte[] fromConnectHeader(String topic, String headerKey, Schema schema, Object value)
HeaderConverter
fromConnectHeader
in interface HeaderConverter
topic
- the name of the topic for the record containing the headerheaderKey
- the header's key; may not be nullschema
- the schema for the header's value; may be nullvalue
- the header's value to convert; may be nullpublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException