Kafka stores and transports byte arrays in its queue. The (de)serializers are responsible for translating between the byte array provided by Kafka and POJOs.
parameters | details |
---|---|
config | the configuration properties (Properties ) passed to the Producer or Consumer upon creation, as a map. It contains regular kafka configs, but can also be augmented with user-defined configuration. It is the best way to pass arguments to the (de)serializer. |
isKey | custom (de)serializers can be used for keys and/or values. This parameter tells you which of the two this instance will deal with. |
topic | the topic of the current message. This lets you define custom logic based on the source/destination topic. |
bytes | The raw message to deserialize |
obj | The message to serialize. Its actual class depends on your serializer. |
Before version 0.9.0.0 the Kafka Java API used Encoders
and Decoders
. They have been replaced by Serializer
and Deserializer
in the new API.