Hi,
I have below camunda process:
and listens to topic:
I intend to use external task(this is supposed to complete tasks) in the same SpringBoot app and also use Camunda Java API and not REST API to retrieve the external tasks to complete them.
This is the delegate code that is supposed to retrieve the task and complete it.
Here is Kotlin delegate code that tries to fetch tasks:
@Component
class ExternalTaskExecutor(
private val externalTaskService: ExternalTaskService
) : JavaDelegate {
private val tasks = externalTaskService.fetchAndLock(1, "breakConcurrencyWorker")
.topic("breakConcurrency", 60L * 1000L)
.execute()
override fun execute(execution: DelegateExecution) {
val taskId = tasks.firstOrNull()?.id
if (taskId != null) {
externalTaskService.complete(taskId, "breakConcurrencyWorker")
}
}
}
But the “tasks” list is empty even when there are camunda process instances waiting at the “external task” activity. Why?