Reputation: 717
Version 1.0
Let's say in the punctuate method of lowlevel processor, creation of a dummy file fails with an exception. How to stop the stream application when an exception is encountered?
I was wondering if there is a way to throw an exception, but could not add throw clause on the init method. The following requires to be surrounded by a try-catch OR an exception to be thrown and can't use either one. Please suggest.
Files.createFile(Paths.get(dummyFile));
Upvotes: 1
Views: 741
Reputation: 3955
you could wrap IOException
into any unchecked exception like RuntimeException
, or would be better to create your own that will extend from RuntimeException
, and throw it. if your method throw exception for any incoming message, stream will be in a dead state, so stop consuming messages until you restart application
Upvotes: 1