Thursday, December 26, 2019

12c SOA - Oracle Mediator part5 - Error Handling

Use Case : When there is any mediator error, Using fault policy and fault binding, publish the error details into a JMS Queue.

Read Previous blog 12c-soa-oracle-mediator-part4-error-handling for more details.

Create a Distributed Queue and connection factory.
















 Add  JMS Alert action

 Add a Header value.
 Create required Properties
 Provide Destination and CF details.
 Press ok.

 Select the created JMS Alert.
 Deploy and test. The mediator failed and stored into the Queue.


Error message:
<commonfault xmlns="http://schemas.oracle.com/soa/fault">
<faultID>1560021</faultID>
<flowID>1730097</flowID>
<compositeDN>POC/MediatorFaultPolicyProject!1.0</compositeDN>
<componentName>MediatorFaultpolicyCheck</componentName>
<errorCode> 3302</errorCode>
<engineType> mediator</engineType>
<faultName> {http://schemas.oracle.com/mediator/faults}mediatorFault</faultName>
<faultType> SYSTEM</faultType>
<message>ORAMED-03302:[Exception in oneway execution]Unexpected exception in one-way operation &quot;execute&quot; on reference &quot;MediatorResequencerProject&quot;.Possible Fix:Check whether the reference service is properly configured and running or look at exception for analyzing the reason or contact Oracle Support Services. Cause: oracle.j2ee.ws.client.jaxws.JRFSOAPFaultException: Client received SOAP Fault from server : The composite &quot;POC/MediatorResequencerProject!1.0*soa_0ad97452-27c1-4e45-afa0-6993a0abc094&quot; is retired. New instances cannot be initiated.</message>
</commonfault>

Fault policy:
<?xml version="1.0" encoding="UTF-8"?>
<faultPolicies 
    xmlns="http://schemas.oracle.com/bpel/faultpolicy"
    xmlns:bpelx="http://schemas.oracle.com/bpel/extension"
    xmlns:bpel1="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:bpel2="http://docs.oasis-open.org/wsbpel/2.0/process/executable"
    xmlns:medns="http://schemas.oracle.com/mediator/faults"
    xmlns:rjm="http://schemas.oracle.com/sca/rejectedmessages">

    <faultPolicy id="policySet">
        <Conditions>
            <faultName name="medns:mediatorFault" xmlns:medns="http://schemas.oracle.com/mediator/faults"
                       description="All Mediator faults">
                <condition>
                    <test>contains($fault.mediatorErrorCode, "TYPE_ALL")</test>
                    <action ref="default-termination"/>
                    <alert ref="jmsProperties"/>
                </condition>
                <condition>
                    <action ref="default-termination"/>
                </condition>
            </faultName>
        </Conditions>
        <Alerts>
            <Alert id="jmsProperties">
                <JMS propertySet="jmsPropertySet">
                    <Headers>
                        <property name="MSG_ID">1</property>
                    </Headers>
                </JMS>
            </Alert>
        </Alerts>
        <Actions>
            <Action id="default-termination">
                <abort/>
            </Action>
            <Action id="default-human">
                <humanIntervention/>
            </Action>
            <Action id="default-java">
                <javaAction className="oracle.integration.platform.faultpolicy.IFaultRecoveryJavaClass" defaultAction="default-termination"/>
            </Action>
            <Action id="default-replay">
                <replayScope/>
            </Action>
            <Action id="default-rethrow">
                <rethrowFault/>
            </Action>
            <Action id="default-ws">
                <invokeWS  uri="WebServiceURI"/><!-- format - <Absolute wsdl path>|service name|port name -->
            </Action>
            <Action id="default-enqueue">
                <enqueue uri="QueueURI"/> <!-- QueueURI format  - jdbc:oracle:thin:@<host>:<port>:<sid>#<un>/<pw>#queue -->
            </Action>
            <Action id="default-file">
                <fileAction>
                    <location>FOLDER_LOCATION</location>
                    <fileName>FILE_NAME</fileName><!-- FILE_NAME will support %ID%(rejected message instance id) or %TIMESTAMP% wildcards -->
                </fileAction>
            </Action>
            <Action id="default-retry">
                <retry>
                    <retryCount>3</retryCount>
                    <retryInterval>2</retryInterval>
                </retry>
            </Action>
        </Actions>
        <Properties>
            <propertySet name="jmsPropertySet">
                <property name="jmsDestination">jms/SOAErrorQueue</property>
                <property name="connectionFactory">jms/SOAErrorQueueConnectionFactory</property>
            </propertySet>
        </Properties>
    </faultPolicy>
</faultPolicies>


No comments:

Post a Comment

Featured Post

OIC - Source File Validation Using Stage File and Throw New Fault in OIC

Working... Source File Validation Using Stage File and Throw New Fault in OIC Use Case In Oracle Integration Cloud (OIC), validating the s...