Pipelines can be seen as powerful components, as they allow to execute different Bizagi elements like connectors, expressions, emails, etc. However, it is important to understand of scenarios where they can be truly useful, as well as considerations regarding best practices. This article presents the recommended scenarios where users can take advantage of pipelines capabilities, as well as important best practices recommendations.
When to use Pipelines
A Pipeline is a component that can trigger the execution of different Bizagi elements, which can also be triggered through an activity action. Nonetheless, there are specific scenarios when Pipelines can be more useful than invoking the actions through an activity action. This scenarios are:
•When having an execution condition
When the invocation of a specific action is subject to a condition (e.g. a business condition), the use of pipelines can be helpful, as you can define an execution condition to each of the actions within the pipeline.
For example, imagine a scenario where a user wants to register to a subscription and to do so, they need to enter a username and an email address, so that a confirmation email can be sent.
You can add a condition to the execution of the confirmation email in case the user does not enter the email address and the username in the form.
Another powerful scenario to use pipelines concerns sending emails. Imagine that you need to send the same email in two different steps of your process.
Through Activity Actions, you would have to configure an email activity action for each of the service tasks.
This means that you would have to configure the same email two times. However, if you use a pipelines approach, you would only have to configure the pipeline once:
And then, reuse it in both activities.
Pipelines best practices and considerations
When working with pipelines, it is important to bear in mind the following considerations and best practices:
1.Synchronous vs asynchronous tasks for pipelines
Pipelines can be defined in both synchronous or asynchronous tasks. However, if your pipeline includes elements that connect with external systems, it is recommended to use asynchronous tasks to handle the retries.
2.Retries in pipelines
When a pipeline that is configured as an asynchronous activity and fails, the complete task is retried, not the element that failed.
If a pipeline fails during the execution of one element, the subsequent elements will not be executed and there will no be a rollback of the elements that executed successfully.
4.Combining elements in pipelines
Taking into account the previous bullets, consider the following scenarios when you want to combine different elements in a single pipeline:
oIf a pipeline combines different connections to external systems and one of the invocations fails, all the elements in the pipeline are retried, including the ones before the failure.
oIf a pipeline combines internal Bizagi elements (e.g. business rules) and external elements (connectors), if the pipeline fails, all the elements in the pipeline are retried, including the ones before the failure. This means that depending on the order in which they were defined in the pipeline, either the internal or the external elements can be executed twice.
oIf a pipeline combines sending an email with another element and the pipeline fails, all the elements in the pipeline are retried, including the ones before the failure. This means that depending on the order in which they were defined, the email will be sent as many times as the task is retried.