Sunteți pe pagina 1din 3

Completing a Workflow When a User-Defined Event Does Not Occur

2009 Informatica Corporation

Abstract
This article outlines a process to complete a workflow and send an email notification if a specified event does not occur in a given period of time. A workflow that uses an Event-Wait task to wait for a predefined or user-defined event, such as a file-watch event, may cause the Integration Service to wait indefinitely until that event has occurred. A workaround is explained.

Overview
A flat file is being used as a source to load a target system at regular intervals. You want to run a session based on a predefined event, such as the flat file appearing as part of a nightly batch load. You configure an Event-Wait task to run when an indicator file appears. Sometimes, the latest source file may not be available for loading, perhaps due to a source dependency. If the source does not trigger the script that creates the indicator file within a defined period, you want to receive notification and stop the workflow. Alternatively, if the file arrives in time, you want to run the session and receive notification.

Solution Description
The solution is based on creating a workflow with two branches. The primary branch of the workflow includes the Event-Wait task that will be triggered by the file-watch event. The primary branch executes if the event occurs within the desired time, configured through a workflow variable. An Email task sends out a success notification. The Command task then stops the secondary workflow. The secondary branch of the workflow includes an Assignment task that makes the workflow wait for a given period of time, controlled by a Timer task. The secondary branch executes if the file-watch event does not occur within the desired time. An Email task sends out a failure notification, and a Command task stops the workflow. The following picture shows the workflow:

Workflow Variable
Create a date/time workflow variable called WAITTIME and configure a default time.

Workflow Tasks
The primary branch contains the following tasks: EventWait. Contains the path to the indicator file. s_m_TEST1. Contains the mapping that uses the source. Email1. Sends a success notification when the session completes. Command. Stops the Timer task in the secondary branch when the session completes. Use the following pmcmd stoptask command to stop the Timer task:
pmcmd stoptask -sv hostname:portno -u username -p password -f folder -w wf_File_Watcher -nowait timer

Configure the Command task to fail if any command fails.

The secondary branch contains the following tasks: Assignment. Assigns a value to the WAITTIME workflow variable. Timer. Initialized by the WAITTIME workflow variable and configured to the default wait time. Email1. Sends a failure notification to let you know that the indicator file did not arrive. Command1. Stops the workflow because the indicator file has not appeared in the specified time. Use the following pmcmd stopworkflow command:
pmcmd stopworkflow -sv hostname:portno -u username -p password -f folder -nowait wf_File_Watcher

Configure the Command task to fail if any command fails.

Link Conditions
Set the link condition between each object of the workflow to Errorcode=0. For example, the link condition between the Event-Wait task and the session s_m_TEST1 is $EventWait.ErrorCode=0. If one of the tasks fails, the link condition prevents further progress, and the Command task at the end of that branch will not run.

Authors
Rajiv Chitlur, Logica Singapore Pte. Ltd. Rajiv Chitlur worked as an Informatica ETL consultant, data conversion specialist, and ETL tech lead for more than five years. He is currently an Informatica data conversion specialist for Logica Singapore Pte. Ltd. David Meister, Technical Support Engineer David Meister is a four-year veteran of Informatica Global Customer Support. His current interests are Unstructured Data, Data Transformation, and B2B DataExchange.

S-ar putea să vă placă și