-
Type: Improvement
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 5.4.2
-
Component/s: Clustering
The goal is to be able to turn off/on 'administratively' a server.
The administrative state of the server is 'active' or 'passive'. The
server is always 'passive' when starting and it switches to 'active'
when all services are deployed (you can change a property in nuxeo.properties
to keep it 'passive'). A Rest API is available to toggle the state
(Administrators only). The Service API allows to do it too.
You can register a listener to the state of the service or
query the state (it is a transient boolean singleton for the
JVM). It will be the responsibility of services to turn themselves
off when the server becomes passive (ie, if a service fetches email
into Nuxeo, it should register a listener and stop fetching mail
when the server becomes passive).
The operational state of the server is an indication on how well
the server is doing. It is not possible to switch the operational
state, only to query it.
It is possible to contribute a set of classes with an execute method
and a maximum time in milliseconds.
To know the operational state of the server, each execute method is
run. If it returns in less than its maximum time and the server is
in 'active' state, then the operational state is ok, otherwise, it
is ko. (the result and time will be audited and logged)
We might provides default contribution that will:
- query a document with maximum time of 1 second.
- connect to a datasource with maximum time of 1 second.
A Rest API is available to query the operational state (plain text
of ok/ko, open to anonymous). This operational state is to help a
router to choose the server to send a request to.