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: MINOR: Docs on state store instantiation (#5698)
Date Wed, 03 Oct 2018 18:20:57 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 7bd8ada  MINOR: Docs on state store instantiation (#5698)
7bd8ada is described below

commit 7bd8ada8e21cd9717eea6916a5a55274a49fdeda
Author: Guozhang Wang <wangguoz@gmail.com>
AuthorDate: Wed Oct 3 11:20:47 2018 -0700

    MINOR: Docs on state store instantiation (#5698)
    
    Reviewers: Bill Bejeck <bill@confluent.io>, Matthias J. Sax <matthias@confluent.io>
---
 docs/streams/developer-guide/processor-api.html             |  3 +++
 .../java/org/apache/kafka/streams/processor/StateStore.java | 13 ++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/docs/streams/developer-guide/processor-api.html b/docs/streams/developer-guide/processor-api.html
index cb45cd9..ae43360 100644
--- a/docs/streams/developer-guide/processor-api.html
+++ b/docs/streams/developer-guide/processor-api.html
@@ -347,6 +347,9 @@
                     The primary interface to implement for the store is
                     <code class="docutils literal"><span class="pre">org.apache.kafka.streams.processor.StateStore</span></code>.
 Kafka Streams also has a few extended interfaces such
                     as <code class="docutils literal"><span class="pre">KeyValueStore</span></code>.</p>
+                <p>Note that your customized <code class="docutils literal"><span
class="pre">org.apache.kafka.streams.processor.StateStore</span></code> implementation
also needs to provide the logic on how to restore the state
+                    via the <code class="docutils literal"><span class="pre">org.apache.kafka.streams.processor.StateRestoreCallback</span></code>
or <code class="docutils literal"><span class="pre">org.apache.kafka.streams.processor.BatchingStateRestoreCallback</span></code>
interface.
+                    Details on how to instantiate these interfaces can be found in the <a
class="reference external" href="../../../javadoc/org/apache/kafka/streams/processor/StateStore.html">javadocs</a>.</p>
                 <p>You also need to provide a &#8220;builder&#8221; for the
store by implementing the
                     <code class="docutils literal"><span class="pre">org.apache.kafka.streams.state.StoreBuilder</span></code>
interface, which Kafka Streams uses to create instances of
                     your store.</p>
diff --git a/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java b/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java
index f098cd0..df53ee2 100644
--- a/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java
+++ b/streams/src/main/java/org/apache/kafka/streams/processor/StateStore.java
@@ -46,7 +46,18 @@ public interface StateStore {
     String name();
 
     /**
-     * Initializes this state store
+     * Initializes this state store.
+     * <p>
+     * The implementation of this function must register the root store in the context via
the
+     * {@link ProcessorContext#register(StateStore, StateRestoreCallback)} function, where
the
+     * first {@link StateStore} parameter should always be the passed-in {@code root} object,
and
+     * the second parameter should be an object of user's implementation
+     * of the {@link StateRestoreCallback} interface used for restoring the state store from
the changelog.
+     * <p>
+     * Note that if the state store engine itself supports bulk writes, users can implement
another
+     * interface {@link BatchingStateRestoreCallback} which extends {@link StateRestoreCallback}
to
+     * let users implement bulk-load restoration logic instead of restoring one record at
a time.
+     *
      * @throws IllegalStateException If store gets registered after initialized is already
finished
      * @throws StreamsException if the store's change log does not contain the partition
      */


Mime
View raw message