You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@kafka.apache.org by un...@gmail.com,
un...@gmail.com on 2019/06/24 10:05:04 UTC
replace usage of TimeWindows.until() from Kafka Streams 2.2
Hi Kafka Streams user,
I have this usage of Kafka Streams and it works well that sets retention time in KTable, both in the internal topics and RocksDB local states.
final KStream<Integer, String> eventStream = builder
.stream("events",
Consumed.with(Serdes.Integer(), Serdes.String())
.withOffsetResetPolicy(Topology.AutoOffsetReset.EARLIEST));
eventStream.groupByKey()
.windowedBy(TimeWindows.of(Duration.ofSeconds(200)).until(Duration.ofSeconds(3000).toMillis()))
.reduce((oldValue, newValue) -> newValue);
I saw until() is deprecated from 2.2. What would be the replacement of such usage?
I checked the Materialized related document but cannot find any
Best,
Sendoh
Re: replace usage of TimeWindows.until() from Kafka Streams 2.2
Posted by John Roesler <jo...@confluent.io>.
Hey Sendoh,
I think you just overlooked the javadoc in your search, which says:
> @deprecated since 2.1. Use {@link Materialized#withRetention(Duration)} or directly configure the retention in a store supplier and use {@link Materialized#as(WindowBytesStoreSupplier)}.
Sorry for the confusion,
-John
On Mon, Jun 24, 2019 at 5:05 AM unicorn.banachi@gmail.com
<un...@gmail.com> wrote:
>
> Hi Kafka Streams user,
>
> I have this usage of Kafka Streams and it works well that sets retention time in KTable, both in the internal topics and RocksDB local states.
>
> final KStream<Integer, String> eventStream = builder
> .stream("events",
> Consumed.with(Serdes.Integer(), Serdes.String())
> .withOffsetResetPolicy(Topology.AutoOffsetReset.EARLIEST));
>
> eventStream.groupByKey()
> .windowedBy(TimeWindows.of(Duration.ofSeconds(200)).until(Duration.ofSeconds(3000).toMillis()))
> .reduce((oldValue, newValue) -> newValue);
>
> I saw until() is deprecated from 2.2. What would be the replacement of such usage?
> I checked the Materialized related document but cannot find any
>
> Best,
>
> Sendoh