This is an automated email from the ASF dual-hosted git repository. mjsax 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 fcd4fe98b9b MINOR: Update docs for for KIP-671 (#16247) fcd4fe98b9b is described below commit fcd4fe98b9bb8782d2fe6bdff5157b8b56194ad4 Author: Jim Galasyn <jim.gala...@confluent.io> AuthorDate: Fri Jun 7 14:25:46 2024 -0700 MINOR: Update docs for for KIP-671 (#16247) Reviewers: Matthias J. Sax <matth...@confluent.io> --- docs/streams/developer-guide/write-streams.html | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/docs/streams/developer-guide/write-streams.html b/docs/streams/developer-guide/write-streams.html index 03bd16328ef..aae71388a78 100644 --- a/docs/streams/developer-guide/write-streams.html +++ b/docs/streams/developer-guide/write-streams.html @@ -152,17 +152,9 @@ streams.start();</code></pre> <p>To catch any unexpected exceptions, you can set an <code class="docutils literal"><span class="pre">java.lang.Thread.UncaughtExceptionHandler</span></code> before you start the application. This handler is called whenever a stream thread is terminated by an unexpected exception:</p> <pre class="line-numbers"><code class="language-java">// Java 8+, using lambda expressions -streams.setUncaughtExceptionHandler((Thread thread, Throwable throwable) -> { - // here you should examine the throwable/exception and perform an appropriate action! -}); - - -// Java 7 -streams.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() { - public void uncaughtException(Thread thread, Throwable throwable) { - // here you should examine the throwable/exception and perform an appropriate action! - } -});</code></pre> +streams.setUncaughtExceptionHander((exception) -> StreamsUncaughtExceptionHandler.StreamThreadExceptionResponse.REPLACE_THREAD);</code></pre> + <p>The <code class="docutils literal"><span class="pre">StreamsUncaughtExceptionHandler</span></code> interface enables responding to exceptions not handled by Kafka Streams. It has one method, <code class="docutils literal"><span class="pre">handle</span></code>, that returns an enum of type <code class="docutils literal"><span class="pre">StreamThreadExceptionResponse</span></code>. You have the opportunity to define how Streams responds to the exception, with three possible valu [...] + <p>The <code class="docutils literal"><span class="pre">SHUTDOWN_APPLICATION</span></code> option is best-effort only and doesn't guarantee that all application instances will be stopped. <p>To stop the application instance, call the <code class="docutils literal"><span class="pre">KafkaStreams#close()</span></code> method:</p> <pre class="line-numbers"><code class="language-java">// Stop the Kafka Streams threads streams.close();</code></pre>