Call Activity
Call Activities are essential components within an Workflow, responsible for executing specific tasks reliably and efficiently. These activities are stateless, durable, and resilient, making them suitable for various operations, including:
- Sending notifications to users or systems.
- Updating databases with new or modified information.
- Invoking external APIs to integrate with third-party services.
Activities are triggered using a workflow scheduling mechanism, ensuring seamless and controlled execution within the workflow framework.
Activity Invocation
Activities are executed inside a Workflow using a scheduling method. This method supports synchronous and asynchronous execution, depending on the configuration.
Invocation Process
- The Workflow requests execution of an activity.
- The activity receives input parameters and processes them.
- Execution occurs synchronously or asynchronously based on the configuration.
- The activity completes execution and returns a result.
Activity Implementation
Each activity must be implemented as an independent, reusable function that adheres to the framework’s execution model.
Key Implementation Aspects
- Receives input data and processes it.
- Performs a specific business operation.
- Executes synchronously or asynchronously as per configuration.
- Returns an output after execution.
- Logs critical actions for monitoring and debugging.
Retry Mechanism
To handle transient failures, activities should include retry logic. The workflow framework supports automatic retries based on predefined policies, ensuring resilience.
Retry Logic Flow
- If an activity fails, it triggers the retry mechanism.
- The framework checks the retry policy.
- A retry attempt is scheduled based on configured intervals and backoff strategies.
- The activity retries until either success or the max retry attempts is reached.
- If max attempts are exceeded, the activity is marked as failed.
Activity Execution Flow
- Workflow schedules an activity.
- The activity executes synchronously or asynchronously based on configuration.
- The result is returned to the Workflow.
- The Workflow continues workflow execution based on the activity outcome.
Steps to Add a Call Activity Construct
Step 1: Drag & Drop the Construct
- Open the Logic Flow Designer Canvas.
- Drag and drop the Call Activity construct into the flow.
Step 2: Configure Properties
- Double-click the construct to open its properties panel.
- Configure the required properties:
Activity Properties
| Property | Description | Comments |
|---|---|---|
| Label | Labels help developers quickly understand each step in the logic flow without examining the details of the construct. | It is recommended to provide a simple precise label that improves the logic flow readability. |
| Activity Name* | Specifies the unique name of the activity being called. | Must match the registered activity name. |
| Input | Defines the parameters passed to the activity. | Should include all required values. |
| Execution Mode* | Specifies execution as Sequential or Async. | Determines flow and dependencies. |
| Activity Handle | Unique identifier required if execution mode is Async. | Required only for async execution.Activity Handle is used to track and manage asynchronous calls. Since asynchronous operations do not return responses immediately, the Activity Handle acts as a reference to monitor the execution and retrieve results when available.The response can be accessed later by explicitly awaiting the Activity Handle.e.g response = await CallEmailActivity |
| Output Mapping | Maps relevant data elements within the flow if Sequential mode is used. | Ensures seamless data integration. |
| Enable Retry | Indicates if retry logic is enabled (YES/NO). | Helps handle transient failures. |
| Retry Options | Configurable retry policies (attempts, delays). | Optimizes failure handling. |
| Comment | Specify whether to comment this construct or not. Either Yes or No. | If marked as Yes, the construct is treated as a commented expression and ignored in code generation. |
| Description | A brief explanation of the CallActivity purpose. | Helps users understand the CallActivity functionality. |
Retry Options Sub-Properties
| Property | Description | Comments |
|---|---|---|
| First Retry Interval | Initial delay before the first retry attempt. | Prevents immediate repeated failures. |
| Max Retry Interval | Maximum wait time between retries. | Ensures retries do not extend indefinitely. |
| Backoff Coefficient | Increases retry intervals exponentially after each attempt. | Reduces system overload. |
| Retry Timeout | Maximum time allowed for all retries. | Ensures timely resolution. |
| Max Number of Attempts | Limits retry attempts before marking failure. | Prevents excessive retry loops. |
| Exception Handler | Defines how exceptions should be managed. | Ensures proper error handling. |
'Note: ' + ($args[0].Groups[1].Value -replace '\r?\n', ' ')