Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
890 views
in Technique[技术] by (71.8m points)

business process management - Camunda BPM External Task swallowed its retries: How to react (e.g. with Conditional Flow)?

I want to periodically query an external system (DNS server in my case) for arrival of some information up to some maximum amount of retries. How to react if this amount of retries is executed without success?

Now more details regarding the setup I've programmed so far:

Within Camunda BPM Engine I've configured an External Task, its topic subscribed by a Java program. This program executes the check (against DNS server). If this check succeeds, the task is marked as completed:

externalTaskService.complete(externalTask);

Otherwise as failed setting a decremented retry counter (together with a retry timeout):

externalTaskService.handleFailure(externalTask,
   "Failure",
   "[More failure details]",
   decrementedRetries,
   RETRY_TIMEOUT_MILLIS);

After swallowing all retries (decrementedRetries == 0) the External Task is marked in Camunda BPM Engine with a red sign, stating the amount of failed Task executions, etc.

Now I would like to model another Task to react to this situation (execution of compensating steps). How would you recommend to model triggering this Task?

I've tried applying a Conditional Flow pointing from the first to the compensating second Task, but have not found any hint how to configure this Conditional Flow instance to react only to task instances with retries < 1.

Thanks

Christian


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

Please log in or register to answer this question.

1 Answer

0 votes
by (71.8m points)

Incidents (the 'red sign') are meant for technical errors, which can be resolved by incrementing the retries once the underlying issue has been resolved.

Issues that occur during the processing of a task which should be handled via the process model can be handles with data or events, e.g. communicated via BPMN Error or Escalation events.

Many options:

  • the return value of the task worker: Return a data (e.g. error code) and check it in the expressions leaving an exclusive data-based gateway following the task
  • BPMN error: handleBpmnError (https://camunda.com/blog/2020/10/more-from-camunda-bpm-java-external-task-client-bpm-assert/) to return this specific error for which the BPMN2 standards offers events. Attach a catching BPMN Error boundary event to your task and connect it to the reacting task.
  • Escalation: Similar to BPMN error but can also be non-interrupting. Throw escalation event, attach a boundary event and connect to reacting task (https://docs.camunda.org/manual/latest/reference/bpmn20/events/escalation-events/)
  • Event-based sub processes: can also be used to define event handlers and route to your reacting task
  • Conditional event: set a data for the error and observe it in a catching conditional event. Then react in the conditional event

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to JiKe DevOps Community for programmer and developer-Open, Learning and Share
...