卡夫卡连接处理

时间:2017-06-12 07:45:19

标签: error-handling apache-kafka spark-streaming

我使用kafka API从createDirectStream()使用数据。我想catch ClosedChannelException并处理与zookeeper和kafka主题的断开连接。

通过测试,我只能这样做:

try { myStreamingContext.awaitTermination }
catch { case foo:SparkException => if (foo.getMessage contains """ClosedChannelException""") /*do something*/ }

看起来例外只是" catchable"与上述相符,或者至少不符合我预期的try { val stream = createDirectStream([...]) } [...]

是否有任何方法可以处理这个(和其他连接错误)应用程序端?

0 个答案:

没有答案