Skip to content

Commit 3dba4da

Browse files
TimeWindowedSerializer and TimeWindowedSerde
1 parent 788016b commit 3dba4da

5 files changed

+59
-4
lines changed

SUMMARY.adoc

+3-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
.. link:kafka-streams-SessionWindow.adoc[SessionWindow]
5959
.. link:kafka-streams-TimeWindow.adoc[TimeWindow]
6060

61-
. link:kafka-streams-Windowed.adoc[Windowed]
61+
. link:kafka-streams-WindowedSerdes.adoc[WindowedSerdes -- SessionWindowedSerde and TimeWindowedSerde]
62+
.. link:kafka-streams-Windowed.adoc[Windowed]
63+
.. link:kafka-streams-TimeWindowedSerializer.adoc[TimeWindowedSerializer]
6264

6365
. link:kafka-streams-SessionKeySerde.adoc[SessionKeySerde]
6466

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
== [[TimeWindowedSerializer]] TimeWindowedSerializer
2+
3+
`TimeWindowedSerializer` is a <<kafka-streams-internals-WindowedSerializer.adoc#, WindowedSerializer>> for the keys of <<kafka-streams-WindowedSerdes.adoc#TimeWindowedSerde, WindowedSerdes.TimeWindowedSerde>> and `FullTimeWindowedSerde` windowed serdes.
4+
5+
[[creating-instance]]
6+
[[inner]]
7+
`TimeWindowedSerializer` takes a Kafka https://kafka.apache.org/21/javadoc/org/apache/kafka/common/serialization/Serializer.html[Serializer] when created.
8+
9+
[[configure]]
10+
When requested to configure, `TimeWindowedSerializer` uses <<kafka-streams-StreamsConfig.adoc#DEFAULT_WINDOWED_KEY_SERDE_INNER_CLASS, DEFAULT_WINDOWED_KEY_SERDE_INNER_CLASS>> and <<kafka-streams-StreamsConfig.adoc#DEFAULT_WINDOWED_VALUE_SERDE_INNER_CLASS, DEFAULT_WINDOWED_VALUE_SERDE_INNER_CLASS>> configuration properties for the serde of keys and values, respectively, unless the <<inner, Serializer>> is defined already.

kafka-streams-WindowedSerdes.adoc

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
== [[WindowedSerdes]] WindowedSerdes -- SessionWindowedSerde and TimeWindowedSerde
2+
3+
`WindowedSerdes` is a class that acts as a namespace for two static classes:
4+
5+
* [[SessionWindowedSerde]] `SessionWindowedSerde` for session-windowed aggregations
6+
* [[TimeWindowedSerde]] `TimeWindowedSerde` for time-windowed aggregation
7+
8+
`WindowedSerdes` also defines two <<factory-methods, factory methods>> to create instances of <<timeWindowedSerdeFrom, TimeWindowedSerde>> and <<sessionWindowedSerdeFrom, SessionWindowedSerde>> for the specified inner class type.
9+
10+
[[factory-methods]]
11+
.WindowedSerdes's Factory Methods
12+
[cols="1m,2",options="header",width="100%"]
13+
|===
14+
| Method
15+
| Description
16+
17+
| sessionWindowedSerdeFrom
18+
a| [[sessionWindowedSerdeFrom]]
19+
20+
[source, java]
21+
----
22+
Serde<Windowed<T>> sessionWindowedSerdeFrom(
23+
final Class<T> type)
24+
----
25+
26+
| timeWindowedSerdeFrom
27+
a| [[timeWindowedSerdeFrom]]
28+
29+
[source, java]
30+
----
31+
Serde<Windowed<T>> timeWindowedSerdeFrom(
32+
final Class<T> type)
33+
----
34+
35+
|===
36+
37+
=== Scala API for Kafka Streams
38+
39+
<<kafka-streams-scala-Serdes.adoc#, Serdes>> object defines the following implicit conversions to create instances of `TimeWindowedSerde` and `SessionWindowedSerde` (without an explicit inner class type):
40+
41+
* <<kafka-streams-scala-Serdes.adoc#sessionWindowedSerde, sessionWindowedSerde>> for a <<SessionWindowedSerde, WindowedSerdes.SessionWindowedSerde[T]>> instance
42+
43+
* <<kafka-streams-scala-Serdes.adoc#timeWindowedSerde, timeWindowedSerde>> for a <<TimeWindowedSerde, WindowedSerdes.TimeWindowedSerde[T]>> instance

kafka-streams-internals-WindowedSerializer.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ byte[] serializeBaseKey(String topic, Windowed<T> data)
2323
| SessionWindowedSerializer
2424
| [[SessionWindowedSerializer]]
2525

26-
| TimeWindowedSerializer
26+
| <<kafka-streams-TimeWindowedSerializer.adoc#, TimeWindowedSerializer>>
2727
| [[TimeWindowedSerializer]]
2828

2929
|===

kafka-streams-scala-Serdes.adoc

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ Serdes.String.getClass.getName
5858
| [[String]] Serde[String]
5959

6060
| sessionWindowedSerde[T]
61-
| [[sessionWindowedSerde]] WindowedSerdes.SessionWindowedSerde[T]
61+
| [[sessionWindowedSerde]] <<kafka-streams-WindowedSerdes.adoc#SessionWindowedSerde, WindowedSerdes.SessionWindowedSerde[T]>>
6262

6363
| timeWindowedSerde[T]
64-
| [[timeWindowedSerde]] WindowedSerdes.TimeWindowedSerde[T]
64+
| [[timeWindowedSerde]] <<kafka-streams-WindowedSerdes.adoc#TimeWindowedSerde, WindowedSerdes.TimeWindowedSerde[T]>>
6565
|===
6666

6767
=== [[fromFn]] `fromFn` Method

0 commit comments

Comments
 (0)