Class SimpleHeaderConverter
java.lang.Object
org.apache.kafka.connect.storage.SimpleHeaderConverter
- All Implemented Interfaces:
Closeable, AutoCloseable, Configurable, ConnectPlugin, Versioned, HeaderConverter
A
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()config()Returns the configuration specification for this component.voidConfigure this class with the given key-value pairsbyte[]fromConnectHeader(String topic, String headerKey, Schema schema, Object value) toConnectHeader(String topic, String headerKey, byte[] value) Convert the header name and byte array value into aHeaderobject.version()Get the version of this component.
-
Constructor Details
-
SimpleHeaderConverter
public SimpleHeaderConverter()
-
-
Method Details
-
version
Description copied from interface:HeaderConverterGet the version of this component.- Specified by:
versionin interfaceHeaderConverter- Specified by:
versionin interfaceVersioned- Returns:
- the version, formatted as a String. The version may not be
nullor empty.
-
config
Description copied from interface:ConnectPluginReturns the configuration specification for this component.The returned
ConfigDefobject describes all configuration properties that this component accepts, including their types, default values, validators, importance levels, and documentation strings.- Specified by:
configin interfaceConnectPlugin- Returns:
- the configuration definition for this component; never null
-
configure
Description copied from interface:ConfigurableConfigure this class with the given key-value pairs- Specified by:
configurein interfaceConfigurable
-
toConnectHeader
Description copied from interface:HeaderConverterConvert the header name and byte array value into aHeaderobject.- Specified by:
toConnectHeaderin interfaceHeaderConverter- Parameters:
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 null- Returns:
- the
SchemaAndValue; may not be null
-
fromConnectHeader
Description copied from interface:HeaderConverter- Specified by:
fromConnectHeaderin interfaceHeaderConverter- Parameters:
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 null- Returns:
- the byte array form of the Header's value; may be null if the value is null
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-