public interface StateHandler
 Each service is provided with a state handler which it can use to report its
 current status at any time. It may also be used to enquire upon the current
 state of the service.
 
 A state handler instance is for the exclusive use of the service handler for
 which it was created and may not be used across services or after the service
 has been stopped.
| Modifier and Type | Interface and Description | 
|---|---|
static class  | 
StateHandler.Status
Indicates the type of status being reported when using the
  
reportStatus(com.diffusiondata.gateway.framework.StateHandler.Status, java.lang.String, java.lang.String) method. | 
| Modifier and Type | Method and Description | 
|---|---|
ServiceState | 
getState()
Returns the current state of the service. 
 | 
CompletableFuture<ServiceState> | 
reportStatus(StateHandler.Status status,
            String title,
            String description)
Reports current status. 
 | 
CompletableFuture<ServiceState> reportStatus(StateHandler.Status status, String title, String description)
This should be used whenever the handler's status changes in some way. For example, if some failure occurs within the handler or the application, which renders the handler inoperative. It can also be used to report that a service is now (at least partly) operational, from the point of view of the application.
 Reporting a RED status for an
 ACTIVE service will cause the framework to
 assume that the handler is no longer operating normally and the
 ServiceHandler.pause(com.diffusiondata.gateway.framework.ServiceHandler.PauseReason) method will be called with a reason of
 APPLICATION_ERROR.
 This changes the service state to PAUSED
 which is returned when pause completes.
 
 Reporting a RED status for a service that is not
 ACTIVE will have no effect but the status
 message provided will become the latest one exposed to the Diffusion
 console.
 
 Reporting a GREEN or AMBER
 status will notify the framework that the handler is now (at least
 partly) operational. Hence, if the RED status was
 previously reported, the ServiceHandler.resume(com.diffusiondata.gateway.framework.ServiceHandler.ResumeReason) method will be
 called with a reason of APPLICATION_RECOVERED and the state will become
 ACTIVE when resume completes. However, the
 service may still remain PAUSED if it
 had been previously paused by user request or if there is no connection
 to the Diffusion server. The new service state is returned to indicate
 whether this is the case. If there is no other reason for the service to
 remain PAUSED then the state will become
 ACTIVE.
 
 Reporting a GREEN or AMBER
 status for a service that is already ACTIVE
 will have no effect but the status message provided will become the
 latest one exposed to the Diffusion console.
 
 If the state returned is ACTIVE then
 streaming services may start publishing updates again (if they were not
 already) and polling services will start to be polled again.
 
 If the state returned is not ACTIVE then
 updates cannot be published until the service is
 resumed.
status - the statustitle - the status titledescription - the status descriptionServiceState once the service has paused or
         resumed based on the supplied StateHandler.StatusServiceState getState()
Copyright © 2025 DiffusionData Limited. All rights reserved.