{"id":1740,"date":"2010-08-10T10:36:15","date_gmt":"2010-08-10T15:36:15","guid":{"rendered":"http:\/\/jianmingli.com\/wp\/?p=1740"},"modified":"2012-02-08T12:13:42","modified_gmt":"2012-02-08T17:13:42","slug":"oracle-bpel-fault-policies","status":"publish","type":"post","link":"https:\/\/jianmingli.com\/wp\/?p=1740","title":{"rendered":"Oracle BPEL Fault Policies"},"content":{"rendered":"<p>* See <a href=\"?p=3492\">this post<\/a> for SOA <em>11g<\/em> fault policy framework.<\/p>\n<span id=\"Fault_Policy_Overview\"><h2>Fault Policy Overview<\/h2><\/span>\n<p>* Since 10.1.3.3<br \/>\n* Catches <strong>all<\/strong> faults from an invoke activity (both run time and business faults)<br \/>\n* <strong>Important:<\/strong> overrides <strong>all catch<\/strong> activities in BPEL process.<br \/>\n* A fault policy defines conditions and their corresponding fault recovery actions.<br \/>\n* Fault policies are defined in multiple files under directory:<br \/>\n&#8211; bpel\\domains\\default\\config\\fault-policies<br \/>\n*  XSD files are:<br \/>\n&#8211; bpel\\system\\xmllib\\fault-policy.xsd<br \/>\n&#8211; bpel\\system\\xmllib\\fault-policy-binding.xsd<br \/>\n* A fault policy can be associated at the following levels:<br \/>\n&#8211; Partner link<br \/>\n&#8211; Port type<br \/>\n&#8211; Process level via bpel.xml<br \/>\n&#8211; Domain level via fault-bindings.xml<br \/>\n* Fault policy binding order:<br \/>\n-> bpel.xml: partner link -> port type -> process<br \/>\n-> domain:  partner link -> port type -> process<br \/>\n-> Catch blocks defined in bpel diagram.<\/p>\n<span id=\"SOA_Fault_Types\"><h2>SOA Fault Types<\/h2><\/span>\n<span id=\"Business_Faults\"><h3>Business Faults<\/h3><\/span>\n<p>* Programmer defined.<br \/>\n* Defined in WSDL.<\/p>\n<span id=\"Runtime_Faults\"><h3>Runtime Faults<\/h3><\/span>\n<p>* Predefined, e.g.<br \/>\n&#8211; remoteFault<br \/>\n&#8211; bindingFault<br \/>\n* Infrastructure faults, e.g.<br \/>\n&#8211; Service down<br \/>\n&#8211; Network outage<br \/>\n* Data format errors<\/p>\n<span id=\"Design_a_Fault_Policy\"><h2>Design a Fault Policy<\/h2><\/span>\n<span id=\"Create_a_Fault_Policy_File\"><h3>Create a Fault Policy File<\/h3><\/span>\n<p>* Create policy file (e.g. my-policies.xml) in bpel\\domains\\domain_name\\config\\fault-policies directory<\/p>\n<p><a id=\"DefineConditions\"><\/a><\/p>\n<span id=\"Define_conditions\"><h4>Define conditions<\/h4><\/span>\n<p>* Conditions are based on faultName. e.g.<\/p>\n<pre lang=\"xml\">\r\n<faultName \r\n  xmlns:bpelx=\"http:\/\/schemas.oracle.com\/bpel\/extension\"\r\n  name=\"bpelx:remoteFault\">\r\n<\/pre>\n<p>* Multiple conditions are allowed for a single faultName<br \/>\n&#8211; if so, conditions are evaluated sequentially<\/p>\n<pre lang=\"xml\">\r\n  <condition>\r\n    <test>$fault.code\/code=\"WSDLReadingError\"<\/test>\r\n    <action ref=\"ora-terminate\"\/>\r\n  <\/condition>\r\n  <condition>\r\n    <action ref=\"ora-java\"\/>\r\n  <\/condition>\r\n<\/pre>\n<p>* Each condition has<br \/>\n&#8211; one test section which is an XPath expression against fault variable<\/p>\n<pre lang=\"xml\">\r\n    <test>$fault.code\/code=\"WSDLReadingError\"<\/test>\r\n<\/pre>\n<p>&#8211; one action section which references to the action defined in the same file<\/p>\n<pre lang=\"xml\">\r\n    <action ref=\"ora-terminate\"\/>\r\n<\/pre>\n<p>&#8211; No test condition catches all<\/p>\n<pre lang=\"xml\">\r\n<condition>\r\n  <action ref=\"ora-rethrow\"\/>\r\n<\/condition>\r\n<\/pre>\n<p>&#8211; No faultName catches all faults <\/p>\n<pre lang=\"xml\">\r\n<faultName > . . . <\/faultName>\r\n<\/pre>\n<p><a id=\"DefineActions\"><\/a><\/p>\n<span id=\"Define_actions\"><h4>Define actions<\/h4><\/span>\n<p>* See examples below.<\/p>\n<span id=\"Fault_Policy_Examples\"><h3>Fault Policy Examples<\/h3><\/span>\n<p>* Conditions<\/p>\n<pre lang=\"xml\">\r\n<Conditions>\r\n  <!-- when bpelx:remoteFault, retry -->\r\n  <faultName \r\n    xmlns:bpelx=\"http:\/\/schemas.oracle.com\/bpel\/extension\" \r\n    name=\"bpelx:remoteFault\">\r\n    <condition>\r\n      <action ref=\"ora-retry\"\/>\r\n    <\/condition>\r\n  <\/faultName>\r\n  \r\n  <!-- when bpelx:bindingFault, rethrow fault -->\r\n  <faultName \r\n    xmlns:bpelx=\"http:\/\/schemas.oracle.com\/bpel\/extension\" \r\n    name=\"bpelx:bindingFault\">\r\n    <condition>\r\n      <action ref=\"ora-rethrow-fault\"\/>\r\n    <\/condition>\r\n  <\/faultName>\r\n<\/Conditions>\r\n<\/pre>\n<p>* Actions<\/p>\n<pre lang=\"xml\">\r\n<!-- retry Action -->\r\n<Action id=\"ora-retry\">\r\n  <retry>\r\n    <retryCount>8<\/retryCount>\r\n    <retryInterval>2<\/retryInterval>\r\n    <retryFailureAction ref=\"ora-terminate\"\/>\r\n    <exponentialBackoff\/>\r\n  <\/retry>\r\n<\/Action>\r\n\r\n<!-- replayScope Action -->\r\n<Action id=\"ora-replay-scope\">\r\n  <replayScope\/>\r\n<\/Action>\r\n\r\n<!-- rethrowFault Action -->\r\n<Action id=\"ora-rethrow-fault\">\r\n  <rethrowFault\/>\r\n<\/Action>\r\n\r\n<!-- humanIntervention Action -->\r\n<Action id=\"ora-human-intervention\">\r\n  <humanIntervention\/>\r\n<\/Action>\r\n\r\n<!-- abort Action -->\r\n<Action id=\"ora-terminate\">\r\n  <abort\/>\r\n<\/Action>\r\n\r\n<!-- Custom Java Action -->\r\n<Action id=\"ora-java\">\r\n  <javaAction className=\"mypackage.myClass\"\r\n    defaultAction=\"ora-terminate\"\r\n    propertySet=\"propSet1\">\r\n    <returnValue value=\"R_TRM\"\r\n      ref=\"ora-terminate\"\/>\r\n    <returnValue value=\"R_THRW\"\r\n      ref=\"ora-rethrow-fault\"\/>\r\n  <\/javaAction>\r\n<\/Action><\/pre>\n<p>&#8211; Java class must implement IFaultRecoveryJavaClass interface<\/p>\n<pre lang=\"xml\">\r\npublic interface IFaultRecoveryJavaClass {\r\n  public void handleRetrySuccess(IFaultRecoveryContext ctx );\r\n  public String handleBPELFault(IFaultRecoveryContext ctx );\r\n}<\/pre>\n<span id=\"Associate_a_Fault_Policy\"><h2>Associate a Fault Policy<\/h2><\/span>\n<p>* Process level<br \/>\n&#8211; Configured in bpel.xml file.<br \/>\n&#8211; Only one fault policy can be bound to a process, port type, or partner link.<br \/>\n&#8211; Multiple port types or partner links can be bound to a single fault policy.<\/p>\n<pre lang=\"xml\">\r\n<faultPolicyBindings>\r\n  <!-- Fault on any plink\/port type not specified -->\r\n  <!-- below uses policy BillingFaults -->\r\n  <process faultPolicy=\"BillingFaults\"\/>\r\n\r\n  <partnerLink xmlns:credit=\"http:\/\/services.otn.com\" faultPolicy=\"CRM_\r\n    ServiceFaults\">\r\n      <!-- Fault on these 2 plink will use policy CRM_ServiceFaults -->\r\n      <name>UnitedLoanService<\/name>\r\n      <name>StarLoanService<\/name>\r\n\r\n    <!----Fault on these 2 port types uses policy CRM_ServiceFaults -->\r\n    <portType>credit:CreditRatingService<\/portType>\r\n    <portType xmlns:united=\"http:\/\/services.uninted.com\/loan\">\r\n    united:UnitedLoanService<\/portType>\r\n  <\/partnerLink>\r\n\r\n  <partnerLink faultPolicy=\"myOtherFaults\">\r\n    <!-- Fault on this plink uses policy myOtherFaults -->\r\n    <name>AnotherPartnerLink<\/name>\r\n  <\/partnerLink>\r\n<\/faultPolicyBindings>\r\n<\/pre>\n<p>* Domain level<br \/>\n&#8211; Configured in OracleAS_2\\bpel\\domains\\default\\config\\fault-bindings.xml file.<\/p>\n<pre lang=\"xml\">\r\n  <!-- all processes in this domain use DefaultPolicy -->\r\n  <process faultPolicy=\"DefaultPolicy\"\/>\r\n<\/pre>\n<pre lang=\"xml\">\r\n  <partnerLink faultPolicy=\"DefaultPolicy\">\r\n    <!-- all invoke faults at partner link creditRatingService use DefaultPolicy -->\r\n    <name>creditRatingService<\/name>\r\n  <\/partnerLink>\r\n<\/pre>\n<pre lang=\"xml\">\r\n  <partnerLink faultPolicy=\"DefaultPolicy\">\r\n    <!-- all invoke faults at specific port type use DefaultPolicy -->\r\n    <portType \r\n      xmlns:db=\"http:\/\/xmlns.oracle.com\/pcbpel\/adapter\/db\/insert\/\">db:insert_plt<\/portType>\r\n  <\/partnerLink>\r\n<\/pre>\n<span id=\"Human_Intervention_in_Oracle_BPEL_Control\"><h2>Human Intervention in Oracle BPEL Control<\/h2><\/span>\n<p>* Login BPEL console<br \/>\n* Click Activities tab<br \/>\n* Seach activities based on states<br \/>\n&#8211; All States: Displays all activities, regardless of their state.<br \/>\n&#8211; Open: Displays only open activities.<br \/>\n&#8211; Completed: Displays only completed activities.<br \/>\n&#8211; Cancelled: Displays only cancelled activities.<br \/>\n&#8211; Stale: Displays only stale activities.<br \/>\n&#8211; Pending: Displays only pending activities.<br \/>\n* Click the faulted activity<br \/>\n* Optionally change the variable values<br \/>\n* Select action to take<br \/>\n&#8211; Retry: Retries the activity with an option to provide a retry success action.<br \/>\n&#8211; Abort: Terminates the process instance of the faulted activity.<br \/>\n&#8211; Rethrow: Rethrows the exception and allows the BPEL fault handlers (catch branches) to handle the fault.<br \/>\n&#8211; Replay: Replays the scope in which the fault occurred.<br \/>\n&#8211; Continue: Skips the activity. The framework assumes the activity completed with no fault.<br \/>\n* Click the Recover button.<\/p>\n<span id=\"References\"><h2>References<\/h2><\/span>\n<p>* <del datetime=\"2011-09-27T17:52:00+00:00\"><a href=\"http:\/\/www.oracle.com\/technology\/products\/ias\/bpel\/pdf\/10133technotes.pdf\">Fault Management Framework<\/a><\/del><br \/>\n* <del datetime=\"2011-09-27T17:52:00+00:00\"><a href=\"http:\/\/www.oracle.com\/technology\/tech\/soa\/cab\/OracleSOACabWebinar03-25-08SOAExceptions.pdf\">http:\/\/www.oracle.com\/technology\/tech\/soa\/cab\/OracleSOACabWebinar03-25-08SOAExceptions.pdf<\/a><\/del><br \/>\n* <del datetime=\"2011-09-27T17:52:00+00:00\"><a href=\"http:\/\/www.it-eye.nl\/weblog\/2007\/09\/10\/oracle-bpel-10133-fault-policy-management\/\">Oracle BPEL 10.1.3.3 Fault Policy Management<\/a><\/del><\/p>\n","protected":false},"excerpt":{"rendered":"<p>* See this post for SOA 11g fault policy framework. Fault Policy Overview * Since 10.1.3.3 * Catches all faults from an invoke activity (both run time and business faults) * Important: overrides all catch activities in BPEL process. * &hellip; <a href=\"https:\/\/jianmingli.com\/wp\/?p=1740\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[72,69],"tags":[],"class_list":["post-1740","post","type-post","status-publish","format-standard","hentry","category-bpel","category-oc4j"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p8cRUO-s4","_links":{"self":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1740","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1740"}],"version-history":[{"count":10,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1740\/revisions"}],"predecessor-version":[{"id":4249,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=\/wp\/v2\/posts\/1740\/revisions\/4249"}],"wp:attachment":[{"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1740"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1740"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jianmingli.com\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1740"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}