Tuesday, May 04, 2010

Rejection Handler

BEfore understanding Rejection handler we need to understand the concept of inbound and outbound scenario.

An inbound scenario is one where in data is coming in to the bpel and an outbound scenario is one where in data is going out from bpel.

when we are using adapter for receiving some data from outside we can get some translation error in converting the data from native format to xml format ,in that scenario a Message Rejection Handler can be configured to handle the translation errors and to take corrective action.

Message Rejection Handlers can be Files, BPEL, WSIF binding or Oracle AQ.
The MessageRejectionHandler has to be specified in the bpel.xml for the PartnerLink activity.

So if you have following entry in your BPEL.xml

<?xml version = '1.0' encoding = 'UTF-8'?>
<BPELSuitcase>
<BPELProcess id="FileAdapter" src="FileAdapter.bpel">
<partnerLinkBindings>
<partnerLinkBinding name="GetFile">
<property name="wsdlLocation">GetFile.wsdl</property>
</partnerLinkBinding>
</partnerLinkBindings>
<activationAgents>
<activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="GetFile">
<property name="portType">Read_ptt</property>
</activationAgent>
</activationAgents>
</BPELProcess>
</BPELSuitcase>


YOu need to change it to following as per the adapter agent you are using.

Message rejection handler comes in four types.

1>File system based rejection handler

The bpel.xml that i have specified here is for fileadapter so i will make following changes in my bpel.xml

<property name="rejectedMessageHandlers">
file://C:/rejectedMessages
</property>

So my new BPEL.XML file will look something like this.

<?xml version = '1.0' encoding = 'UTF-8'?>
<BPELSuitcase>
<BPELProcess id="FileAdapter" src="FileAdapter.bpel">
<partnerLinkBindings>
<partnerLinkBinding name="GetFile">
<property name="wsdlLocation">GetFile.wsdl</property>
</partnerLinkBinding>
</partnerLinkBindings>
<activationAgents>
<activationAgent className="oracle.tip.adapter.fw.agent.jca.JCAActivationAgent" partnerLink="GetFile">
<property name="portType">Read_ptt</property>
<property name="rejectedMessageHandlers">file://C:/rejectedMessages</property>
</activationAgent>
</activationAgents>
</BPELProcess>
</BPELSuitcase>


Now once you have made the changes in your process just redeploy the process.

Now all the invalid messages will be written to the directory mentioned earlier.
C:/rejectedMessages

The format of file name will be
INVALID_MSG_ +name of process+name of operation+current-time


So far we have discussed about only one type of rejection handler.We have three other types as well

2>Oracle Advanced Queue based Rejection Handler

In this case the property added will be
<property name="rejectedMessageHandlers">
queue://jdbc:oracle:thin:@<db-host>:<tns-port>:<sid>|<user>/<password>|<queue-name>
</property>

so an example will be

<property name="rejectedMessageHandlers">
queue://jdbc:oracle:thin:@localhost:1521:ORCL|scott/tiger|INVALID_MESSAGES
</property>

Here INVALID_MESSAGES is the queue that i have created and where in i wanted to store my invalid queue messages.

3>BPEL process Rejection handler and
4>WSIF BAsed rejection handler.

I have not worked on them once i will be doing a lab on that i will be updating the same in the post.

No comments: