Its time to handle errors occured in Oracle ESB.
I would like to describe Error Hospital using a simple
usecase...
-->execute-->(RS)--async-->callWebService-->(WS)
RS - Routing Service
WS - Web Service
Suppose while invoking callWebService some error occured,
as we are calling web service asynchronously it can be retried.
To automate the process of retring the web service, we need to implement
Error Hospital, which is nothing but a BPEL process.
Why BPEL process not ESB ?
1>Suppose some error occured in ESB Error Hospital process, than the error hospital can recursively invoked again and again, which can make our server unstable.
2>In BPEL, we have the option of Human Task, as in such kind of errors we need human intervention, which is not possible in ESB.
Solution :
1> Create an empty BPEL process.
2> Create an JMS Adapter as follows :
a> Service Name : ReadESBError
b> JMS provider : Oracle Enterprise Messaging Service(OEMS) Memory/File
c> Connection : <your application server>
d> Operation Type : Consume Message
e> Consume Operation Parameters :
Destination Name :jms/topic/ESB_ERROR
Message Body Type : TextMessage
Message Selector : This is an important parameter which will filter your errors.
This criteria can be given as operation name (in our case : "execute")
and system guid which can be fetched from oraesb schema using following query
"SELECT GUID FROM WF_SYSTEMS WHERE NAME = 'LALIT';"
This will filter errors of your importance.
Hence value will be :
ESB_SYSTEM_GUID = '<system guid>' AND ESB_EVENT_KEY = 'execute'
f> Schema will be the same as used while executing RS.
g> Finish
3> Create Recieve operation for incoming JMS Adapter.
Add Header Variable in Adapters tab of recieve activity.
Header variable will be of message type : InboundHeader_msg which is defined in jmsAdapterInboundHeader.
4> Create one more JMS Adapter
a> Service Name : RetryESBError
b> Operation Type : Produce Message
c> Produce Operation Parameter
Destination name : jms/topic/ESB_ERROR_RETRY
everything else default
d> same schema as above.
e> Finish
5> Create invoke Activity for RetryESBError.
Attach header variable in adapters tab.
Header variable will be of message type : OutboundHeader_msg which is defined in jmsAdapterOutboundHeader.
6> Add activity Human Task and attach input variable to be reviewed by human. Assign Reply from human task to outputVariable.
7> Header Transformation
This is an important part of Error Hospital.
Use transformation from inputHeader to outputHeader.
Use automap feature to transform. Assign all input properties to output properties as it is.
8> Now we require to modify some of the output header properties.
a> ESB_RECEIPIENT_LIST : ',LALIT,'
If you dont know the esb system name that can be found using property
ESB_SYSTEM_GUID value.
Use query on oraesb schema
"SELECT NAME FROM WF_SYSTEMS WHERE GUID = <ESB_SYSTEM_GUID>"
Databse adapter can be used.
b> ESB_EVENT_KEY
Extract flowid from inboundHeader property ESB_FLOW_ID
Then the value will be 'Resubmitted-<flowid>'
9> Error Hospital completed.
Try to invoke RS using some invalid values, you can see a new bpel error hospital instance. Update values using workflow console and resubmit it.
How error hospital is different from "rejectedMessageHandlers" property in BPEL
ReplyDelete