@ProviderType
public interface AsyncLifecycleControl
See also: CompletableFuture for Asynchronous Programming in Java 8
Modifier and Type | Method and Description |
---|---|
<T> CompletableFuture<T> |
startAsync()
Asynchronously starts service for consuming/publishing operations.
|
<T> void |
startAsync(CompletionListener<T> startListener)
Asynchronously starts service for consuming/publishing operations using a callback for
completion notification.
|
void |
terminateAsync(CompletionListener<Void> terminationListener,
long gracePeriod)
Asynchronously terminates (gracefully) the service for consuming/publishing operations using a
callback for a completion notification.
|
CompletableFuture<Void> |
terminateAsync(long gracePeriod)
Asynchronously terminates (gracefully) the service for consuming/publishing operations.
|
<T> CompletableFuture<T> startAsync() throws PubSubPlusClientException, IllegalStateException
This method is an idempotent operation when no another connect/disconnect operation is ongoing.
PubSubPlusClientException
- if the messaging service will not start in the futureIllegalStateException
- if the method has been invoked at an illegal or inappropriate
time<T> void startAsync(CompletionListener<T> startListener) throws PubSubPlusClientException, IllegalStateException
T
- the type of response returned on a successful start operationstartListener
- the callback for future notifications about the completion of the start
processIllegalStateException
- if the method has been invoked at an illegal or inappropriate
timePubSubPlusClientException
- if the messaging service will not start in the futurevoid terminateAsync(CompletionListener<Void> terminationListener, long gracePeriod) throws PubSubPlusClientException, IllegalStateException
This method is idempotent.
Graceful shutdown is designed to make a best-effort to prevent loss of the in-flight or cached data during shutdown.
Attempt to call this method renders service instance permanently terminated, even if
the terminationListener
callback was notified of an exception.
gracePeriod
- the termination grace period, which is the amount of time given to
finish regular tasks before the non-graceful interruption of duties
takes place, in milliseconds. A valid value is > 1.terminationListener
- the callback for future notifications about the completion of the
termination processPubSubPlusClientException
- if the service will not be possible to terminate in the
futureIllegalStateException
- if the method has been invoked at an illegal or inappropriate
time for some another reasonCompletableFuture<Void> terminateAsync(long gracePeriod) throws PubSubPlusClientException, IllegalStateException
This method is idempotent.
Graceful shutdown is designed to make a best-effort to prevent loss of the in-flight or cached data during shutdown.
Attempt to call this method renders service instance permanently terminated, even if this method completes exceptionally.
Returned CompletableFuture
can be finished with
PubSubPlusClientException.IncompleteMessageDeliveryException
when some incomplete processed messages are
discovered.
gracePeriod
- the termination grace period, which is the amount of time given to finish
regular tasks before the non-graceful interruption of duties takes place, in
milliseconds. A valid value is > 1.PubSubPlusClientException
- if the service will not be possible to terminate in the
futureIllegalStateException
- if the method has been invoked at an illegal or inappropriate
time for some another reasonCopyright 2019-2024 Solace Corporation. All rights reserved.