This repository contains a simple persistent PostgreSQL-based task processor with RESTful API.
POST /api/v1/task
Request Body
{
"runnerName": "Abc",
"properties": {
"a": "aValue",
"b": 1
}
}
Response Body
{
"taskId": 1,
}
GET /api/v1/task/{taskId}/info
Path Parameters
taskId
- ID of the task to get information about
Response Body
{
"status": COMPLETED
}
Create class that implements TaskRunner
interface and annotate it with @Component
@Component
class AbcRunner : TaskRunner {
override val name = "Abc"
override fun run(context: TaskContext) {
// do something
}
}
Create task and submit it using TaskService
val task = Task.Builder(runnerName = "Abc")
.withProperty("a", TextNode("aValue"))
.withProperty("b", LongNode(1))
.build()
taskService.submit(
task,
delay = Duration.ZERO,
)