This chapter includes the following sections:
Various scenarios may require sending email messages or other types of notifications to users as part of the process flow. For example, certain types of exceptions that cannot be handled automatically may require manual intervention. In this case, a BPEL process can use the notification service to alert users by voice, IM, SMS, or email.
The contact information (email address, phone number, and so on) of the recipient is either static (such as [email protected]
) or obtained dynamically during runtime. To obtain the contact information dynamically, XPath expressions can retrieve it from the identity store (LDAP) or extract it from the BPEL payload.
This chapter uses the following terms:
Notification
An asynchronous message sent to a user by a specific channel. The message can be sent as an email, voice, IM, or SMS message.
Actionable notification
A notification to which the user can respond. For example, workflow sends an email to a manager to approve or reject a purchase order. The manager approves or rejects the request by replying to the email with appropriate content.
Human task email notification layer
Sends email notifications directly from a BPEL process or implicitly from the human task part of a BPEL process. Implicit notifications are modeled from the Human Task Editor.
For sending email notifications directly from a BPEL process, you must explicitly specify the user information in the BPEL process. You can be inside or outside of a human task scope.
For sending email notifications implicitly from the human task part of a BPEL process, you only specify the recipient based on the relationship of the user with regards to the task (that is, the creator, assignee, and so on).
Note:
Implicit notifications are processed through more layers of code than explicit notifications. If explicit notifications are functioning correctly, it does not mean that implicit notifications also function correctly.
Oracle User Messaging Service
The BPEL notification service uses the underlying infrastructure provided by Oracle User Messaging Service to send notifications.
Oracle User Messaging Service also provides the user preference infrastructure for getting the end user's preferred channel during runtime.
For more information on the Oracle User Messaging Service, see Developing Applications with Oracle User Messaging Service.
Figure 17-1 shows the Oracle User Messaging Service interfaces and supported service types.
Figure 17-1 Service Interfaces and Supported Service Types
For more information about notifications, see the following sections:
Specifying Participant Notification Preferences for instructions on specifying email notifications in the Human Task Editor
Notification setup is a multiple-step process that involves several user interface tools. Table 17-1 provides an overview of this process, including the task to perform, the tool to use, and the documentation to which to refer for more specific details.
Table 17-1 Notification Tasks
Task | Description | User Interface | Described In... |
---|---|---|---|
Select a channel for sending notifications in a SOA composite application. |
Select a method for sending notifications:
|
Selected and configured by the BPEL process designer in Oracle BPEL Designer |
Selecting Notification Channels During BPEL Process Design or |
Configure the driver for the notification channel. |
You configure drivers on the same Oracle WebLogic Server on which you deploy the SOA composite application. This action enables participants to receive and forward notifications. Driver support is provided for email, IM, SMS, and voice channels. |
Configured by the administrator in Oracle Enterprise Manager Fusion Middleware Control |
Administering Oracle SOA Suite and Oracle Business Process Management Suite |
Configure the notification mode and actionable accounts for human workflows. |
If you are using notifications with human workflow, you configure the notification mode and actionable account for email. |
Configured by the administrator in Oracle Enterprise Manager Fusion Middleware Control |
Administering Oracle SOA Suite and Oracle Business Process Management Suite |
Register the devices used to access messages by specifying user preferences. |
This action enables workflow participants to receive notification messages. For example, the end user registers email clients and specifies the message content to receive and the channel to use for receiving messages. If no channel is specified, email is used by default. The preferences set in this application are applicable only to that specific end user, and not to other users. |
Registered by the end user in the User Messaging Preferences user interface. You can access this interface by selecting Preferences > Notification in Oracle BPM Worklist. |
Oracle JDeveloper includes the email, IM, SMS, and voice channel notification channels in the Components window. You can set the exact notification channels to use during design time. For example, a BPEL process can be designed to use the following notification channels:
If an expense report amount is less than $1000, an email notification channel is used.
If an expense report amount is between $1000 and $2000, an SMS notification channel is used.
If an expense report amount is more than $2000, a voice notification channel is used.
To select the notification channel during BPEL process design:
When you drag the Email icon from the Components window, the Email dialog appears. Figure 17-2 shows the required email notification parameters.
To configure the email notification channel:
You can send attachments with an email activity. Each attachment has three elements: name, MIME type, and value. All three elements must be set for each attachment.
To add an attachment to an email message:
For more information about sending attachments using email, see the following documentation:
You can format the body of an email message as HTML instead of straight text. To perform this action, apply an XSLT transform
to generate the email body. Add in the XSLT tag you want to use. Tools such as XMLSpy can provide assistance in writing and testing the XSLT. The MIME type should be string('text/html;charset=UTF-8')
.
The email notification assignment looks as shown in the following example:
<copy> <from expression="ora:processXSLT('TransformPositionSummary7.xslt',bpws: getVariableData('ClientPositionSummary'))"/> <to variable="varNotificationReq" part="EmailPayload" query="/EmailPayload/ns9:Content/ns9:ContentBody"/> </copy>
If the HTML for the message content of an email activity is generated dynamically, (as with XSLT, file read, and so on), it must be wrapped in a CDATA
function. This prevents conflicts between the XML/HTML content of the message body and BPEL's internal XML data structures.
For example, assume you use the append
operation shown in the following example for the message content inside the email activity:
<bpelx:append> <bpelx:from expression="ora:processXSLT('xsl/email.xslt',bpws:getVariableData('Variable_1' ))"/> <bpelx:to variable="varNotificationReq" part="EmailPayload" query="/EmailPayload/ns1:Content/ns1:ContentBody/ns1:MultiPart/ns1:BodyPart[1] /ns1:ContentBody"/> </bpelx:append>
For this to work correctly, you must pass the output of the processXSLT()
function to the CDATA()
function, as shown in the following example:
<%ora:toCDATA(xdk:processXSLT('xsl/email.xslt', bpws:getVariableData('inputVariable','payload','/client:process/client:input') ))%>
When you drag the IM icon from the Components window, the IM dialog appears. Figure 17-6 shows the required IM notification parameters.
To configure the IM notification channel:
When you drag the SMS icon from the Components window, the SMS dialog appears. Figure 17-7 shows the required SMS notification parameters.
To configure the SMS notification channel:
When you drag the Voice icon from the Components window, the Voice dialog appears. Figure 17-8 shows the required voice notification parameters.
To configure the voice notification channel:
You can set email addresses or telephone numbers dynamically based on certain process variables. You can also look up contact information for a specific user using the built-in XPath functions for the identity service:
To get the email address or telephone number directly from the payload, use the following XPath expression:
bpws:getVariableData('<variable name>', '<part>','input_xpath_to_get_an_address')
For example, to get the email address from variable inputVariable
and part payload
based on XPath /client/BPELProcessRequest/client/mail
:
<%bpws:getVariableData('inputVariable','payload','/client:BPELProcessRequest/ client:email')%>
You can use the XPath Expression Builder to select the function and enter the XPath expression to get an address from the input variable.
To get the email address or telephone number dynamically from the underlying identity store (LDAP) use the following XPath expression:
ids:getUserProperty(userName, attributeName[, realmName])
The first argument evaluates to the user ID. The second argument is the property name. The third argument is the realm name. Table 17-7 lists the property names that can be used with this XPath function.
Table 17-7 Properties for the Dynamic User XPath Function
Property Name | Description |
---|---|
|
Look up a user's email address. |
|
Look up a user's telephone number. |
|
Look up a user's mobile telephone number. |
|
Look up a user's home telephone number. |
The following example gets the email address of the user identified by the variable inputVariable
, part payload
, and queries /client:BPELProcessRequest/client:userID
:
ids:getUserProperty(bpws:getVariableData(‘inputVariable', ‘payload',‘/client:BPELProcessRequest/client:userid'), ‘mail')
If realmName
is not specified, then the default realm name is used. For example, if the default realm name is jazn.com
, the following XPath expression searches for the user in the jazn.com
realm:
ids:getUserProperty('jcooper', 'mail');
The following XPath expression provides the same functionality as the one above. In this case, however, the realm name of jazn.com
is explicitly specified:
ids:getUserProperty('jcooper', 'mail', 'jazn.com');
You can select users or groups in Oracle JDeveloper to whom you want to send notifications by browsing the user directory (for example, Oracle Internet Directory) that is configured for use with Oracle BPEL Process Manager. Click the Search icon to the right of the following fields to open the Identity Lookup dialog:
To field on the Email and IM dialogs
Telephone # field on the SMS and Voice dialogs
For more information about using the Identity Lookup dialog, see Introduction to Human Workflow Services.
You can design a BPEL process in which you do not explicitly select a notification channel during design time, but simply indicate that a notification must be sent. The channel to use for sending notifications is resolved at runtime based on preferences defined by the end user in the User Messaging Preferences user interface of the Oracle User Messaging Service. This moves the responsibility of notification channel selection from the BPEL process in Oracle BPEL Designer to the end user. If the end user does not select a preferred channel or rule, email is used by default for sending notifications to that user. Regardless of who selects the channel to use, channel use is still based on the driver installation and configuration performed in the Oracle User Messaging Service section of Oracle Enterprise Manager Fusion Middleware Control by the administrator.
For example, an end user may set their preferences as follows:
If an expense report amount is less than $153, they receive an email notification.
If an expense report amount is between $153 and $3678, they receive an SMS notification.
If an expense report amount is more than $3678, they receive a voice notification.
Note:
You can also set user preferences for sending notifications in human workflows in the Human Task Editor. Set these preferences in the Notification Filters part of the Notification Settings section. These preferences are used to evaluate rules in the task. For more information, see How to Send Task Attachments with Email Notifications.
For more information about the Oracle User Messaging Service, see the "User Communication Preferences" chapter of Developing Applications with Oracle User Messaging Service.
For information about configuring the Oracle User Messaging Service in Oracle Enterprise Manager Fusion Middleware Control, see Administering Oracle User Messaging Service.
To allow the end user to select notification channels:
The Advanced tab of the User Notification dialog enables you to create and send header and name information that may be useful to an end user in creating their own preference rules for receiving notifications. For example:
Oracle BPEL Designer specifies the users named jcooper
and jstein
in the General tab.
Oracle BPEL Designer creates the following header and name information in the Advanced tab:
Amount
=
payload->salary
Application
=
HR-Application
The administrator deploys the process and configures various channel drivers in Oracle Enterprise Manager Fusion Middleware Control.
The end user jcooper
creates the following preference rules in the User Messaging Preferences user interface:
'Email if Amount < 30000" and "SMS if Amount is between 30000 and 100000' and "Voice if Amount > 100000"
The end user jstein
creates the following preference rule in the User Messaging Preferences user interface:
If "Application == HR-Application" and Amount > 2000000" send Voice