Friday, August 11, 2017

Handling FIX session level reject messages in WSO2 ESB

FIX transport implementation  in WSO2 ESB, and  different usages of FIX with integration is discussed in detail in [1]. As much as processing FIX messages it is also important that the integration layer handles any serious FIX errors as well.

FIX  Reject <3> messages are issued when a message is received but cannot be properly processed due to a session-level rule violation. Different reasons for causing session-level rule violations are discussed in [2]. With WSO2 ESB 5.0 we have enhanced FIX implementation for you to acknowledge these session level reject messages and process error handling accordingly. 

You can implement SessionEventHandler (org.apache.synapse.transport.fix.SessionEventHandler)  and direct back specific FIX messages (REJECT<3> messages in this case) back to your proxy. In this case we are updating fromAdmin method to send session level reject messages back to the application, which is the proxy.

public class InitiatorSessionEventHandler implements SessionEventHandler {

public void fromAdmin(FIXIncomingMessageHandler fixIncomingMessageHandler, Message message, SessionID sessionID) {
        //Sending fix 35=3 admin message back to the client.
       try {

           if (message.getHeader().getField(new StringField(35)).getValue().equals("3")) {

               fixIncomingMessageHandler.fromApp(message, sessionID);


Now you just need to add above handler jar to ESB/repository/components/lib and  access these reject messages from your proxy, and do proper error handling.

<filter regex="3" source="//message/header/field[@id='35']">
//error handling 

<parameter name="transport.fix.InitiatorSessionEventHandler">com.wso2.test.InitiatorSessionEventHandler</parameter>

This is just a simple sample on how you can extend SessionEventHandler! You could extend this for any of your session level FIX requirements. And guess what? This is 100% open source! Check out [3] on how WSO2  ESB is 100% open source and how you can benefit from it.


No comments:

Post a Comment