Fault handling framework is used to handle faults using fault policy and fault binding files. In earlier version of SOA suite which was 11g, we have to create these files manually. There was no provision to create these files from any wizard. Manual process is always error prone and it is quite difficult to remember all fault names and actions which we need to use in fault policy file. Oracle came up with fault policy wizard in SOA 12c, we can use that fault policy wizard to create fault policy file to handle faults in composite. This makes it less error prone and more productive. In this post, we will see how to create fault policy file from fault policy wizard and how to link it to fault binding file.
For this post, we have created a sample composite which invokes one target service. When we shutdown the target service then remote fault gets generated in sample composite which invokes target service. We will handle that remote fault in fault policy file and using alert send that message to JMS queue.
To create fault policy file, right click on the project and click on New àFrom Gallery. Choose Faults option under SOA Tier and select Fault Policy Document to create new fault policy file.
You can change the fault policy name from default “policy1” to any name as per your naming standards. You can choose the Fault Name which you need to handle in this fault policy, you can handle multiple faults in one policy, to add additional fault name you can click on Green plus sign. You can also change the default action from drop down list. We renamed the policy file and choose remoteFault as a fault name as we are going to handle this fault using fault policy file.
Now we will choose the alert which gets triggered when that fault occur. This is the additional feature provided in fault policy file. There are three types of alerts (email, JMS and Log) provided. We will create JMS alert for this post so choose JMS from the list. Provide the alert name and click on “Create Required Properties” tab to create required property set for JMS alert. Provide the property set name and specify required properties for JMS queue, once done click on Ok.
Now we link above created alert to default action so whenever remote fault occur, process get terminated as a default action and message gets populated to JMS queue as JMS alert.
With the above step you are done with fault policy creation from fault policy wizard, now we will create fault binding file and link this fault policy file to composite, components, services and references.
Click on highlighted icon and bind the fault policy file to required components, services and references.
Now deploy your composite and test it. Make sure target service is down so that remote fault gets generated. That remote fault will be handled by fault policy file, it terminate the instance and send the message to JMS queue.