Question about filters

Hello everyone!

I would have a question:
Let’s assume that we have a request, and we can only run it if all of the four filters says that is okay. If any of the filters’ result is not okay, lets stop the whole process and send an e-mail to the customer the his request is not feasible. I drew a sketch about it:

What do you think, this solution is usable?

Thank you for your help once again in advance!

Hi - at first glance, I have a few questions. Do you only ever want to send the customer 1 email? If so, it appears that in your current sketch, if all 4 requests fail, you would potentially send 4 emails to the customer.

Also, do all of these requests execute fairly quickly in parallel? Do you have any desire to interrupt/fail the entire process once one of them fails? If so, the current sketch looks to allow all of them to finish and complete currently.

1 Like

Hi, thank you for your help!
Yes, it seems that if all of the requests fail, the customer will get 4 emails, I will correct it, one email is enough.

Yes theoretically the same time is need for all of the filters (more or less) and yes, I would like to interrupt the entire process if one of the filters fails. Do you have any recommendations to implement that?

Hi - so my suggested approach for implementing this would be a bit different. Camunda has a pattern called external tasks that I think is closer to what you are looking for.

The implementation in the .bpmn would be much simpler and look like this.

Basically what happens is when you get to the “Async External Service”, Camunda creates an “external task” to a specific topic that you configure in that activity. Then you have a separate worker service (which can be built in node.js or Java) that would poll for these tasks, and then when it receives one, it can perform all of the calls you need in an async manner. If the are all successful, you “complete” the task and move forward. If any of them fail, you throw a BpmnError and can send the email.

This does require a bit of overhead as you need to build the separate worker service, but the worker service is pretty small and straight forward and I think is a better way of handling this as opposed to trying to do everything inside the process model.

Let me know if this works, or if there is a specific reason you need to do everything at the process layer, we can try for something different.

An alternate way could be if your filters could be implemented as business rules, a business rules task based on DMN could be an option…

This blog post may be of interest, it uses some DMN tables to concisely implement some complex validation rules…