Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k 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

1 Reply

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...