Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Yes, it is possible to execute a task when any activity from a group of activities fails and record the information of the failed activity in that task using ADF.

You can achieve this by creating a "Faulted" event handler on the "ForEach" or "ForEachBatch" activities. This event handler will be triggered whenever any activity within the "ForEach" loop fails.

Within this event handler, you can define the actions that need to be taken, such as creating a new task in the task management system and adding the details of the failed activity to it.

Below is an example of how the event handler code would look like in Python:

def on_failed_activity(execution_context, activity_info, error_details):
    # Create a task in the task management system
    task = create_new_task("Failed activity in ForEach loop")

    # Add details of the failed activity to the task
    task.add_activity_details(activity_info.name, error_details.message)

# Define ForEach activity and add the event handler
foreach_activity = ForEach(...)
foreach_activity.on_activity_fault += on_failed_activity