Package org.apache.kafka.streams.kstream
Interface Suppressed<K>
public interface Suppressed<K>
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic interface
Suppressed.BufferConfig<BC extends Suppressed.BufferConfig<BC>>
static interface
Marker interface for a buffer configuration that will strictly enforce size constraints (bytes and/or number of records) on the buffer, so it is suitable for reducing duplicate results downstream, but does not promise to eliminate them entirely.static interface
Marker interface for a buffer configuration that is "strict" in the sense that it will strictly enforce the time bound and never emit early. -
Method Summary
Modifier and TypeMethodDescriptionstatic <K> Suppressed<K>
untilTimeLimit
(Duration timeToWaitForMoreEvents, Suppressed.BufferConfig bufferConfig) Configure the suppression to waittimeToWaitForMoreEvents
amount of time after receiving a record before emitting it further downstream.static Suppressed<Windowed>
untilWindowCloses
(Suppressed.StrictBufferConfig bufferConfig) Configure the suppression to emit only the "final results" from the window.Use the specified name for the suppression node in the topology.
-
Method Details
-
untilWindowCloses
Configure the suppression to emit only the "final results" from the window. By default all Streams operators emit results whenever new results are available. This includes windowed operations. This configuration will instead emit just one result per key for each window, guaranteeing to deliver only the final result. This option is suitable for use cases in which the business logic requires a hard guarantee that only the final result is propagated. For example, sending alerts. To accomplish this, the operator will buffer events from the window until the window close (that is, until the end-time passes, and additionally until the grace period expires). Since windowed operators are required to reject out-of-order events for a window whose grace period is expired, there is an additional guarantee that the final results emitted from this suppression will match any queryable state upstream.- Parameters:
bufferConfig
- A configuration specifying how much space to use for buffering intermediate results. This is required to be a "strict" config, since it would violate the "final results" property to emit early and then issue an update later.- Returns:
- a "final results" mode suppression configuration
-
untilTimeLimit
static <K> Suppressed<K> untilTimeLimit(Duration timeToWaitForMoreEvents, Suppressed.BufferConfig bufferConfig) Configure the suppression to waittimeToWaitForMoreEvents
amount of time after receiving a record before emitting it further downstream. If another record for the same key arrives in the mean time, it replaces the first record in the buffer but does not re-start the timer.- Type Parameters:
K
- The key type for the KTable to apply this suppression to.- Parameters:
timeToWaitForMoreEvents
- The amount of time to wait, per record, for new events.bufferConfig
- A configuration specifying how much space to use for buffering intermediate results.- Returns:
- a suppression configuration
-
withName
Use the specified name for the suppression node in the topology.This can be used to insert a suppression without changing the rest of the topology names (and therefore not requiring an application reset).
Note however, that once a suppression has buffered some records, removing it from the topology would cause the loss of those records.
A suppression can be "disabled" with the configuration
untilTimeLimit(Duration.ZERO, ...
.- Parameters:
name
- The name to be used for the suppression node and changelog topic- Returns:
- The same configuration with the addition of the given
name
.
-