In my project we had used EDN event delivery network in
SOA 11g for error handling.
We created an Error event and with a error message
structure .
Eg: HelloPlatformErrorEvent, so I will be listing down
the entries that you will need to implement error handling across the processes
.The code is reusable and will take care skeletal common error handling.
The good thing with using EDN in errorhandling is we
can have multiple consumers consuming the event and do different processing. Since
EDN is fully supported in SOA 11g , the overheads of publish and subscribe
/configurations will not be bothering us. We need to create an event and
consumers can receive events .So if we can have multiple consumer bpel’s each
doing different functionality ,one can write a file,one process writing to DB,
once sending notifications. So we have plugged out the error handling/logging
mechanism out of the processes. Consumers can be enables/disabled separately based
on requirement.
Steps for reusing the event driven error event codes
Here for example the
event : HelloPlatformErrorEvent,
edl file : HelloPlatformErrorEvent
Message structure :HelloPlatformErrorEvent.xsd
Since it’s used across composites, the file will
uploaded/accessed from MDS.
Composite.xml
· Add to imports
<import
namespace="http://schemas.oracle.com/events/edl/HelloPlatformErrorEvent"
location="oramds:/apps/HelloPlatform/Events/edl/HelloPlatformErrorEvent.edl"
importType="edl"/>
· Add to component (bpel)
<business-events>
<publishes
xmlns:pub1="http://schemas.oracle.com/events/edl/HelloPlatformErrorEvent"
name="pub1:HelloPlatformErrorEventMessage"/>
</business-events>
. bpel file
· Add to namespaces
xmlns:bperrmsg="http://xmlns.oracle.com/HelloPlatform/ErrorMessage/V1"
xmlns:errorEvent="http://schemas.oracle.com/events/edl/HelloPlatformErrorEvent"
· Add to imports
<import
namespace="http://xmlns.oracle.com/HelloPlatform/ErrorMessage/V1"
location="oramds:/apps/HelloPlatform/Events/schema/HelloPlatformErrorEvent.xsd"
importType="http://www.w3.org/2001/XMLSchema"/>
· Add to Variables
<variable
name="PublishHelloPlatformErrorEvent"
element="bperrmsg:HelloPlatformErrorEventMessage"/>
· Add inside catchall
The assign values will vary based on your message structure
<sequence
name="ErrorSequence">
<assign
name="assignErrorEvent">
<copy>
<from>ora:getFaultName()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:ErrorDetails/bperrmsg:ErrorCode</to>
</copy>
<copy>
<from>ora:getConversationId()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:InstanceDetails/bperrmsg:ConversationId</to>
</copy>
<copy>
<from>ora:getInstanceId()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:InstanceDetails/bperrmsg:InstanceId</to>
</copy>
<copy>
<from>ora:getCompositeName()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:InstanceDetails/bperrmsg:CompositeName</to>
</copy>
<copy>
<from>ora:getProcessId()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:InstanceDetails/bperrmsg:ProcessName</to>
</copy>
<copy>
<from>ora:getFaultAsString()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:ErrorDetails/bperrmsg:ErrorText</to>
</copy>
<copy>
<from>'Error occured in TaskExecutionFetchPendingTasksProcess'</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:ErrorDetails/bperrmsg:ErrorMessage</to>
</copy>
<copy>
<from>true()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:ErrorHandlerOptions/bperrmsg:PersistMsgOnDB</to>
</copy>
<copy>
<from>true()</from>
<to>$PublishHelloPlatformErrorEvent/bperrmsg:ErrorHandlerOptions/bperrmsg:SendNotification</to>
</copy>
</assign>
<invoke
name="invokePublishHelloPlatformErrorEvent"
bpelx:eventName="errorEvent:HelloPlatformErrorEventMessage"
inputVariable="PublishHelloPlatformErrorEvent"
bpelx:invokeAsDetail="no"/>
<exit
name="ProcessExit"/>
</sequence>
That’s
it for today. Thanks to Ram,Ravi for the coming up this model.
No comments:
Post a Comment