[
https://issues.apache.org/jira/browse/KAFKA-6943?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16490638#comment-16490638
]
Antony Stubbs commented on KAFKA-6943:
--
Sorry, should have said thread, not task. For catching in the
UncaughtExceptionHandler...
{code:java}
myKafkaStream.setUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()
{
@Override
void uncaughtException(Thread t, Throwable e) {
if(config.dieOnAnyUncaughtException){
log.error("Uncaught exception in Kafka Streams thread: " t.toString +
". Shutting down...", e)
def state = myKafkaStream.state()
log.debug("State is: " + state)
if (state != KafkaStreams.State.PENDING_SHUTDOWN) {
log.debug("Started...")
def threadCloseTimeoutMs = 1
myKafkaStream.close(threadCloseTimeoutMs, TimeUnit.MILLISECONDS)
log.debug("Finished...")
}
}
}
});
{code:java}
sort of thing..
> Have option to shutdown KS cleanly if any task crashes, or if all tasks crash
> -
>
> Key: KAFKA-6943
> URL: https://issues.apache.org/jira/browse/KAFKA-6943
> Project: Kafka
> Issue Type: Improvement
> Components: streams
>Affects Versions: 1.1.0
>Reporter: Antony Stubbs
>Priority: Major
>
> ATM users have to implement this themselves. Might be nice to have an option
> to configure that if all tasks crash, or if any crash, to initiate clean
> shutdown.
> This also has a gotcha where atm if you call KS#close without a timeout, from
> the uncaught exception handler, you dead lock.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)