Basically, implementing IEsbMessageInterceptor interface, which looks something like this (You probably have to tweak it little bit as IEsbMessageInterceptor has been changed from 10.1.3.4 to 10.1.3.5).
public class CustomESBInterceptor implements IEsbMessageInterceptor {
public CustomESBInterceptor() {
System.out.println("Initializing Custome Interceptor");
}
public void invoke(FlowId pFlowId, String pInstanceId, Element pPayload, Element pHeader, String pServiceName, String pSystemName, boolean isOutbound) {
System.out.println("----------------------------------------");
System.out.println("Custom Interceptor ");
System.out.println("FlowId: " + pFlowId + " subflowid: " + pFlowId.getSubFlowId() );
System.out.println("instanceid: " + pInstanceId);
System.out.println("Header: " + XMLHelper.toXML(pHeader));
System.out.println("payload: " + XMLHelper.toXML(pPayload));
System.out.println("Service: " + pServiceName);
System.out.println("System: " + pSystemName);
System.out.println("----------------------------------------");
}
}
Once we compile this class, we can put the class in bpel/system/classes directory and add following to $ORALCE_HOME/integration/esb/config/esb_config.ini file:
inboundMessageInterceptor = CustomESBInterceptor
outboundMessageInterceptor = CustomESBInterceptor
Just to clarify, just like any other interceptor this is extreamly dangerous point. We should keep following things in mind:
- Call from ESB runtime to this interceptor is made in synchronous fashion, so if CustomESBInterceptor.invoke errors out, then entire ESB RT will have issues.
- Another issue is if we are doing any heavy processing in CustomESBInterceptor.invoke, that will affect performance of entire ESB RT. The code in invoke should be absolutely error free and as quick as possible. We should use AQ or another JMS implementation to avoid real time processing if needed.
- You can possibly change the payload and header values if you want to (it should be avoided for best practices)
1 comment:
This is vinod, from past couple of days to implement the interceptor concept in esb but about the concept i never heard and tried in google but not able to find the correct exaample
Can you help me on this issue.
Thanks in Advance
Post a Comment