kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From guozh...@apache.org
Subject [kafka] branch trunk updated: KAFKA-6905: Document that Transformers may be re-used by Streams (#5026)
Date Sun, 20 May 2018 01:44:28 GMT
This is an automated email from the ASF dual-hosted git repository.

guozhang pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/kafka.git


The following commit(s) were added to refs/heads/trunk by this push:
     new f65f3a8  KAFKA-6905: Document that Transformers may be re-used by Streams (#5026)
f65f3a8 is described below

commit f65f3a878fc23c658ba2e62f9a1863a7b3d2bd4f
Author: David Glasser <glasser@meteor.com>
AuthorDate: Sat May 19 18:44:20 2018 -0700

    KAFKA-6905: Document that Transformers may be re-used by Streams (#5026)
    
    This is a follow-up to #5022 which added documentation to the Processor
    interface. This commit adds similar documentation to Transformer and
    ValueTransformer.
    
    Also, s/processor/transformer/ in the close() docs.
    
    Reviewers: Matthias J. Sax <matthias@confluent.io>, Guozhang Wang <wangguoz@gmail.com>
---
 .../src/main/java/org/apache/kafka/streams/kstream/Transformer.java  | 5 ++++-
 .../main/java/org/apache/kafka/streams/kstream/ValueTransformer.java | 5 ++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/Transformer.java b/streams/src/main/java/org/apache/kafka/streams/kstream/Transformer.java
index bbf8c25..43b6115 100644
--- a/streams/src/main/java/org/apache/kafka/streams/kstream/Transformer.java
+++ b/streams/src/main/java/org/apache/kafka/streams/kstream/Transformer.java
@@ -51,6 +51,8 @@ public interface Transformer<K, V, R> {
     /**
      * Initialize this transformer.
      * This is called once per instance when the topology gets initialized.
+     * When the framework is done with the transformer, {@link #close()} will be called on
it; the
+     * framework may later re-use the transformer by calling {@link #init()} again.
      * <p>
      * The provided {@link ProcessorContext context} can be used to access topology and record
meta data, to
      * {@link ProcessorContext#schedule(long, PunctuationType, Punctuator) schedule} a method
to be
@@ -81,7 +83,8 @@ public interface Transformer<K, V, R> {
     R transform(final K key, final V value);
 
     /**
-     * Close this processor and clean up any resources.
+     * Close this transformer and clean up any resources. The framework may
+     * later re-use this transformer by calling {@link #init()} on it again.
      * <p>
      * To generate new {@link KeyValue} pairs {@link ProcessorContext#forward(Object, Object)}
and
      * {@link ProcessorContext#forward(Object, Object, To)} can be used.
diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/ValueTransformer.java
b/streams/src/main/java/org/apache/kafka/streams/kstream/ValueTransformer.java
index c0da38a..866cce8 100644
--- a/streams/src/main/java/org/apache/kafka/streams/kstream/ValueTransformer.java
+++ b/streams/src/main/java/org/apache/kafka/streams/kstream/ValueTransformer.java
@@ -50,6 +50,8 @@ public interface ValueTransformer<V, VR> {
     /**
      * Initialize this transformer.
      * This is called once per instance when the topology gets initialized.
+     * When the framework is done with the transformer, {@link #close()} will be called on
it; the
+     * framework may later re-use the transformer by calling {@link #init()} again.
      * <p>
      * The provided {@link ProcessorContext context} can be used to access topology and record
meta data, to
      * {@link ProcessorContext#schedule(long, PunctuationType, Punctuator) schedule} a method
to be
@@ -84,7 +86,8 @@ public interface ValueTransformer<V, VR> {
     VR transform(final V value);
 
     /**
-     * Close this processor and clean up any resources.
+     * Close this transformer and clean up any resources. The framework may
+     * later re-use this transformer by calling {@link #init()} on it again.
      * <p>
      * It is not possible to return any new output records within {@code close()}.
      * Using {@link ProcessorContext#forward(Object, Object)} or {@link ProcessorContext#forward(Object,
Object, To)}

-- 
To stop receiving notification emails like this one, please contact
guozhang@apache.org.

Mime
View raw message