public interface IApplicationExitReporter
More precisely, the idea is that application must not perform an exit on their own. That will be detected by their hosting runtime environment (i.e SHiva, Storm, Flink, Spark, Kubernetes, whatever) that in turn have the problem to know =what to do with that. Relaunch the application ? Do nothing ?
The punch scheme is different, an application stays alive but fires a notification to be properly stopped from outside.
This interface is thus to be used by all punchlines apps once they decide they should stop.
To use this create one using:
IApplicationExitReporter reporter = new ApplicationExitReporterImpl(topic, cluster); .. reporter.exit(..)
On simple platform or platform without Kafka you can use :IApplicationExitReporter reporter = new ApplicationExitReporterImpl(null, null);
The start method will then have no effect. And your platform does not have to be configured with Kafka.
Modifier and Type | Method and Description |
---|---|
void |
exit(int exitCode)
Request someone to stop us with the provided exit code.
|
void exit(int exitCode)
The exit request will be catched by some admin service that will issue a stop command in turn making your application exit.
exitCode
- the exitCode you want, 0 for success, any other for failure.Copyright © 2014–2023. All rights reserved.