How to create asynchronous service task

I am aware that there is a way to implement asynchronous tasks using custom queues, but I need to know how to make an asynchronous service task with Camunda’s built in feature. I couldn’t find tutorials related to that.

To make a service task asynchronous you need to tick the async before or async after boxes on the properties panel in design time.
That will force a commit to the database.

I did try that but i keep getting below error:

Session #1 (user: SA) is waiting to lock PUBLIC.ACT_RU_JOB while locking PUBLIC.ACT_HI_ACTINST (exclusive)."; SQL statement:
delete from ACT_RU_JOB where ID_ = ? and REV_ = ? [40001-171]
at org.h2.message.DbException.getJdbcSQLException(
at org.h2.message.DbException.get(
at org.h2.message.DbException.get(
at org.h2.table.RegularTable.doLock(
at org.h2.table.RegularTable.lock(
at org.h2.command.dml.Delete.update(
at org.h2.command.CommandContainer.update(
at org.h2.command.Command.executeUpdate(
at org.h2.jdbc.JdbcPreparedStatement.execute(
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(
at org.apache.ibatis.executor.SimpleExecutor.doUpdate(
at org.apache.ibatis.executor.BaseExecutor.update(
at org.apache.ibatis.executor.CachingExecutor.update(
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(
… 18 more

Can you please point to a tutorial that covers this concept. More specifically i am looking for a tutorial that has delegate classes for each service task , i need to know what other configurations are required other than just ticking “async” check box.

Did you study these for the async feature:

Your error looks like a problem with database locks, could be related to your database and isolation level settings:


Is it possible to achieve the same only via API, in service task implementation? We would like to use our own implementaion (subclass of AbstractBpmnActivityBehavior), which decides itself (depending on some metadata) if it works sync or async.

If it works sync it calls at the end of execute method statement


if it runs in async manner, it needs to enforce storing the process state to db. I am calling


But I am not sure if it is enough?

you can find Video Tutorial here: