@ProviderType
public interface LifecycleControl
Modifier and Type | Interface and Description |
---|---|
static interface |
LifecycleControl.TerminationEvent
An event interface for non-user initiated non-recoverable receiver or publisher unsolicited
termination for which applications can listen.
|
static interface |
LifecycleControl.TerminationNotificationListener
A callback listener for notifications about non-recoverable receiver or publisher
interruptions.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isRunning()
Checks if the process was successfully started and not yet stopped.
|
boolean |
isTerminated()
Checks if message delivery process is terminated
|
boolean |
isTerminating()
Checks if message delivery process termination is ongoing
|
void |
setTerminationNotificationListener(LifecycleControl.TerminationNotificationListener listener)
Adds a callback to listen for non-recoverable receiver or publisher interruption events.
|
LifecycleControl |
start()
Enables service regular duties.
|
void |
terminate(long gracePeriod)
Disables gracefully the regular duties of a receiver or publisher.
|
boolean isRunning()
false
if process was not started or already stopped, otherwise true
boolean isTerminated()
true
if message delivery process is terminated, otherwise false
boolean isTerminating()
true
if the message delivery process being terminated, but termination is not
finished, otherwise false
void setTerminationNotificationListener(LifecycleControl.TerminationNotificationListener listener)
listener
- the service listenerLifecycleControl start() throws PubSubPlusClientException, IllegalStateException
PubSubPlusClientException
- if the instance fails to start for some internal reasonIllegalStateException
- if the instance was previously terminated, being terminated,
or the method has been invoked at an illegal or at an
inappropriate time for some another reasonvoid terminate(long gracePeriod) throws PubSubPlusClientException.IncompleteMessageDeliveryException, PubSubPlusClientException, IllegalStateException
Any attempts to call this method renders the instance permanently terminated, even if this method completes.
You can use gracePeriod == 0
for non-graceful shutdown that ignores unfinished
tasks or in-flight messages.
gracePeriod
- >0 defines the termination grace period, the amount of time given
to finish regular tasks before a non-graceful interruption of duties take
place, measured in milliseconds. A value of 0 can be used to specify no
grace period so that all unfinished tasks or in-flight messages are ignored.
Values < 0 are illegal.
Values in a few milliseconds range may not be applied to be 100% accurate.
PubSubPlusClientException.IncompleteMessageDeliveryException
- if some incomplete processed messages are discovered
at the call time point of the callPubSubPlusClientException
- if the service termination experienced some
exception for an internal reason. Even so, an
exception occurred so the given instance of a
service can be considered terminatedIllegalStateException
- if the method has been invoked at an illegal or
inappropriate time or for the specified gracePeriod
< 0, or for some another
reasonCopyright 2019-2024 Solace Corporation. All rights reserved.