Camunda 1 to n problem - modify multi instance subprocess at runtime

I have a specific requirement in 1 to n problem. If I have groups and in each group there are multiple items to process, then I am giving these groups to multi instance parallel subprocess.

Now if a group is not completed because of an issue in one item, then I want to remove that item out of that group and finish processing that group. Is this addressed in 1 to n problem. If yes, what is the solution for this?

To describe more about this requirement, lets take an example. As per this link https://camunda.org/bpmn/examples/#bpmn-examples-processing-a-batch-of-orders-from-a-marketplace, we are grouping orders in every 10 minutes and sending these orders to “Process Order” multi-instance parallel subprocess to process them. Let’s say while processing a group of 20 orders, after processing 18 orders, because of an issue in ERP system, remaining 2 orders are waiting. Now restoring ERP system will take some time. So we want to remove those pending 2 orders from the group so that the group will be marked as completed. Is there a way to do this?

Hi anigeorge,

it seems that this is the question of process design.

Do you mean that you have two nested subprocesses: one is iterating over groups and the second over items in one group?
And then you want to “cancel” the subprocess of group A if the problem occurred in one of items included in group A? Or in opposite you want to proceed with other items of group A?

@anigeorge we discussed this type of scenario here:

Can you provide a more concrete example? What do you mean by “groups”, what are the “items”, what do you mean by “remove”? When you use a term like “1 to N”, it may have a very specific meaning within computer science, though I can’t say that I would know what that is.

Be clear and very specific, please. Unless, of course, you’ve already solved it from preceding posts.

We are dealing with potentially similar issues, but I can’t be sure.

I have updated the description with an example, can you please check?

As per this link https://camunda.org/bpmn/examples/#bpmn-examples-processing-a-batch-of-orders-from-a-marketplace, we are grouping orders in every 10 minutes and sending these orders to “Process Order” multi-instance parallel subprocess to process them. Let’s say while processing a group of 20 orders, after processing 18 orders, because of an issue in ERP system, remaining 2 orders are waiting. Now restoring ERP system will take some time. So we want to remove those pending 2 orders from the group so that the group will be marked as completed. Is there a way to do this?

Hi,

You could consider adding an interrupting boundary event to the inner sub process and thus have the capability to inject a message to influence the flow.

Lets consider an order with many line items. You could process the line items using a multi-istance subprocess. Now the outcomes of each line item sub-process could be; Fulfilled, Cancelled, Deferred etc. Hence make sure your process model reflects these outcomes. You could use say an interrupting boundary event for deferred for example.

To inject the interrupting event into the right line item sub-process, you will typically need a unique reference to correlate on. This is easy as your sub-process can generate its own unique reference etc.

So how can you inject these events? Well you could use the REST API. Another way is to create an administrative process with a form which accepts the correlation key and uses a service task to inject the relevant message…

regards

Rob

This is an interesting problem and one we’re dealing with also, though the particulars are different.

The question here is one of “rollback”. If two transactions are in the middle of execution, but cannot complete due to an external condition beyond your control, how do you roll them back such that all conditions, internal to Camunda and externally to things like your ERP system, are reset to the “beginning”?

We have ticketing and alarm systems that will trigger workflows (processes) that may do many different things. Some things are interdependent upon each other (i.e. this thing must happen before that thing). Some change the “state” of a something such as changing a value on a ticket. The challenge then is create tooling and development procedures that consider “rollback” from the outset.

This may elicit a collective “Well, duh!” from any readers. However, if you understand the “rollbackability” (sic) of a process and are confident that you can rollback without worrying about “state changes” to external systems, then you can simply cancel and resend the transactions through Camunda after restoration of the problem. We do this through an external message buffering/persistence system that effectively allows us to “replay” messages into Camunda.

I’m oversimplifying here to be sure. Moreover, Rob’s suggestion above is probably much easier to execute as well as being from a true expert on Camunda. I just play an expert on television.

PS: I fully acknowledge that the preceding was probably of no help whatsoever. However, our circumstances involve not one external system, but potentially hundreds of them so we must build for a level of “process resiliency” that is daunting. We’re still build…

Hi,
Have looked into a BPMN transaction and compensating activities? This sounds ideal for your situation. Have a look at [1] for some detail.

regards

Rob

[1] https://docs.camunda.org/manual/7.6/reference/bpmn20/subprocesses/transaction-subprocess/

Hi there
Regarding the 1-n sample at the link Real-world BPMN 2.0 examples and answers to common questions. - Camunda.
Is there anywhere I can get the BPMN model file for this?