DUE TO SPAM, SIGN-UP IS DISABLED. Goto Selfserve wiki signup and request an account.
...
In some use-cases we might need a way to be able to chain of Kafka serializer/deserializer before applying large message serializer for example need to apply schema or special format like avro or protobuf. We could just create a single LargeMessageSerializer that implemented the Kafka Serializer interface, but we would need to create the different versions (AvroSerializer, ProtobufSerializer) with their support for the schema.
Instead the KIP is proposing idea of having a composable serializer, that still implements the Kafka Serializer interface, but allows concatenating several serializers to perform what we are looking for here.
...
- Check if the estimated size of the data (bytes) after applying provided compression (if there is one) it needs to serialize is bigger larger than the configured threshold.
- If it is large than the provided threshold (`
large.message.threshold.bytes`):- Use the provided BlobStore
- implementation to put the large message as blob/object into blob store, generating an id which is the reference to access this later.
- Encapsulate that ID into a simple Kafka event using a structured format.
- Pass the new Kafka Event down
- Add a
large-message: trueheader
- If it’s not large then provided threshold (
large.message.threshold.bytes):- Do nothing, pass the data as it is.
- If it is large than the provided threshold (`
- If it is
- If it’s not
3. LargeMessageDeserializer
...
- Check if the event is of the Large blob type by looking for
large-message: trueheader- If it does have `
large-message` header:- Parse the event and retrieve the ID and the needed useful information on the event.
- Use
- the provided BlobStore implementation to get the blob from the blob/object-store.
- Return blob down
- If it doesn't have the
large-messageheader:- Do nothing return the Kafka message as
If - If it does have `
- it is
If it’s not
Proposed Changes
1. Composable Serializer/Deserializer
...
| Key | Description | Default | Required |
| value.serializers | List of serializers class that implements the `org.apache.kafka.common.serialization.Serializer` interface in order. The first serializer is `Serializer<T>` while the remaining serializers must be `Serializer<byte[]>`. | None | Yes |
| value.deserializers | List of deserializes class deserializer classes that implements the `org.apache.kafka.common.serialization.Deserializer` interface in order. The last deserializer must be `Deserializer<T>` while the rest must be `Deserializer<byte[]>`. | None | Yes |
...
| Key | Description | Default | Required |
|---|---|---|---|
large.message.blob.store.class | Implementation of org.apache.kafka.common.serialization.largemessage.blobstore.BlobStore . | None | Yes |
large.message.blob.store.timeout.ms | Timeout for blob store operations. This can't exceedmax.block.msfor Kafka producers ormax.poll.interval.msin Kafka consumer. | 10000 | No |
large.message.blob.store.retry.count | Number of retries for blob store operations. | 5 | No |
large.message.blob.store.retry.max.backoff.ms | Backoff time between retries for blob store operations. | 10000 | No |
large.message.blob.store.retry.delay.backoff.ms | Delay time between retries back off for blob store operations. | 100 | No |
large | Implementation of org.apache.kafka.common.serialziation.largemessage.blobstore.BlobIdGenerator iinterface. This provides a way for the serializer to generate an identifier for the message in the store. | org.apache.kafka.common.serialization.largemessage||
. | No | `large.||
message.skip.not.found. | |||
error | Skip not found error when the blob is not found in the store. This allows the deserializer to skip not-found messages and return empty bytes instead. This is important when external store ttl is smaller than kafka retention. | FALSE | No |
4. BlobStore
| Code Block | ||
|---|---|---|
| ||
public abstract class BlobStore implements Configurable, Closeable {
@Override
public void configure(Map<String, ?> configs) {
// configure
}
/**
* Upload data into object store.
*
* @param data data that will be uploaded into the object.
* @return {@link BlobResponse}.
*/
public abstract BlobResponse putObject(String topic, byte[] data);
/**
* Download object from object store.
*
* @param blobPath id of the object in blobstore
* @return content of the object as bytes.
*/
public abstract byte[] getObject(String blobPath);
} |
...