Wednesday, January 16, 2013

Working with Post-Session Email


·      You can configure a session to send email when it fails or succeeds. You can create separate email tasks for success and failure email. 
·      The Integration Service sends post-session email at the end of a session, after executing post-session shell commands or stored procedures. When the Integration Service encounters an error sending the email, it writes a message to the Log Service. It does not fail the session. 
·         You can specify a reusable Email that task you create in the Task Developer for either success email or failure email. Or, you can create a non-reusable Email task for each session property. When you create a non-reusable Email task for a session, you cannot use the Email task in a workflow or worklet. 
·      You cannot specify a non-reusable Email task you create in the Workflow or Worklet Designer for post-session email. 

·         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. For example, you can use the service variable $PMSuccessEmailUser or $PMFailureEmailUser for the email recipient. Ensure that you specify the values of the service variables for the Integration Service that runs the session. You can also enter a parameter or variable within the email subject or text, and define it in the parameter file.

Email Variables and Format Tags


Use email variables and format tags in an email message for post-session emails. You can use some email variables in the subject of the email. With email variables, you can include important session information in the email, such as the number of rows loaded, the session completion time, or read and write statistics. You can also attach the session log or other relevant files to the email. Use format tags in the body of the message to make the message easier to read.
Note: The Integration Service does not limit the type or size of attached files. However, since large attachments can cause problems with the email system, avoid attaching excessively large files, such as session logs generated using verbose tracing. The Integration Service generates an error message in the email if an error occurs attaching the file.
The following table describes the email variables that you can use in a post-session email:

Email Variable
Description
%a
Attach the named file. The file must be local to the Integration Service. The following file names are valid: %a or %a

. 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
Session start time.
%c
Session completion time.
%d
Name of the repository containing the session.
%e
Session status.
%g
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.
%i
Session elapsed time (session completion time-session start time).
%l
Total rows loaded.
%m
Name of the mapping used in the session.
%n
Name of the folder containing the session.
%r
Total rows rejected.
%s
Session name.
%t
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.
%u
Repository user name.
%v
Integration Service name.
%w
Workflow name.
%y
Session run mode (normal or recovery).
%z
Workflow run instance name.
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.

The following table lists the format tags you can use in an Email task:

Formatting
Format Tag
tab
\t
new line
\n

Configuring Post-Session Email

You can configure post-session email to use a reusable or non-reusable Email task.

Using a Reusable Email Task

Use the following steps to configure post-session email to use a reusable Email task.
To configure post-session email to use a reusable Email task:
1.
Open the session properties and click the Components tab.
2.
Select Reusable in the Type column for the success email or failure email field.

3.
Click the Open button in the Value column to select the reusable Email task.
4.
Select the Email task in the Object Browser dialog box and click OK.

5.
Optionally, edit the Email task for this session property by clicking the Edit button in the Value column.
If you edit the Email task for either success email or failure email, the edits only apply to this session.
6.
Click OK to close the session properties.

Using a Non-Reusable Email Task

Use the following steps to configure success email or failure email to use a non-reusable Email task.
To configure success email or failure email to use a non-reusable Email task:
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.

3.
Open the email editor using the Open button.
4.
Edit the Email task and click OK.

5.
Click OK to close the session properties.
Related Topics: 
Working with Email Tasks

Sample Email

The following example shows a user-entered text from a sample post-session email configuration using variables:

Session complete.
Session name: %s
Integration Service name: %v
%l
%r
%e
%b
%c
%i
%g
The following is sample output from the configuration above:
Session complete.
Session name: sInstrTest
Integration Service name: Node01IS
Total Rows Loaded = 1
Total Rows Rejected = 0
Completed
Start Time: Tue Nov 22 12:26:31 2005
Completion Time: Tue Nov 22 12:26:41 2005
Elapsed time: 0:00:10 (h:m:s)


1 comment:

  1. I have a session with two targets. One is database and other is flat file. Fresh records are inserted and stored every time records go into database as well as flat file (append if exists is unchecked). I want to email that target flat file only when records are inserted into that flat file. The flat file has column headers as the 1st row line.Can we do that in the same workflow? If so, can you suggest me how?

    ReplyDelete

Thank you :
- kareem