[ 
https://issues.apache.org/jira/browse/KAFKA-8596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16872528#comment-16872528
 ] 

Matthias J. Sax commented on KAFKA-8596:
----------------------------------------

Throwing an exception is not possible, because the error occurs on a different 
thread, ie, not your "main" thread that calls `KafkaStreams#start()`.

However, you can register a uncaught exception handler callback as described in 
the docs: 
[https://kafka.apache.org/23/documentation/streams/developer-guide/write-streams.html]
{code:java}
KafkaStreams#setUncaughtExceptionHandler(...)
{code}
This allows you to get notified about the error in the main thread and you can 
react to it accordignly.

Please let us know if this works for you. I think this ticket should be closed 
as "not a problem" as the handler should provide the functionality you request.

> Kafka topic pre-creation error message needs to be passed to application as 
> an exception
> ----------------------------------------------------------------------------------------
>
>                 Key: KAFKA-8596
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8596
>             Project: Kafka
>          Issue Type: Improvement
>          Components: streams
>    Affects Versions: 2.1.1
>            Reporter: Ashish Vyas
>            Priority: Minor
>
> If i don't have a topic pre-created, I get an error log that reads "is 
> unknown yet during rebalance, please make sure they have been pre-created 
> before starting the Streams application." Ideally I expect an exception here 
> being thrown that I can catch in my application and decide what I want to do. 
>  
> Without this, my app keeps running and actual functionality doesn't work 
> making it time consuming to debug. I want to stop the application right at 
> this point.
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to