Stack Overflow for Teams is a private, secure spot for you and
your coworkers to find and share information.
Learn more
As describe in the docs (
https://kafka.apache.org/11/documentation/streams/tutorial
), it's recommended to register a shutdown hook that calls
KafkaStreams#close()
for a clean shutdown:
final CountDownLatch latch = new CountDownLatch(1);
// attach shutdown handler to catch control-c
Runtime.getRuntime().addShutdownHook(new Thread("streams-shutdown-hook") {
@Override
public void run() {
streams.close();
latch.countDown();
try {
streams.start();
latch.await();
} catch (Throwable e) {
System.exit(1);
System.exit(0);
–
–
–
–
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
site design / logo © 2020 Stack Exchange Inc; user contributions licensed under cc by-sa 4.0
with attribution required. rev 2020.4.3.36511