...
To address these use cases where avoiding the cost (CPU, memory, garbage collection overhead), this KIP proposes providing a `ByteArrayConverter` supporting ByteArrayConverter
supporting only a single type to be converted to/from the Kafka Connect data API, much like the `ByteArraySerializer` ByteArraySerializer
/`Deserializer` already Deserializer
already provided for Java clients.
...
The new public interface is a class implementing the `Converter` interface Converter
interface that works only with `bytebyte[]
` data data. The implementation is trivial enough to be included inline in the KIP:
...
We propose adding the new `ByteArrayConverter` interface ByteArrayConverter
interface. The implementation is trivial, but there are a few key characteristics worth noting:
- There should be no configuration values. None should be required since the data is being passed directly through to the Connector.
- When converting to the Connect data API, the schema is `Schema
Schema.OPTIONAL_BYTES_
SCHEMA`SCHEMA
. This provides support for `null` valuesnull
values so this `Converter` canConverter
can be used with compacted topics.
Kafka Connect divides its classes into multiple jars; especially for the provided JSON converter this is done to allow removing the converter and all of its dependencies. This Converter will be added directly to the `runtime` jar runtime
jar since it introduces no dependencies, is broadly useful, and doesn't warrant its own jar.
Compatibility, Deprecation, and Migration Plan
Adding `ByteArrayConverter` has ByteArrayConverter
has no implications for existing classes, compatibility, deprecation, or migration.
...