K- key type
V- value type
VR- transformed value type
public interface ValueTransformerWithKey<K,V,VR>
ValueTransformerWithKeyinterface for stateful mapping of a value to a new value (with possible new type). This is a stateful record-by-record operation, i.e,
transform(Object, Object)is invoked individually for each record of a stream and can access and modify a state that is available beyond a single call of
ValueMapperfor stateless value transformation). Additionally, this
schedulea method to be
called periodicallywith the provided context. Note that the key is read-only and should not be modified, as this can lead to corrupt partitioning. If
ValueTransformerWithKeyis applied to a
KeyValuepair record the record's key is preserved.
If a record's key and value should be modified
Transformer can be used.
|Modifier and Type||Method and Description|
Close this processor and clean up any resources.
Initialize this transformer.
Transform the given [key and] value to a new value.
void init(ProcessorContext context)
attachedto this operator can be accessed and modified arbitrarily (cf.
Note that if a
ValueTransformerWithKey is used in a
(or any other overload of
then the provided
does not guarantee that all context information will be available when
is executed, as it might be executed "out-of-band" due to some internal optimizations
applied by the Kafka Streams DSL.
readOnlyKey- the read-only key
value- the value to be transformed