We use remote engine server model and integrate it with our service with the engine via RestAPIs. We use external Tasks for service tasks to decouple services and to be able to scale up the system.
Now I want to use Task Listener feature for UserTasks but it seems it does not support external tasks and it has java class option. Is there any way to use TaskListener without using embedded engine model?
You can still use the external task implementations as @davidgs pointed out and you are most likely already doing. That’s for the main behaviour implementation of the task itself. If you need additional behaviour on lifecyle events of the task, there’s only the Java way do do that at the moment. There’s no “external” implementation type for those Execution/TaskListeners.
That doesn’t mean you can’t combine the two approaches: you could still use external task implementations and have Execution/TaskListeners configured on the model that execute Java code. This will work perfectly fine. But the listeners have to be implemented in Java and configured either on the model or attached automatically from a BpmnParseListener (which can be very useful for re-use)
I am already using Java in my application but I don’t embed the engine in my application. So I have a Camunda engine image and a java application image separately. I use Camunda external task libraries to implement external Tasks with defined topics in my BPMNs. But now I am a little confused about this Task Listener implementation. I think because my Camunda engine is separate from my application and doesn’t know about my Java application I can’t use its classes in BPMN in java class field for java delegate way. Am I wrong?
I will appreciate it if you could clarify it for me.
Sorry if that confused you. You’re right, in your process engine application, you can only access classes that are part of that application. You can’t implement the TaskListeners in your application where you implement the external task workers, because that is a separate process and the classes are not available to the process engine. The engine expects to be able to execute the listeners on an application thread available to the engine.
So if you want to add TaskListeners to (some of) your user tasks, that would mean you would have to add the classes to the application that runs the process engine. Which means that you would have the process implementation split between two applications and if you need to make changes, you might have to update both.