External task

I have followed the tutorial and did the loan approval sample which has the user task,Now I want to convert it to external task,so I have placed the service task before approve request in bpmn file and have put topic and type but how to call the approval request task from service which is configured as a external taskloan-approval.bpmn (4.0 KB) (before converting to external task)
loan-approval.bpmn (5.0 KB) (after converting to external task).I have followed https://docs.camunda.org/manual/7.7/user-guide/process-engine/external-tasks/

Okay, what is your question?

I want to convert user task to external task.and trigger them.How can I start that loan approval user task as an external task

Your second model looks good. Remove the user task, connect the service task to the end event. Voila.

I assume you are stuck with getting the external tasks executed. What did you try so far to make it work?

I am not able to find a way to execute the external task,that is where I am stuck ,and little confused with its implementation.Is it like from the service task I need to trigger the user task now?I want execute the user task as external task

Do you want to use REST or Java API?

I want to use REST to implement that part

Okay, here are the basic steps:

  1. Start a process instance
  2. Fetch and lock available external tasks. The topic should match the value defined in XML. The lock timeout should be a value that is larger than the time you expect to take the task to be processed. This is the REST request: https://docs.camunda.org/manual/7.7/reference/rest/external-task/fetch/
  3. Once an external task is processed, complete it via https://docs.camunda.org/manual/7.7/reference/rest/external-task/post-complete/

Step 2 should be executed continuously, i.e. try to fetch new tasks every x seconds or whenever you have available processing resources.

after locking the external task,how to execute it by worker?

Executing the fetch and lock request returns the locked tasks. Your worker can then process them. Maybe this is a misunderstanding: Your worker must make the fetch and lock request in the external-task model.

can you provide me a reference where I can go through worker and how they actually work and implement it?

I believe the blog post is the only example there is: https://blog.camunda.org/post/2015/11/external-tasks/

I went through the blog,I followed a sample from git and created a model,when I start the process,it will stop at service task and when I try to fetch and lock the external task,it needs a worker id,I am stuck with this concept of worker part,could please explain me that,I am not getting it into my head,simple.bpmn (8.8 KB),
When I start an external Task how does this worker come into picture,do I need to configure some thing to get worker Id,
I want to do this through rest api. This is my bpmn file simple.bpmn (8.8 KB)

The worker id should be chosen by you and should be unique per worker instance. Imagine you have ten workers that do image processing. Then every worker that executes fetch and lock should have a unique id. With the help of the worker id, the process engine is able to enforce that only the worker that has currently locked a task can also complete it, etc.

If there is more unclear to you, please describe in your own words how you think the concept works. Then we can give you feedback. I think that makes more sense than describing the entire concept from the ground up. That’s what the docs are for.

1 Like

when I start the process,the external task is getting triggered,from my understanding and from external task api response,I worker id is null,how do I assign worker Id to this external process,What I thought was when I trigger the process and external task is triggered,the worker task which is there in the bpmn file simple.bpmn (8.8 KB)
will be automatically triggered,If I am wrong please let me know

Maybe we should take one step back and ignore external tasks for a moment.

  1. What do you want to implement?
  2. What should the service task do from a business perspective?
  3. In which technology (i.e. programming language, runtime environment) would you like to implement the service task?

I want to implement in spring boot,I want to understand the core concept of external tasks,so when some one is working on a task,no one else should work with it,in that case I need to lock the task,finish it and unlock it.

Correct. When you lock the task you provide a worker id, see the workerId parameter here: https://docs.camunda.org/manual/7.7/reference/rest/external-task/fetch/

The process engine never triggers your worker. Instead, your worker must poll for tasks by calling the fetch and lock API continuously. That’s what external means in this context. The process engine is completely decoupled from the worker and therefore is not able to push tasks to it.

1 Like

Thanks a lot,thank you for explaining me clearly

can we show the worker workflow in camunda, as it is done externally completely,is there any way to show the task status of the worker in the cockpit?