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:

  1.  
  2. <property
  3. name="oracle.composite.faultPolicyFile">oramds:/apps/faultpolicyfiles/fault-policies.xml
  4. </property>
  5. <property
  6. name="oracle.composite.faultBindingFile">oramds:/apps/faultpolicyfiles/fault-bindings.xml
  7. </property>
  8.  

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:

  1.  
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <faultPolicies xmlns="http://schemas.oracle.com/bpel/faultpolicy">
  4. <faultPolicy version="2.0.1"
  5. id="CRM_ServiceFaults"
  6. xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  7. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  8. xmlns="http://schemas.oracle.com/bpel/faultpolicy"
  9. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  10. <Conditions>
  11. <!-- Fault if wsdlRuntimeLocation is not reachable -->
  12. <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
  13. name="bpelx:remoteFault">
  14. <condition>
  15. <test>$fault.code="WSDLReadingError"</test>
  16. <action ref="ora-terminate"/>
  17. </condition>
  18. <condition>
  19. <action ref="ora-java"/>
  20. </condition>
  21. </faultName>
  22.  
  23. <!-- Fault if location port is not reachable-->
  24. <faultName xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
  25. name="bpelx:bindingFault">
  26. <!--ORA-00001: unique constraint violated on insert-->
  27. <condition>
  28. <test>$fault.code="1"</test>
  29. <action ref="ora-java"/>
  30. </condition>
  31. <!--ORA-01400: cannot insert NULL -->
  32. <condition>
  33. <test xmlns:test="http://test">$fault.code="1400"</test>
  34. <action ref="ora-terminate"/>
  35. </condition>
  36. <!--ORA-03220: required parameter is NULL or missing -->
  37. <condition>
  38. <test>$fault.code="3220"</test>
  39. <action ref="ora-terminate"/>
  40. </condition>
  41. <condition>
  42. <action ref="ora-retry-crm-endpoint"/>
  43. </condition>
  44. </faultName>
  45.  
  46. <!-- Business faults -->
  47. <!-- Fault comes with a payload of error, make sure the name space is
  48. provided here or at root level -->
  49. <faultName xmlns:credit="http://services.otn.com"
  50. name="credit:NegativeCredit">
  51. <!-- you get this fault when SSN starts with 0-->
  52. <condition>
  53. <test>$fault.payload="Bankruptcy Report"</test>
  54. <action ref="ora-human-intervention"/>
  55. <!--action ref="ora-retry"/-->
  56. </condition>
  57. <!-- you get this fault when SSN starts with 1-->
  58. <condition>
  59. <test>$fault.payload="Bankruptcy Report-abort"</test>
  60. <action ref="ora-terminate"/>
  61. </condition>
  62. <!-- you get this fault when SSN starts with 2-->
  63. <condition>
  64. <test>$fault.payload="Bankruptcy Report-rethrow"</test>
  65. <action ref="ora-rethrow-fault"/>
  66. </condition>
  67. <!-- you get this fault when SSN starts with 3-->
  68. <condition>
  69. <test>$fault.payload="Bankruptcy Report-replay"</test>
  70. <action ref="ora-replay-scope"/>
  71. </condition>
  72. <!-- you get this fault when SSN starts with 4-->
  73. <condition>
  74. <test
  75. xmlns:myError="http://services.otn.com">$fault.payload="Bankruptcy
  76. Report-human"</test>
  77. <action ref="ora-human-intervention"/>
  78. </condition>
  79. <!-- you get this fault when SSN starts with 5-->
  80. <condition>
  81. <test>$fault.payload="Bankruptcy Report-java"</test>
  82. <action ref="ora-java"/>
  83. </condition>
  84. </faultName>
  85. </Conditions>
  86.  
  87. <Actions>
  88. <Action id="ora-retry">
  89. <retry>
  90. <retryCount>3</retryCount>
  91. <retryInterval>2</retryInterval>
  92. <exponentialBackoff/>
  93. <retryFailureAction ref="ora-java"/>
  94. <retrySuccessAction ref="ora-java"/>
  95. </retry>
  96. </Action>
  97. <Action id="ora-retry-crm-endpoint">
  98. <retry>
  99. <retryCount>5</retryCount>
  100. <retryFailureAction ref="ora-java"/>
  101. <retryInterval>5</retryInterval>
  102. <retrySuccessAction ref="ora-java"/>
  103. </retry>
  104. </Action>
  105. <Action id="ora-replay-scope">
  106. <replayScope/>
  107. </Action>
  108. <Action id="ora-rethrow-fault">
  109. <rethrowFault/>
  110. </Action>
  111. <Action id="ora-human-intervention">
  112. <humanIntervention/>
  113. </Action>
  114. <Action id="ora-terminate">
  115. <abort/>
  116. </Action>
  117. <Action id="ora-java">
  118. <!-- this is user provided class-->
  119. <javaAction
  120. className="com.oracle.bpel.client.config.faultpolicy.TestJavaAction"
  121. defaultAction="ora-terminate" propertySet="prop-for-billing">
  122. <returnValue value="REPLAY" ref="ora-terminate"/>
  123. <returnValue value="RETRHOW" ref="ora-rethrow-fault"/>
  124. <returnValue value="ABORT" ref="ora-terminate"/>
  125. <returnValue value="RETRY" ref="ora-retry"/>
  126. <returnValue value="MANUAL" ref="ora-human-intervention"/>
  127. </javaAction>
  128. </Action>
  129. </Actions>
  130.  
  131. <Properties>
  132. <propertySet name="prop-for-billing">
  133. <property name="user_email_recipient">bpeladmin</property>
  134. <property name="email_recipient">joe@abc.com</property>
  135. <property name="email_recipient">mike@xyz.com</property>
  136. <property name="email_threshold">10</property>
  137. <property name="sms_recipient">+429876547</property>
  138. <property name="sms_recipient">+4212345</property>
  139. <property name="sms_threshold">20</property>
  140. <property name="user_email_recipient">john</property>
  141. </propertySet>
  142. <propertySet name="prop-for-order">
  143. <property name="email_recipient">john@abc.com</property>
  144. <property name="email_recipient">jill@xyz.com</property>
  145. <property name="email_threshold">10</property>
  146. <property name="sms_recipient">+42222</property>
  147. <property name="sms_recipient">+423335</property>
  148. <property name="sms_threshold">20</property>
  149. </propertySet>
  150. </Properties>
  151. </faultPolicy>
  152.  
  153. <faultPolicy version="2.0.1"
  154. id="Billing_ServiceFaults"
  155. xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
  156. xmlns:xs="http://www.w3.org/2001/XMLSchema"
  157.  
  158. xmlns="http://schemas.oracle.com/bpel/faultpolicy"
  159. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  160. <Conditions>
  161. <faultName>
  162. <condition>
  163. <action ref="ora-manual"/>
  164. </condition>
  165. </faultName>
  166. </Conditions>
  167. <Actions>
  168. <Action id="ora-manual">
  169. <humanIntervention/>
  170. </Action>
  171. </Actions>
  172. </faultPolicy>
  173. </faultPolicies>
  174.  

* fault-bindings.xml file:

  1.  
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <faultPolicyBindings version="2.0.1"
  4. xmlns="http://schemas.oracle.com/bpel/faultpolicy"
  5. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  6.  
  7. <composite faultPolicy="ConnectionFaults"/>
  8.  
  9. <component faultPolicy="ServiceFaults">
  10. <name>Component1</name>
  11. <name>Component2</name>
  12. </component>
  13.  
  14. <!-- Below listed component names use polic CRM_SeriveFaults -->
  15. <component faultPolicy="CRM_ServiceFaults">
  16. <name>HelloWorld</name>
  17. <name>ShippingComponent</name>
  18. <name>AnotherComponent"</name>
  19. </component>
  20.  
  21. <!-- Below listed reference names and port types use polic CRM_ServiceFaults
  22. -->
  23. <reference faultPolicy="CRM_ServiceFaults">
  24. <name>creditRatingService</name>
  25. <name>anotherReference</name>
  26. <portType
  27. xmlns:credit="http://services.otn.com">credit:CreditRatingService</portType>
  28. <portType
  29. xmlns:db="http://xmlns.oracle.com/pcbpel/adapter/db/insert/">db:insert_
  30. plt</portType>
  31. </reference>
  32.  
  33. <reference faultPolicy="test1">
  34. <name>CreditRating3</name>
  35. </reference>
  36. </faultPolicyBindings>
  37.  

References

* Using the Fault Management Framework

This entry was posted in soa11g. Bookmark the permalink.

2 Responses to SOA 11g: BPEL Fault Policy

  1. anand reddy says:

    can u provide mediator (soa11g) example with exception handling.

  2. suman says:

    the above explanation would have reached in better way if you have put a screenshot of composites

Leave a Reply

Your email address will not be published.


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>