SOA Business Events
SOA Business Events
1. Customer would get created in database using a Web application with 'INACTIVE' as mode.
2. This customer creation would raise a business event.
3. Business event raised would be captured by Composite process (Mediator)
4. Mediator would route this request to BPEL Process.
5. BPEL Process will take help of business rule to decide whether an approval is needed or not
6. After approval/ no approval the customer state would get updated in database from 'INACTIVE' to 'ACTIVE'
or ‘INVALID’
Before we begin, execute the following SQL to alter SOADEMO.CUSTOMERS table in order to add
‘ACTIVE_STATUS’ column
Stage 1 and Stage 2 are already implemented, this document would guide you from Stage 3 onwards
Stage 3: Enable Business Event on Entity Object within ADF-BC for Customer Create
Double click on ‘CustomerEO’ entity object from NewCustomerADFApplication Model then click on
‘Business Events’
With this Stage completes, and our ADF Application would raise event as soon as user performs Create
operation on ADF-BC.
Stage 4: Configure Mediator as Subscriber to ADF-BC’s Business Event and invoke
BPEL Process
Change your focus to composite.xml file from ‘NewCustomerComposite’
Drag and drop Mediator component within ‘Components’ section Enter name of Mediator as mentioned
below Select template as ‘Subscribe to Events’ Then click on “+”
Select ‘Customer.edl’ file from NewCustomerADFApplication’s Model Project as mentioned below
Wire Mediator with BPEL component, this way a routing rule would get created within Mediator.
Construct the Transformation file within Mediator component, in order to route Event data (CustId) to BPEL
Component.
Construct the transformation mapping as described below
Redeploy Composite application: Right click on Composite Project Click on Deploy Click on
‘NewCustomer’
Provide Data Input for CreateApproval task Click on Data tab Click on “+” Click on Add Other Payload
Select Element from XSD as mentioned below
Now configure the Assignment policy for ‘weblogic’ user
Now Wire BPEL Process with Human Task as described below
Drag and Drop Human task within BPEL Process as mentioned below
Configure the Human Task as follows
Redeploy the Composite and try creating new customer again using web application, this time you would need
to give approval by accessing http://localhost:8001/integration/worklistapp
(Optionally) If you notice on selecting Approval request details are not being displayed, reason is TaskForm is
missing. In order to get TaskForm. Right click on HumanTask within BPEL Process and click ‘Auto Generate Task
Form’. This would ask project name to construct JSP pages.
Before we begin we need to create Schema supporting DATA for above condition, then we will construct
Business Rule accordingly.
Create New XML Schema Document within Composite service as mentioned below
Construct Schema structure as follows
Drag and drop Business Rule within Components pane of composite.xml file
Browse and give Input and Output XSD structure for Business Rule as ApprovalData (created earlier)
Now let’s use this Business Rule within BPEL Process, so create “WIRE” from BPEL Process to Business Rule
Create ‘approvalResponse’ variable to hold Business Rule response so that we can construct Switch activity for
Human task.
Redeploy the process and test with any status other than ‘gold’ and ‘platinum’, ideally if business rule executes
successfully you should not see Approval Request in Worklist application.