SOA 11g: BPEL Fault Policy

* See this post for an overview of BPEL faults.
* See this post for a SOA 11g fault policy tutorial.
* See this post for SOA 10g fault policy framework.

Fault Management Framework

Fault Binding

* Fault policy can be bound to:
– composite app
– BPEL and Mediator
– Reference binding components for BPEL and Mediator

Policy File Location

* Policy files:
– fault-policies.xml
– fault-bindings.xml
* Location:
– Defaults to same directory as composite.xml file.
– Also can be defined in following properties:

<property
 name="oracle.composite.faultPolicyFile">oramds:/apps/faultpolicyfiles/fault-policies.xml
</property>
<property
 name="oracle.composite.faultBindingFile">oramds:/apps/faultpolicyfiles/fault-bindings.xml
</property>

Binding Resolution Order

-> Reference binding component defined in composite.xml file.
-> BPEL or Mediator service components defined in composite.xml file.
-> SOA composite applicaiton defined in composite.xml file.
-> BPEL catch activity.

Design a Fault Policy

Create a Fault Policy file: fault-policies.xml

* Create a fault policy file in the same directory as the composite.xml file.
– See here if you want to place policy file in a different directory.
* Examples
below.
this tutorial post.

Define conditions

* Same as for 10g.

Define Actions

* Same as for 10g.

Create a Fault Policy Binding: fault-buildings.xml

* Create a fault binding file in the same directory as the composite.xml file.
– See here if you want to place binding file in a different directory.
* Examples
below.
this tutorial post.

Example

* fault-policies.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy">
	<faultPolicy version="2.0.1" 
		id="CRM_ServiceFaults" 
		xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
		xmlns:xs="http://www.w3.org/2001/XMLSchema"
		xmlns="http://schemas.oracle.com/bpel/faultpolicy" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
		<Conditions>
			<!-- Fault if wsdlRuntimeLocation is not reachable -->
			<faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
				name="bpelx:remoteFault">
				<condition>
					<test>$fault.code="WSDLReadingError"</test>
					<action ref="ora-terminate"/>
				</condition>
				<condition>
					<action ref="ora-java"/>
				</condition>
			</faultName>
 
			<!-- Fault if location port is not reachable-->
			<faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
				name="bpelx:bindingFault">
				<!--ORA-00001: unique constraint violated on insert-->
				<condition>
					<test>$fault.code="1"</test>
					<action ref="ora-java"/>
				</condition>
				<!--ORA-01400: cannot insert NULL -->
				<condition>
					<test xmlns:test="http://test">$fault.code="1400"</test>
					<action ref="ora-terminate"/>
				</condition>
				<!--ORA-03220: required parameter is NULL or missing -->
				<condition>
					<test>$fault.code="3220"</test>
					<action ref="ora-terminate"/>
				</condition>
				<condition>
					<action ref="ora-retry-crm-endpoint"/>
				</condition>
			</faultName>
 
			<!-- Business faults -->
			<!-- Fault comes with a payload of error, make sure the name space is
			provided here or at root level -->
			<faultName xmlns:credit="http://services.otn.com"
				name="credit:NegativeCredit">
				<!-- you get this fault when SSN starts with 0-->
				<condition>
					<test>$fault.payload="Bankruptcy Report"</test>
					<action ref="ora-human-intervention"/>
					<!--action ref="ora-retry"/-->
				</condition>
				<!-- you get this fault when SSN starts with 1-->
				<condition>
					<test>$fault.payload="Bankruptcy Report-abort"</test>
					<action ref="ora-terminate"/>
				</condition>
				<!-- you get this fault when SSN starts with 2-->
				<condition>
					<test>$fault.payload="Bankruptcy Report-rethrow"</test>
					<action ref="ora-rethrow-fault"/>
				</condition>
				<!-- you get this fault when SSN starts with 3-->
				<condition>
					<test>$fault.payload="Bankruptcy Report-replay"</test>
					<action ref="ora-replay-scope"/>
				</condition>
				<!-- you get this fault when SSN starts with 4-->
				<condition>
					<test
						xmlns:myError="http://services.otn.com">$fault.payload="Bankruptcy
						Report-human"</test>
					<action ref="ora-human-intervention"/>
				</condition>
				<!-- you get this fault when SSN starts with 5-->
				<condition>
					<test>$fault.payload="Bankruptcy Report-java"</test>
					<action ref="ora-java"/>
				</condition>
			</faultName>
		</Conditions>
 
		<Actions>
			<Action id="ora-retry">
				<retry>
				<retryCount>3</retryCount>
				<retryInterval>2</retryInterval>
				<exponentialBackoff/>
				<retryFailureAction ref="ora-java"/>
				<retrySuccessAction ref="ora-java"/>
				</retry>
			</Action>
			<Action id="ora-retry-crm-endpoint">
				<retry>
				<retryCount>5</retryCount>
				<retryFailureAction ref="ora-java"/>
				<retryInterval>5</retryInterval>
				<retrySuccessAction ref="ora-java"/>
				</retry>
			</Action>
			<Action id="ora-replay-scope">
				<replayScope/>
			</Action>
			<Action id="ora-rethrow-fault">
				<rethrowFault/>
			</Action>
			<Action id="ora-human-intervention">
				<humanIntervention/>
			</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_recipient">bpeladmin</property>
				<property name="email_recipient">joe@abc.com</property>
				<property name="email_recipient">mike@xyz.com</property>
				<property name="email_threshold">10</property>
				<property name="sms_recipient">+429876547</property>
				<property name="sms_recipient">+4212345</property>
				<property name="sms_threshold">20</property>
				<property name="user_email_recipient">john</property>
			</propertySet>
			<propertySet name="prop-for-order">
				<property name="email_recipient">john@abc.com</property>
				<property name="email_recipient">jill@xyz.com</property>
				<property name="email_threshold">10</property>
				<property name="sms_recipient">+42222</property>
				<property name="sms_recipient">+423335</property>
				<property name="sms_threshold">20</property>
			</propertySet>
		</Properties>                   
	</faultPolicy>
 
	<faultPolicy version="2.0.1" 
		id="Billing_ServiceFaults" 
		xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" 
		xmlns:xs="http://www.w3.org/2001/XMLSchema"
 
		xmlns="http://schemas.oracle.com/bpel/faultpolicy" 
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
		<Conditions>
			<faultName>
				<condition>
					<action ref="ora-manual"/>
				</condition>
			</faultName>
		</Conditions>
		<Actions>
			<Action id="ora-manual">
				<humanIntervention/>
			</Action>
		</Actions>
	</faultPolicy>
</faultPolicies>

* fault-bindings.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<faultPolicyBindings version="2.0.1"
	xmlns="http://schemas.oracle.com/bpel/faultpolicy"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
	<composite faultPolicy="ConnectionFaults"/>
 
	<component faultPolicy="ServiceFaults">
		<name>Component1</name>
		<name>Component2</name>
	</component>
 
	<!-- Below listed component names use polic CRM_SeriveFaults --> 
	<component faultPolicy="CRM_ServiceFaults">
		<name>HelloWorld</name>
		<name>ShippingComponent</name>
		<name>AnotherComponent"</name>
	</component>
 
	<!-- Below listed reference names and port types use polic CRM_ServiceFaults
	--> 
	<reference faultPolicy="CRM_ServiceFaults">
		<name>creditRatingService</name>
		<name>anotherReference</name>
		<portType
		xmlns:credit="http://services.otn.com">credit:CreditRatingService</portType>
		<portType
		xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/insert/">db:insert_
		plt</portType>
	</reference>
 
	<reference faultPolicy="test1">
		<name>CreditRating3</name>
	</reference>
</faultPolicyBindings>

References

* Using the Fault Management Framework

This entry was posted in soa11g. Bookmark the permalink.

2 Responses to SOA 11g: BPEL Fault Policy

Leave a Reply

Your email address will not be published. Required fields are marked *


*

This site uses Akismet to reduce spam. Learn how your comment data is processed.