Sunteți pe pagina 1din 6

Prepared By: Rohit Raj

EMAIL TASK CONFIGURATION


1. 2. 3. 4. 5. 6. Overview Setup an Email task (Reusable) Post-Session Email Configuration Setup an Email task (Non-Reusable) Important Points Sample Email

1. Overview
Email task helps to keep track of the Informatica jobs and also provides necessary stats about any job (session) by sending emails on success or failure of that job. Depending upon the requirement, different important information can be added in the email like, total no of rows loaded, session start time, session completion time, total rows rejected, session name, mapping name, workflow name, session throughput and many more. Separate Email tasks can be created for Success or Failure of the session and can be configured as On Success Email and On Failure Email respectively in session properties. Any task created in Task Developer will be reusable and so Email task also. Non-reusable Email task can be created in either Worklet or Workflow designer or can be configured directly in the session properties.

2. Setup an Email task (Reusable)

1. In the Task developer, select Task >Create > Email or click on the icon

2. Double-click the Email task and click rename to enter a name for the task. 3. Click on the Properties tab and configure Email userid, Subject and Email Text there.

Email User Name: This field can have variables or hardcoded values or both. Predefined service variables like $PMSuccessEmailUser and $PMFailureEmailUser can be used to store email addresses or you can use Worklet or Workflow variable also for this purpose. But make sure to define these variables in parameter file also otherwise this task will fail. In the picture above, a workflow variable $$EMAIL_ID is used, which is defined in parameter file. Here is a sample for parameter file values: [MM_DEV.WF:WF_NBS_MEDIABASE_DAILY] $DBConnection3=UMG_EDW_STG $DBConnection4=UMG_EDW $$PROCESS_NAME=NBS MEDIABASE DAILY $PMSuccessEmailUser=rohit.raj@hp.com;jayanthi.raman@hp.com;kumar.s@h p.com $$JOB_NAME=NBS MEDIABASE DAILY $$EMAIL_ID=rohit.raj@hp.com;jayanthi.raman@hp.com;kumar.s@hp.com Any number of email ids can be added separated by semicolon. Also, you can hardcode email addresses if required. If you are using worklet or workflow variables, then it is must to define them first. To create workflow variables, click on Workflows > Edit > Variables and configure them there.

You can also give default values for these variables here itself instead of defining them in parameter file.

Email Subject: Define the subject line for mail here. User defined worklet or workflow variables can also be used here. You can also use email variables in order to add specific info in the subject line, like in the picture above. Or, it can be left blank. Email Text: you can scribe the email in the desired format here. Based on the requirement, you can change the mail body of reusable email task in different sessions. Also, it can be made more informative by using email variables which contains important session information, such as the number of rows loaded, the session completion time, or read and write statistics. Here is the list of all email variables.
Email Variable %a<filename> Description Attach the named file. The file must be local to the Integration Service. The following file names are valid: %a<c:\data\sales.txt> or %a</users/john/data/sales.txt>. The email does not display the full path for the file. Only the attachment file name appears in the email. Note: The file name cannot include the greater than character (>) or a line break. %b %c %d %e %g Session start time. Session completion time. Name of the repository containing the session. Session status. Attach the session log to the message. The Integration Service attaches a session log if you configure the session to create a log file. If you do not configure the session to create a log file or if you run a session on a grid, the Integration Service creates a temporary file in the PowerCenter Services installation directory and attaches the file. If the Integration Service does not use operating system profiles, verify that the user that starts Informatica Services has permissions on PowerCenter Services installation directory to create a temporary log file. If the Integration Service uses operating system profiles, verify that the operating system user of the operating system profile has permissions on PowerCenter Services installation directory to create a temporary log file. Session elapsed time. Total rows loaded. Name of the mapping used in the session. Name of the folder containing the session. Total rows rejected. Session name. Source and target table details, including read throughput in bytes per second and write throughput in rows per second. The Integration Service includes all information displayed in the session detail dialog box. Repository user name. Integration Service name. Workflow name. Session run mode (normal or recovery). Workflow run instance name.

%i %l %m %n %r %s %t

%u %v %w %y %z

Note: The Integration Service ignores %a, %g, and %t when you include them in the email subject. Include these variables in the email message only.

3. Post session Email configuration


1. 2. 3. 4. Open the session properties and click the Components tab. Select Reusable in the Type column for the success email or failure email field. Click the Open button in the Value column to select the reusable Email task. Select the Email task in the Object Browser dialog box and click OK.

5. You can also make changes in the reusable task for any specific session in order to change Email text or recipient. Click on edit button and change the task as per the need. 6. Click OK to close session properties.

4. Setup an Email task (Non-Reusable)


Non-reusable Email task can be created either in worklet or workflow designer or directly in the session itself. NR Email task, created in worklet or workflow, can t be used in post session email. It can be treated as independent task and can be used anywhere in the workflow or worklet.

Non-reusable Email task can be connected to any session externally and can be executed based on the link condition like success of previous task, total no of failure rows exceeding some limit etc. Non-reusable Email task can be created in the session also but they won t have any physical appearance and hence cannot be used in the worklet or workflow. Steps to create NR email task in sessions are:

1. Open the session properties and click the Components tab. 2. Select Non-Reusable in the Type column for the success email or failure email field. Automatically NR tasks on_success_mail or on_failure_mail will be created for success or failure email field respectively. 3. Open the email editor using the Open button . 4. Edit the Email task (as mentioned in above topics) and click OK. 5. Click OK to close the session properties.

5. Important Points
1. The Integration Service sends post-session email at the end of a session, after executing postsession shell commands or stored procedures. 2. When the Integration Service encounters an error sending the email, it writes a message to the Log Service. It does not fail the session. 3. You cannot specify a non-reusable Email task you create in the Workflow or Worklet Designer for post-session email because in post session, non-reusable option has predefined task with no physical existence. That is why, when you create a non-reusable Email task for a session, you cannot use the Email task in a workflow or worklet. 4. You can use parameters and variables in the email user name, subject, and text. Use any parameter or variable type that you can define in the parameter file, but make sure to define them in workflows also. 5. You can also configure a workflow to send email when the Integration Service suspends the workflow. Read help files for more details. 6. You can attach any files also with mail using email variable %a<filename> or can attach session log using variable %g in email text.

6. Sample Email
INPUT EMAIL TEXT
Session name: %s

Mapping name: %m Workflow name: %w Session Status: %e Repository name: %d %b %c \n %i %l %r %t

EMAIL RECEIVED
Session name: s_M_Load_Test_Email Mapping name: M_Load_Test_Email Workflow name: WF_Email_Test Session Status: Succeeded Repository name: REP_MM_DEV Start Time: Tue Nov 29 04:54:13 2011 Completion Time: Tue Nov 29 04:55:02 2011 Elapsed time: 0:00:48 (h:m:s) Total Rows Loaded = 732945 Total Rows Rejected = 0 SOURCE Rows Loaded

Rows Rejected

---------- ---------Status -------------------------------------------------------------------------------734898 0 16332 SQ_Src_Test_Email No errors encountered. --------------------------------------------------------------------------------------------------------------------------------------------------------------TARGET Rows Rows Data Loaded Rejected Throughput Table Name (bytes/sec) ---------- ---------- ---------- ---------------Status -------------------------------------------------------------------------------732945 0 244315 Tgt_Test_Email No errors encountered.

Data Throughput Table Name (bytes/sec) ---------- ----------------

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