Recently started task does not listed in rest API query result

Hi camunda,
I added an execution listener (through using camunda reactor extension), and listen to events of starting tasks.
then I send notifications (using RabbitMQ) to another application to handle that tasks as external tasks. but when the second app asks camunda to get details of the started task, sometimes, it gets an empty list, meaning that no task with the given activity instance id exists. but if I wait a second and try again, the task exists and the details return. what’s wrong? Is camunda notifies an start event before persisting the task !!? is notification not async?


Hi @mjalil,

regarding your questions:



An execution listener is invoked synchronously inside the current transaction. So in your case, I assume that the transaction is not committed, yet.

Best regards,

So, what to do? I send an asynchronous rabbit notification using ExecutorService.submit()
like this. is it OK?

public void notify(DelegateExecution delegateExecution) {
        Runnable r = () -> {
            try {
                System.out.println("delegateExecution = [" + delegateExecution.getEventName() + "]" + delegateExecution.getCurrentActivityId() + delegateExecution.getCurrentActivityName());
            } catch (Exception e) {

This works only if the transaction is committed after 1s :wink:

You can also bind RabbitMQ to the current transaction. Or use the TransactionListener via Context.getCommandContext().getTransactionContext().addTransactionListener(COMMITTED, ctx -> sendMessageViaRabbitMQ()).

1 Like

Hi @Philipp_Ossler, Can you provide detailed solution on implementing TransactionListener as unable to find much docs on this.
I am also facing similar issue, need to post to ActiveMQ only after current task committed.