Best practice for modelling cross-cutting concerns

Hi

In my organisation we are just starting to test Zeebe. One of the issues we’ve come across is actually how to model concerns cutting across multiple tasks of a workflow. This could be things like status updates, workflow cancellation or similar which may occur at any step of the workflow.

So far we’ve handled this by modelling the affected steps as subprocesses and attaching boundary events (see example below).

Is this a good way of handling such concerns, or do you have suggestions for improvement?

This is simplified process where status update messages may originate at any step in the workflow (non-interrupting). Upon these messages workflow status should be updated in an external system. Additionally, an external system may request that the workflow is cancelled. The request may be sent at any stage in the workflow and is interrupting. The cancellation request may require compensating actions in external systems (hence the task).

We did consider modelling this explicitly for each affected task, but this made the models harder to read and seemed to add unnecessary complexity, but there may be advantages we haven’t noticed yet.

Best regards,
Svein

Hey @Stand

welcome to our community! We are happy that you’re trying out Zeebe :slight_smile:

In general I would say it depends what do you want to achieve. If you can solve your use case with the above model then this is totally fine, I would say. As an alternative you can check Event Sub Processes. With an event sub process, in the embedded sub process, you would share the same variable and flow scope as with the other activities. This would be my preferred solution for the non-interrupting message catch event.

Hope that helps.

Greets
Chris

1 Like

Thanks, it’s good to get confirmation that we are on the right track. I did actually implement the status update as an event sub process originally, but with the requirement for the cancellation to be interrupting we figured it would be better to model both concerns the same way.