Interface Transformer<K,V,R>

Type Parameters:
K - key type
V - value type
R - KeyValue return type (both key and value type can be set arbitrarily)

public interface Transformer<K,V,R>
The Transformer interface is for stateful mapping of an input record to zero, one, or multiple new output records (both key and value type can be altered arbitrarily). 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 transform(Object, Object) (cf. KeyValueMapper for stateless record transformation). Additionally, this Transformer can schedule a method to be called periodically with the provided context.

Use TransformerSupplier to provide new instances of Transformer to Kafka Stream's runtime.

If only a record's value should be modified ValueTransformer can be used.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Close this transformer and clean up any resources.
    void
    Initialize this transformer.
    transform(K key, V value)
    Transform the record with the given key and value.