-
Notifications
You must be signed in to change notification settings - Fork 5
Extensions
Kronos enables custom implementations of its pluggable components. There are few out of the box extensions that are available. Please refer these before implementing a custom one.
- Task Handler
- Queue
- Store
Configure the project to include and scheduler and executor dependency to build a custom extension. Kronos jars are published to a custom repository and can be included in the maven project as:
Add Cognitreee maven repository
<repositories>
<repository>
<id>cognitree</id>
<name>Cognitree Maven Repository</name>
<url>https://github.com/cognitree/mvnrepo/raw/master/releases</url>
</repository>
</repositories>
Add Kronos dependency in the maven project
<dependencies>
<dependency>
<groupId>com.cognitree.kronos</groupId>
<artifactId>scheduler</artifactId>
<version>2.2.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.cognitree.kronos</groupId>
<artifactId>executor</artifactId>
<version>2.2.4</version>
<scope>provided</scope>
</dependency>
</dependencies>
The following components are available for user implementation.
A handler is used to execute the scheduled task. At runtime, every task gets its own instance of a handler and is used to execute the task.
A custom handler needs to implement the TaskHandler interface. To configure the handler refer link.
Note: A handler instance is created per task and is used to execute the task. While writing a custom handler user needs to assure that the handler maintains the necessary state to abort the task when framework calls the abort()
method. Although implementing abort()
is not mandatory, it is advisable to implement it if the task is a long running task and you want to provide control to abort the task at runtime.
A queue is used to exchange message between the scheduler and executor.
Custom queue needs to implement two interfaces - Producer.java and Consumer.java used by kronos to produce and consume messages. To configure a custom queue refer link.
A store is used to persist the current state of Kronos.
A custom store needs to extend StoreService abstract class. To configure a custom store refer link.