Frage

I am doing something with fix protocol using quickfix library.

I wrote class like this:

public class ApplicationImpl implements Application {
...
    @Override
public void toApp(Message arg0, SessionID arg1) throws DoNotSend {
    //this is invoked before sending message
}
...
}

I wonder how to invoke some method after sending message?

War es hilfreich?

Lösung

QuickFIX does not offer a after-message-send callback.

Andere Tipps

You need to have this somewhere in your code to send a message (not in the overriden methods):

Session.sendToTarget(outgoingMessage, orderSession);

That will execute some internal quickfixJ code and then call toApp(). The toApp() method allows you do modify the message before it is sent to the broker. But ideally in order to do something after you send you just need to add code after the call to Session.sendToTarget().

If you are adventurous, you can modify QuickFIX/J to do it. The MINA network layer does provide a messageSent callback. If you override that method in QFJ's InitiatorIoHandler (or AcceptorIoHandler) you could either directly process the messageSent event or propagate it to a modified Application interface.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top