Package io.deephaven.kafka.publish
Interface KeyOrValueSerializer<SERIALIZED_TYPE>
- All Known Implementing Classes:
GenericRecordKeyOrValueSerializer
,JsonKeyOrValueSerializer
,SimpleKeyOrValueSerializer
public interface KeyOrValueSerializer<SERIALIZED_TYPE>
Chunk-oriented serializer that supplies keys or values for stream publishing.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Context interface. -
Method Summary
Modifier and TypeMethodDescriptionhandleChunk
(KeyOrValueSerializer.Context context, RowSequence rowSequence, boolean previous) Create a chunk of output keys or values that correspond torowSequence
.makeContext
(int size) Create a context for callinghandleChunk(Context, RowSequence, boolean)
.
-
Method Details
-
handleChunk
ObjectChunk<SERIALIZED_TYPE,Values> handleChunk(KeyOrValueSerializer.Context context, RowSequence rowSequence, boolean previous) Create a chunk of output keys or values that correspond torowSequence
. The outputchunks
should be cached in thecontext
for re-use, but the data returned in them should be functionally immutable and not rely on pooled or re-usable objects.- Parameters:
context
- AKeyOrValueSerializer.Context
created bymakeContext(int)
rowSequence
- The row keys to serializeprevious
- If previous row values should be used, as with row key removals- Returns:
- A chunk of serialized data keys or values, with
ObjectChunk.size() == rowSequence.size()
-
makeContext
Create a context for callinghandleChunk(Context, RowSequence, boolean)
.- Parameters:
size
- The maximum number of rows that will be serialized for each chunk- Returns:
- A Context for the KeyOrValueSerializer
-