- CPS-875Getting issue details... STATUS
Spring '@Schedule' annotation
Using Spring '@Schedule' annotation, it is possible to schdule tasks which allows us to create a watchdog.
To enable spring boot to recognise and support scheduled tasks, it is necessary to add '@EnableScheduling' as shown below
Then, all methods that is annotated with '@Schedule' is reccognised as a scheduled taskes depending on the configuration placed.
For the example below, the method 'sayHello()' is configured to run at a fixed rate of 1000ms. Fixed rate will invoke the task at every n millisecond and is useful for independent tasks.
Scheduled tasks can be configured the following ways :
Description | Notes | |
---|---|---|
Fixed rate | ||
Fixed delay | ||
Initial delay | ||
Cron |
Parameterizing the configuration
Querying state and timestamp
In NCMP, dataspace and acnhor is hardcoded
name | value |
---|---|
NCMP_DATASPACE_NAME | NCMP-Admin |
NCMP_DMI_REGISTRY_ANCHOR | ncmp-dmi-registry |
NCMP_DMI_REGISTRY_PARENT | /dmi-registry |
CPS path
The following tree diagram reflects the new dmi-registry yan model which will have the leaves 'state' and 'lock-reason'