Mark Lavin
Mark Lavin

Reputation: 1238

When does Kafka Streams de/serialize

Under what circumstances does a Kafka Streams program need to serialize/deserialize? Suppose we have the following simple program:

KStream<k,v> stream = ...;
Kstream<k,v> stream2 = stream.filter( predicateA )
Kstream<k,v> stream3 = stream2.filter( predicateB)
stream3.to( topic );

Very specifically, between the two invocations of filter, do the "k" and "v" get serialized/deserialized, or do individual data points get passed as native objects?

Upvotes: 0

Views: 476

Answers (1)

Matthias J. Sax
Matthias J. Sax

Reputation: 62350

Kafka Streams tries to pass Java object around if this is possible to avoid de/serialization overhead.

Only if data is read or written into a topic or a store, it will be de/serialized.

All operators that might need to de/serialize data, allow you to specify a key and value Serde—this is a good indicator which operator might de/serialize data and which don't.

Upvotes: 1

Related Questions