Additional Fault Policy and Fault Policy Binding File Samples

Using Fault Handling in a BPEL Process 11-15 Action Action id=ora-terminate abort Action Action id=ora-java -- this is user provided class-- javaAction className=com.oracle.bpel.client.config.faultpolicy.TestJavaAction defaultAction=ora-terminate propertySet=prop-for-billing returnValue value=REPLAY ref=ora-terminate returnValue value=RETRHOW ref=ora-rethrow-fault returnValue value=ABORT ref=ora-terminate returnValue value=RETRY ref=ora-retry returnValue value=MANUAL ref=ora-human-intervention javaAction Action Actions Properties propertySet name=prop-for-billing property name=user_email_recipientbpeladminproperty property name=email_recipientjoeabc.comproperty property name=email_recipientmikexyz.comproperty property name=email_threshold10property property name=sms_recipient+429876547property property name=sms_recipient+4212345property property name=sms_threshold20property property name=user_email_recipientjohnproperty propertySet propertySet name=prop-for-order property name=email_recipientjohnabc.comproperty property name=email_recipientjillxyz.comproperty property name=email_threshold10property property name=sms_recipient+42222property property name=sms_recipient+423335property property name=sms_threshold20property propertySet Properties faultPolicy faultPolicy version=2.0.1 id=Billing_ServiceFaults xmlns:env=http:schemas.xmlsoap.orgsoapenvelope xmlns:xs=http:www.w3.org2001XMLSchema xmlns=http:schemas.oracle.combpelfaultpolicy xmlns:xsi=http:www.w3.org2001XMLSchema-instance Conditions faultName condition action ref=ora-manual condition faultName Conditions Actions Action id=ora-manual humanIntervention Action Actions faultPolicy 11-16 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite faultPolicies Example 11–8 shows the fault-buildings.xml file that associates the fault policies defined in fault-policies.xml. Example 11–8 Fault Policy Bindings File ?xml version=1.0 encoding=UTF-8? faultPolicyBindings version=2.0.1 xmlns=http:schemas.oracle.combpelfaultpolicy xmlns:xsi=http:www.w3.org2001XMLSchema-instance composite faultPolicy=ConnectionFaults component faultPolicy=ServiceFaults nameComponent1name nameComponent2name component -- Below listed component names use polic CRM_SeriveFaults -- component faultPolicy=CRM_ServiceFaults nameHelloWorldname nameShippingComponentname nameAnotherComponentname component -- Below listed reference names and port types use polic CRM_ServiceFaults -- reference faultPolicy=CRM_ServiceFaults namecreditRatingServicename nameanotherReferencename portType xmlns:credit=http:services.otn.comcredit:CreditRatingServiceportType portType xmlns:db=http:xmlns.oracle.compcbpeladapterdbinsertdb:insert_ pltportType reference reference faultPolicy=test1 nameCreditRating3name reference faultPolicyBindings

11.4.1.5 Designing a Fault Policy with Multiple Rejection Handlers

If you design a fault policy that uses the action handler for rejected messages, note that only one write action can be performed. Multiple write actions cannot be performed, even if you define multiple rejection handlers, as shown in Example 11–9 . In this case, only the first rejection handler defined for this example, ora-queue is executed. Example 11–9 Fault Policy with Multiple Rejection Handlers faultName xmlns:rjm=http:schemas.oracle.comscarejectedmessages name=rjm:FileIn condition action ref=ora-queue condition faultName faultName xmlns:rjm=http:schemas.oracle.comscarejectedmessages name=rjm:FileIn condition action ref=ora-file condition Using Fault Handling in a BPEL Process 11-17 faultName

11.4.2 How to Execute a Fault Policy

You deploy a fault policy as part of a SOA composite application. After deployment, you can perform the following fault recovery actions from Oracle Enterprise Manager Fusion Middleware Control: ■ Retry the activity ■ Modify a variable available to the faulted activity ■ Continue the instance mark the activity as a success ■ Rethrow the exception ■ Abort the instance ■ Throw a replay scope exception For additional information, see Oracle Fusion Middleware Administrators Guide for Oracle SOA Suite and Oracle BPM Suite for the following: ■ Instructions on executing a fault policy in Oracle Enterprise Manager Fusion Middleware Control ■ Use cases in which you define a fault policy that uses human intervention

11.4.3 How to Use a Java Action Fault Policy

Note the following details when using the Java action fault policy: ■ The Java class provided follows a specific interface. This interface returns a string. Multiple values can be provided for output and fault policy to take after execution. ■ Additional fault policy can be executed by providing a mapping from the output value return value of implemented methods to a fault policy. ■ If no ReturnValue is specified, the default fault policy is executed, as shown in Example 11–10 . Example 11–10 Java Action Fault Policy Action id=ora-java javaAction className=mypackage.myclass defaultAction=ora-human-intervention propertySet=prop-for-billing --defaultAction is a required attribute, but propertySet is optional-- -- attribute-- ReturnValue value=RETRY ref=ora-retry --value is not nilable attribute cannot be empty-- ReturnValue value=RETRHOW ref=ora-rethrow-fault javaAction Action Table 11–3 provides an example of ReturnValue use. Table 11–3 System Interpretation of Java Action Fault Policy Code Description ReturnValue value=RETRY ref=ora-retry Execute the ora-retry action if the method returns a string of RETRY. 11-18 Oracle Fusion Middleware Developers Guide for Oracle SOA Suite To invoke a Java class, you can provide a class that implements the IFaultRecoveryJavaClass interface. IFaultRecoveryJavaClass is included in the fabric-runtime.jar file. The package name is oracle.integration.platform.faultpolicy. The IFaultRecoveryJavaClass interface has two methods, as shown in Example 11–11 . Example 11–11 implementation of IFaultRecoveryJavaClass public interface IFaultRecoveryJavaClass { public void handleRetrySuccess IFaultRecoveryContext ctx ; public String handleFault IFaultRecoveryContext ctx ; } Note the following details: ■ handleRetrySuccess is invoked upon a successful retry attempt. The retry policy chains to a Java action on retrySuccessAction. ■ handleFault is invoked to execute a policy of type javaAction. Example 11–12 shows the data available with IFaultRecoveryContext: Example 11–12 Data Available with IFaultRecoveryContext public interface IFaultRecoveryContext { Gets implementation type of the fault. return public String getType; return Get property set of the fault policy action being executed. public Map getProperties; ReturnValue value=” ref=”ora-rethrow” Fails in validation. javaAction className=mypackage.myclass defaultAction=ora-human-intervention Execute ora-human-intervention after Java code execution. This attribute is used if the return from the method does not match any provided ReturnValue. ReturnValue value=RETRY ref=ora-retry ReturnValue value=” ref=”” Fails in validation. javaAction className=mypackage.myclass defaultAction= ora-human-intervention ReturnValueReturnValue Fails in validation. Table 11–3 Cont. System Interpretation of Java Action Fault Policy Code Description