What is the difference between asynchronous service task vs External task

can some one guide me on this.
1.Both works in async manner.
2. Both can send back results to calling system?
3. which on to choose

The main difference between the two options is the way in which the task is executed. An asynchronous service task that has one of the implementations Java Class, Delegate Expression or Expression (and event connector) will attempt to invoke a component from an execution thread of the process engine. Making it asynchronous only determines the transaction boundary for executing it.

A task with an External implementation type, will not be executed by a process engine thread. The engine will create a unit of work and register it for the selected topic to distinguish one task type from the other. Then another process, typically external to the application the process engine runs in, is expected to request work for that topic and if there are tasks to be executed, lock them and execute them and mark them as complete with the process engine. There are client libraries for different implementation languages to interact with external tasks in the process engine as one of these “workers”.

So yes, both work in an asynchronous manner and can report back information to the system. In one case, the engine is making the call, in the other there is another component involved, calling the engine.

When to use which is very dependent on your set up. If you run an embedded process engine in a Java application, there’s not always the need to use external tasks, although there can be reasons to do so (parallelizing workers, for instance). If you’re using the process engine to orchestrate work that’s primarily written in things other than Java, external tasks are a typical choice.

1 Like

Thanks @tiesebarrell

Is it the same applies to async: extending AbstractBPMactivitybehaviour vs external task

I’m not quite sure what you mean by that. What would you like to achieve in addition to the existing options by extending the default behaviour?