Skip Headers

Oracle Fusion Middleware Oracle E-Business Suite Adapter User's Guide
12c (12.2.1.4.0)
Part Number E97300-02
Go to Table of Contents
Contents
Go to previous page
Previous
Go to next page
Next

Using Business Events

This chapter covers the following topics:

Overview of Business Events

The Oracle Workflow Business Event System (BES) is an application service that leverages the Oracle Advanced Queuing (AQ) infrastructure to communicate business events between systems. The Business Event System consists of the Event Manager and workflow process event activities.

The Event Manager contains a registry of business events, systems, named communication agents within those systems, and subscriptions indicating that an event is significant to a particular system. Events can be raised locally or received from an external system or the local system through AQ. When a local event occurs, the subscribing code is executed in the same transaction as the code that raised the event, unless the subscriptions are deferred.

Subscriptions can include the following types of processing:

Each business event represents a ready to use integration or extension point. Oracle E-Business Suite currently ships preconfigured with over 900 business events.

The uses of the Business Event System include:

Business Events Concepts

Event

A business event is an occurrence in an Internet or intranet application or program that might be significant to other objects in a system or to external agents. For instance, the creation of a purchase order is an example of a business event in a purchasing application.

Event Key

A string that uniquely identifies an instance of an event. Together, the event name, event key, and event data fully communicate what occurred in the event.

Event Message

A standard Workflow structure for communicating business events, defined by the datatype WF_EVENT_T. The event message contains the event data as well as several header properties, including the event name, event key, addressing attributes, and error information.

Event Activity

A business event modeled as an activity so that it can be included in a workflow process.

Event Data

A set of additional details describing an event. The event data can be structured as an XML document. Together, the event name, event key, and event data fully communicate what occurred in the event.

Event Subscription

A registration indicating that a particular event is significant to a system and specifying the processing to perform when the triggering event occurs. Subscription processing can include calling custom code, sending the event message to a workflow process, or sending the event message to an agent.

Deferred Subscription Processing

If you do not want subscriptions for an event to be executed immediately when the event occurs, you can defer the subscriptions. In this way you can return control more quickly to the calling application and let the Event Manager execute any costly subscription processing at a later time.

Agent

An agent is a named point of communication within a system. Communication within and between systems is accomplished by sending a message from one agent to another. A single system can have several different agents representing different communication alternatives. For example, a system may have different agents to support inbound and outbound communication, communication by different protocols, different propagation frequencies, or other alternatives.

Business Event Groups

A business event group is a type of event that contains multiple individual business events. Once an event group is defined, a subscription that is registered for an event group will be executed when any of the individual events within it is triggered.

With the support for business event groups, different business events belonging to an even group can be handled through a single partner link. A service created for an event group would be able to dequeue payloads corresponding to any of the events within the group.

To support existing partner links for outbound business events which are part of an event group, a workaround has to be followed. For detailed information, see Support for Business Events through Existing Partner Links.

Note: If individual events under a group are subscribed, then two messages would be enqueued into the WF_BPEL_Q queue. Users requiring only one message would need to disable the subscription for the individual event which enqueues the messages into WF_BPEL_Q.

For information about creating a partner link with a business event group, see Creating a Partner Link with a Business Event Group.

Design-Time Tasks for Outbound Business Events

This section describes the tasks required to configure Oracle E-Business Suite Adapter using the Adapter Configuration Wizard in Oracle JDeveloper.

Creating Service Artifacts for Business Event Consumption

While creating a partner link for listening to a business event, the following tasks are performed behind the scenes:

To facilitate re-creating the above entries on a different Oracle E-Business Suite instance, a script is generated in the project folder. In addition, a drop script is created which can be run manually on the corresponding instance to clean up all the tasks performed above. Running the drop script is optional, and is not recommended. The drop script would delete the WF_BPEL_Q queue, which can impact other composites, listening to events on the same Oracle E-Business Suite instance.

Multiple BPEL Processes Consuming the Same Business Event

Oracle E-Business Suite Adapter can handle multiple BPEL processes consuming the same business event. Oracle E-Business Suite Adapter creates only single subscription for a particular business event regardless of the number of BPEL process consuming it. Internally, this subscription forwards business event message to a multi-consumer AQ. Since each BPEL process is an unique consumer for the event, when the message is placed in the queue, all BPEL processes are notified. Therefore, as a user you do not need to create a separate subscription for each BPEL process. All you need to do is to create the service for the event, and Oracle E-Business Suite Adapter will take care of message delivery to each BPEL process.

For example, if there are three BPEL processes (BPEL1, BPEL2, and BPEL3) that want to consume the same business event (such as BE1 event). For each BPEL process, you create a service for the BE1 event using Oracle E-Business Suite Adapter. Oracle E-Business Suite Adapter in turn creates a single subscription for all the three BPEL processes - BPEL1, BPEL2, and BPEL3. This subscription puts BE1 event message in multi-consumer AQ.

At run time, when a BE1 event is raised, since the subscription is applicable to all the three BPEL processes, all these three deployed BPEL processes will be activated and would receive the same BE1 event message.

SOA Composite Application with BPEL Process Scenario

Take a PO XML Raise business event as an example.

When a purchase order is created and approved, a purchase order approved business event oracle.apps.po.evnt.xmlpo is raised. The subscription to this event is created in the background to listen to the business event and get event details. The event data will be passed through BPEL process activities and then written in XML file as an output file.

When the SOA Composite application with BPEL process has been successfully executed after deployment, you should get the same purchase order information from the output file once a purchase order is approved.

Prerequisites to Configure Outbound Business Events

SOA Composite Application with BPEL Process Creation Flow

Based on the PO XML Raise business event scenario, the following design-time tasks are discussed in this chapter:

  1. Create a new SOA Composite application with BPEL process.

  2. Create a partner link.

  3. Configure a Receive activity.

  4. Add a partner link for the file adapter.

  5. Configure an Invoke activity.

  6. Configure an Assign activity.

Creating a New SOA Composite Application with BPEL Process

To create a new SOA Composite application with BPEL process

  1. Launch Oracle JDeveloper.

  2. Click New Application in the Application Navigator.

    The New Gallery page appears. Select SOA Application from the Items list.

    The New Gallery Page

    the picture is described in the document text

    Click OK.

  3. The Create SOA Application - Name your application page is displayed.

  4. Enter an appropriate name for the application in the Application Name field.

    Click Next. The Create SOA Application - Name your project page appears.

  5. Enter an appropriate name for the project in the Project Name field, such as GetPOAckBusinessEvent.

    Notice that SOA Suite is shown in the Project Features section.

  6. Click Next. The Create SOA Application - Configure SOA settings page appears.

    Leave the default Standard Composite selection unchanged for the Start from field.

    Select Composite With BPEL Process from the Standard Composite list, and then click Finish. You have created a new application, and a SOA project. This automatically creates a SOA Composite.

  7. In the Create BPEL Process page, leave the default BPEL 2.0 Specification selection unchanged. This creates a BPEL project that supports the BPEL 2.0 specification.

    The Create BPEL Process Page

    the picture is described in the document text

    Click OK.

    An empty BPEL process is created. The required source files including bpel and wsdl, using the name you specified (for example, GetPOAckBusinessEvent.bpel and GetPOAckBusinessEvent.wsdl) and GetPOAckBusinessEvent (composite.xml) are also generated.

Creating a Partner Link

Configuring an outbound business event requires creating a partner link to allow the outbound event to be published.

This task adds a partner link to the BPEL process. A partner link defines the link name, type, and the role of the BPEL process that interacts with the partner service.

To add a partner link

  1. Click BPEL Services in the Component palette.

    Drag and drop Oracle E-Business Suite (formerly known as Oracle Applications) from the BPEL Services list into the right Partner Link swim lane of the process diagram. The Oracle E-Business Suite Reference page appears.

    Enter a reference name in the Name field, such as GetPOApprovalEvent.

  2. Click Next. The Service Connection dialog appears.

  3. You can perform either one of the following options for your database connection:

    Note: You need to connect to the database where Oracle E-Business Suite is running.

  4. Once you have completed creating a new connection for the service, you can add a business event by browsing through the list available in Oracle E-Business Suite.

    Click Next.

    If you are connecting to Oracle E-Business Suite Release 12, then the IREP File not present dialog appears indicating that Adapter could not find the Oracle Integration Repository data file corresponding to the database you are connecting in your workspace. Absence of the data file would make browsing or searching of Integration Repository tree considerably slow. You can choose to extract the data file and create a local copy of the Integration Repository data file. Once it is created successfully, Adapter will pick it up automatically next time and retrieve data from your local Integration Repository.

    You can select one of the following options:

  5. The Oracle E-Business Suite Module Browser combines interface data from Oracle Integration Repository with information about the additional interfaces supported by Oracle E-Business Suite Adapter, organized in a tree hierarchy.

    To select a business event, expand the navigation tree to Product Families > Other Interfaces > Business Events > Outbound. The direction outbound is from the Oracle E-Business Suite perspective, in this case listening to business events from Oracle E-Business Suite. Select the appropriate business event, for example, oracle.apps.po.event.xmlpo, and click OK. The Application Interface page is displayed with selected business event.

    Oracle E-Business Suite Module Browser with an Event Selected

    the picture is described in the document text

    Note: Creating a Partner Link with a Business Event Group

    Business event groups appear under the Other Interfaces > Business Events > Outbound > Groups node from the Oracle E-Business Suite Module Browser.

    If a business event group (such as oracle.apps.fem.event.group.all) is selected from the Groups node, detailed event group information including the event group owner name, generate function information if any, and each individual event contained in the selected event group is listed in the right pane of the Oracle E-Business Suite Module Browser window.

    Oracle E-Business Suite Module Browser with an Event Group Selected

    the picture is described in the document text

    Additionally, select 'Any Schema' in the WF Event Schema Definition page later on for the business event payload. This allows XML payload of any schema to be attached to event payload. You can also verify the JCA Property "MessageSelectorRule" for the selected event group (described in Step 10) once the partner link is created.

    This feature applies to Oracle E-Business Suite Release 12 and Release 11.5.10. For more information about business event groups, see Business Event Groups.

  6. Click OK to display the Application Interface page.

    Application Interface Page

    the picture is described in the document text

  7. Click Next in the Application Interface page. The WF Event Schema Definition page for business event payload appears.

  8. Specifying Event Schema

    You must specify one of the following options to be used for the business event payload:

    Note: When you select either the 'No Schema' or 'Any Schema' option, there is no need to further specify the schema information for your business event, and you will proceed to the next step.

    WF Event Schema Definition Page

    the picture is described in the document text

    Select 'No Schema' and click Next.

  9. The Finish page appears indicating that you have finished defining the business event service.

  10. The Set Transaction Properties of BPEL Service dialog appears. Ensure that 'sync' is selected in the Delivery field and 'required' is selected in the Transaction field.

    Set the Transaction Properties of BPEL Service Dialog

    the picture is described in the document text

    Click OK to complete the partner link configuration.

    The wizard generates the GetPOApprovalEvent WSDL file corresponding to the oracle.apps.po.event.xmlpo business event service.

    The partner link is created with the required WSDL settings, and is represented in the BPEL project by a new icon in the border area of the process diagram.

  11. Verifying JCA Property "MessageSelectorRule" for an Event Group Partner Link

    If a business event group is selected for the partner link creation, you can verify the business event group JCA property by selecting the partner link service (such as BE_Group_apps.jca from the SOA Content > Adapters folder.

    Applications Pane with BE_Group_apps.jca File Selected

    the picture is described in the document text

    Click the Source tab to display the .jca file. Notice that the JCA property "MessageSelectorRule" contains the value of

    value="tab.user_data.getvalueforparameter ('GROUP') = 'oracle.apps.fem.event.group.all'".

    BE_Group_apps.jca File in Oracle JDeveloper with JCA Property "MessageSelectorRule" and Value Highlighted

    the picture is described in the document text

Configuring the Receive Activity

The next task is to configure a Receive activity to receive event details from the partner link that you just configured for the adapter service as an input to the Assign activity.

To configure the Receive activity

  1. In JDeveloper BPEL Designer, expand the BPEL Constructs from the Component Palette. Drag and drop Receive from the Web Service section into the center swim lane of the process diagram.

  2. Link the Receive activity to the partner link GetPOApprovalEvent that you just created earlier.

    BPEL Diagram with the Receive Activity

    the picture is described in the document text

    The Receive dialog appears.

  3. Enter an appropriate name for the Receive activity.

    The Dequeue Operation is automatically selected since the partner link has been configured with an outbound business event.

  4. Specify a Variable to receive the message data from the partner link by clicking the Create icon to the right of the Variable field. The Create Variable dialog box appears.

  5. Click OK to accept the default name.

    Edit Receive Dialog

    the picture is described in the document text

  6. Click Apply in the Receive dialog, then click OK.

Adding a Partner Link for the File Adapter

If you are configuring an outbound business event, you need to add another partner link for the file adapter. This allows the outbound business event to write the data to the XML file.

To add a partner link for the file adapter

  1. In Oracle JDeveloper BPEL Designer, click BPEL Services in the Component palette.

    Drag and drop File Adapter from the BPEL Services list into the right Partner Link swim lane of the process diagram. The File Adapter Reference page appears.

    File Adapter Reference Page

    the picture is described in the document text

    Enter a name for the file adapter service. For example, enter WriteEventData.

  2. Click Next. The Adapter Interface page appears.

    Select the Define from operation and schema (specified later) radio button and click Next.

    The File Server Connection page appears. Leave the default value unchanged for the File Server JNDI Name field.

    Click Next

  3. In the Operation page, specify the operation type. For example, select the Write File radio button. This automatically populates the Operation Name field.

    Operation Page

    the picture is described in the document text

  4. Click Next to access the File Configuration page.

    File Configuration Page

    the picture is described in the document text

  5. For the Directory specified as field, select the Logical Name radio button. Enter outputDir as the Directory for Outgoing Files (logical name) and specify a naming convention for the output file, such as EventAck%yyMMddHHmmss%.xml.

    Tip: When you type a percent sign (%), you can choose from a list of date variables or a sequence number variable (SEQ) as part of the filename.

    Confirm the default write condition: Number of Messages Equals 1.

  6. Click Next, and the Messages page appears. For the output file to be written, you must provide a schema.

  7. Click Browse to access the Type Chooser.

  8. Expand the node by clicking Project Schema Files > WF_EVENT_T_GetPOApprovalEvent.xsd. Select WF_EVENT_T as the element and click OK.

    Type Chooser Dialog

    the picture is described in the document text

    The selected schema information will be automatically populated in the URL and Schema Element fields.

    Messages Page with Selected Schema Information

    the picture is described in the document text

    Click Next .

  9. In the JCA Endpoint Properties page, leave the default concurrent threshold unchanged.

    JCA Endpoint Properties Page

    the picture is described in the document text

    Click Next and then Finish. This completes the configuration and creates the partner link with the required WSDL settings for the File Adapter service.

    The wizard also generates the WriteEventData.wsdl WSDL file corresponding to the partner link.

    The WriteEventData Partner Link appears in the BPEL process diagram. Double click the Partner Link service icon to open the Edit Partner Link dialog and view the details.

    Edit Partner Link Dialog

    the picture is described in the document text

Configuring an Invoke Activity

After adding the File Adapter partner link, you need to configure an Invoke activity to associate it with the File Adapter link.

Through the Invoke activity, the business event information can be written to the XML file you specified as the output directory.

To configure an Invoke activity

  1. In Oracle JDeveloper BPEL Designer, expand the BPEL Constructs from the Component Palette. Drag and drop an Invoke activity from the Web Service section into the center swim lane of the process diagram after the Receive activity.

  2. Link the Invoke activity to the WriteEventData File Adapter service.

    The Invoke activity will send event data to the partner link. The Edit Invoke dialog appears.

  3. Enter a name for the Invoke activity. In the Input tab, ensure the Input Variable radio button is selected. Click the Create icon next to the Input Variable field to create a new variable. The Create Variable dialog box appears.

  4. Select Global Variable, then enter a name for the variable. You can also accept the default name. Click OK to return to the Edit Invoke dialog.

    Edit Invoke Dialog

    the picture is described in the document text

    Click Apply and then OK to finish configuring the Invoke activity.

Configuring an Assign Activity

Use the Assign activity to take the output from the Receive activity and to provide input to the invoke activity.

To configure an Assign activity

  1. In Oracle JDeveloper BPEL Designer, expand the BPEL Constructs from the Component Palette. Drag and drop the Assign activity from the Basic Activities section into the center swim lane of the process diagram, between the Receive activity and the Invoke activity.

  2. Double-click the Assign activity to access the Edit Assign dialog.

    Click the General tab to enter a name for the Assign activity, such as setEventData.

  3. Select the Copy Rules tab and expand the target trees:

    Drag the source node (WF_EVENT_T) to connect to the target node (body) that you just specified. This creates a line that connects the source and target nodes. The copy rule is displayed in the From and To sections at the bottom of the Edit Assign dialog box.

    Edit Assign Dialog

    the picture is described in the document text

  4. Click Apply and then OK in the Edit Assign dialog box to complete the configuration of the Assign activity.

    Completed Outbound Business Event BPEL Process Project

    the picture is described in the document text

    Click the GetPOApprovalEvent (composite.xml) to display the Oracle JDeveloper composite diagram:

    Note: Click the Source tab of GetPOApprovalEvent (composite.xml) to enter a value for the physical directory outputDir for the reference WriteEventData (such as /usr/tmp).

    <property name="outputDir" type="xs:string" many="false" override="may">/usr/tmp</property>

    Specifying the Physical Directory for the Property

    the picture is described in the document text

    Oracle JDeveloper Composite Diagram

    the picture is described in the document text

Run-Time Tasks for Outbound Business Events

After designing the SOA Composite with BPEL process, you can compile, deploy and test it.

  1. Deploy the SOA Composite application with BPEL process.

  2. Test the SOA Composite application with BPEL process.

Deploying the SOA Composite Application with BPEL Process

To invoke the service (GetPOApprovalEvent) from the BPEL client contained in the SOA composite, the SOA composite needs to be deployed to the Oracle WebLogic managed server. This can be achieved using Oracle JDeveloper. Once the composite is deployed, it can be tested from the Oracle Enterprise Manager Fusion Middleware Control Console.

Prerequisites

Before deploying the SOA composite with BPEL process using Oracle JDeveloper, you must have established the connectivity between the design-time environment and the run-time server. For more information, see Configuring the Data Source in Oracle WebLogic Server and Creating an Application Server Connection.

Note: If a local instance of the WebLogic Server is used, start the WebLogic Server by selecting Run > Start Server Instance from Oracle JDeveloper. Once the WebLogic Admin Server "DefaultServer" instance is successfully started, the <Server started in Running mode> and DefaultServer started message in the Running:DefaultServer and Messages logs should appear.

To deploy the SOA Composite application with BPEL process

  1. In the Applications Navigator of JDeveloper BPEL Designer, select your SOA Composite project name (such as GetPOAckBusinessEvent).

  2. Right-click the project name, and then select Deploy > [project name] > [serverConnection] from the menu that appears.

    For example, you can select Deploy > GetPOAckBusinessEvent > soa-server1 to deploy the process if you have the connection set up appropriately.

    Note: If this is the first time to set up server connection, then the Deployment Action window appears. Select 'Deploy to Application Server' and click Next.

    In the Deploy Configuration window, ensure the following information is selected before clicking Next to add a new application server:

    The steps to create a new Oracle WebLogic Server connection from JDeveloper are covered inCreating an Application Server Connection.

  3. In the Select Server page, select 'soa-server1' that you have established the server connection earlier. Click Next.

  4. In the SOA Servers page, accept the default target SOA Server ('soa-server1') selection.

    Click Next and Finish.

    If you are deploying the composite for the first time from your Oracle JDeveloper session, the Authorization Request window appears. Enter username and password information specified during Oracle SOA Suite installation. Click OK.

  5. Deployment processing starts. Monitor deployment progress and check for successful compilation in the SOA - Log window as well as in the Deployment - Log window.

Testing the SOA Composite Application with BPEL Process

Once the SOA Composite application with BPEL process is deployed, you can manage and monitor the process from the Oracle Enterprise Manager Fusion Middleware Control Console. You can also test the process by manually initiating it.

To test the SOA Composite application with BPEL process

  1. Navigate to Oracle Enterprise Manager Fusion Middleware Control Console (http://<servername>:<portnumber>/em). The composite you deployed is displayed in the Applications Navigation tree.

  2. Enter username (such as weblogic) and password and click Login to log in to a farm.

    You may need to select an appropriate target instance farm if there are multiple target Oracle Enterprise Manager Fusion Middleware Control Console farms.

  3. From the Farm base domain, expand the SOA > soa-infra > soa-infra (soa_server1) > default to navigate through the SOA Infrastructure home page and menu to access your deployed SOA Composite applications running in the SOA Infrastructure for that managed server.

    Note: The Farm menu always displays at the top of the navigator. When you expand the SOA folder in the navigator and click the links displayed beneath it, the SOA Infrastructure menu becomes available at the top of the page.

  4. Log on to Oracle E-Business Suite with the XML Gateway responsibility.

    This is to ensure that the XML Gateway trading partner is set up correctly so that a purchase order can have a valid supplier that has been defined.

  5. Select Define Trading Partner from the navigation menu to access the Trading Partner Setup window.

  6. Enter the header values on the Trading Partner Setup window as follows:

  7. Enter the following trading partner details:

    Trading Partner Setup Window

    the picture is described in the document text

    Save the trading partner details.

  8. Switch responsibility by selecting the Purchasing, Vision Operations (USA) and select Purchase Order from the navigation menu.

    The Purchase Order window appears.

  9. Create a purchase order with the header values reflecting the trading partner you previously defined in the Purchase Order window:

  10. On the Lines tab, enter a data row with the following values:

  11. Save your purchase order. The status of the purchase order is 'Incomplete'.

    Purchase Orders Window

    the picture is described in the document text

  12. Click Approve. The Approve Document window appears.

    Approve Document Window

    the picture is described in the document text

    Click OK to confirm the approval.

    Note: Because the trading partner is set up and valid, the transmission method is automatically set to XML.

    The status of the purchase order is now changed to 'Approved'. For future reference, record the value of the PO, Rev field (for example, the PO number 4449 in this case).

    Once the purchase order is approved, the business event oracle.apps.po.event.xmlpo is raised.

  13. Use the following steps to ensure that the WF_Deferred Agent Listener is running on the target database.

    1. Log on to Oracle E-Business Suite as a user who has the System Administrator responsibility.

    2. Select the Workflow Administrator Web Applications responsibility and choose Oracle Applications Manager > Workflow Manager from the menu.

      Applications Manager Page

      the picture is described in the document text

    3. On the Applications Manager page, click the Agent Listeners icon. The Service Components page appears, containing a list of the installed agent listeners.

      Service Components Page

      the picture is described in the document text

    4. Confirm that the Workflow Deferred Agent Listener is in Running status.

  14. At this time, your deployed BPEL process contained in a SOA Composite is listening for oracle.apps.po.event.xmlpo business event. Please allow 2 to 3 minutes for the BPEL process to activate after the event is raised.

  15. Go to the directory, for example outputDir (typically under c:\temp) you specified for the write operation. Open the output file (such as EventAck%yyMMddHHmmss.xml), and confirm that the order number is same as that of the approved purchase order.

    Output File with the Order Number Selected

    the picture is described in the document text

Troubleshooting

If you experience problems with your Business Event System integration, you can check the following troubleshooting steps: