public interface PollingSourceHandler extends SourceHandler
The handler is polled at the frequency defined by the
configured polling interval. The next poll is called after the interval time
has expired starting from when the previous poll completed.
A polling source handler will not be polled until the
start method has been called. It will also not
be polled if the pause method has been called
and polling will not resume until the resume
method is called.
An object that implements this interface must be returned when the
GatewayApplication.addPollingSource method is called. A different object
must be returned for each different service. The object must implement the
poll() method to publish any update(s) to Diffusion using the supplied
Publisher.
SourceHandler.SourceServicePropertiesServiceHandler.PauseReason, ServiceHandler.ResumeReason| Modifier and Type | Method and Description |
|---|---|
CompletableFuture<?> |
poll()
Polls the handler for a new value or values.
|
getSourceServicePropertiespause, resume, start, stopCompletableFuture<?> poll()
The handler should use its Publisher to publish all available
updates to Diffusion and then complete.
If when called, the handler is no longer able to operate then it should
use its StateHandler to report this to the framework and complete
successfully.
This method must return CompletableFuture that completes
successfully when the poll processing is complete. The method can choose
to initiate the processing in a separate thread and return immediately or
block until all processing is done.
If the task completes successfully, the CompletableFuture result should be null. The result type is any rather than Void to provide forward compatibility with future iterations of this API that may provide a non-null result with a more specific result type.
If the future completes exceptionally the framework will stop
polling the handler and the service will go to a
PAUSED state.
If an unchecked exception is thrown, instead of returning a failed completable future, the exception will be caught and logged, but this will not have any effect on further poll calls.
Copyright © 2025 DiffusionData Limited. All rights reserved.