That works, thanks.

Tim Ward

-----Original Message-----
From: Bill Bejeck <b...@confluent.io>
Sent: 21 September 2018 15:06
To: users@kafka.apache.org
Subject: Re: Terminate Streams application from within Transformer?

Hi Tim,

I wouldn't recommend System.exit(), as it won't give streams a chance to go
through a shutdown process. You can throw a RuntimeException from inside
the Transformer.transform() method and I will bubble up and the Steams
application will shut down.

-Bill

On Fri, Sep 21, 2018 at 6:59 AM Tim Ward <tim.w...@origamienergy.com> wrote:

> From within a Transformer I detect an error, which is a temporary error,
> such as failure to get a connection to an external microservice.
>
> A typical scenario is that Kuberbetes is starting up a bunch of pods, of
> which mine is one, and they come up in the wrong order. This is perfectly
> normal, and the correct behaviour is for your application to terminate -
> it'll be restarted later, and it should try again, and in due course it'll
> work.
>
> So, inside Transformer.transform() I get one of these errors. I want to
> terminate the application, without of course committing the record
> currently being processed, so that on application restart it re-processes
> this message and everything works fine.
>
> How should I do this? System.exit() or something more sophisticated?
>
> Tim Ward
>
> The contents of this email and any attachment are confidential to the
> intended recipient(s). If you are not an intended recipient: (i) do not
> use, disclose, distribute, copy or publish this email or its contents; (ii)
> please contact the sender immediately; and (iii) delete this email. Our
> privacy policy is available here:
> https://origamienergy.com/privacy-policy/. Origami Energy Limited
> (company number 8619644); Origami Storage Limited (company number 10436515)
> and OSSPV001 Limited (company number 10933403), each registered in England
> and each with a registered office at: Ashcombe Court, Woolsack Way,
> Godalming, GU7 1LQ.
>
The contents of this email and any attachment are confidential to the intended 
recipient(s). If you are not an intended recipient: (i) do not use, disclose, 
distribute, copy or publish this email or its contents; (ii) please contact the 
sender immediately; and (iii) delete this email. Our privacy policy is 
available here: https://origamienergy.com/privacy-policy/. Origami Energy 
Limited (company number 8619644); Origami Storage Limited (company number 
10436515) and OSSPV001 Limited (company number 10933403), each registered in 
England and each with a registered office at: Ashcombe Court, Woolsack Way, 
Godalming, GU7 1LQ.

Reply via email to