Thank you Support. There are some in the JForex community who avoid using onMessage for order management, and this is an important consideration in making design decisions, so please bear with me as I ask for confirmation:
Suppose, for example, I have an
order, and I want to reliably
doSomething() when
order is filled.
Are the following solutions equally reliable? (Note that my question is about the general concept (of how the message framework is implemented) rather than the actual code provided below.)
// Solution 1
public void onMessage(IMessage message) throws JFException {
if(message.getType() == IMessage.Type.ORDER_FILL_OK){
if(message.getOrder().getID().equals(order.getID())){
doSomething();
}
}
}
// Solution 2
private IOrder.State lastState;
public void onTick(Instrument instrument, ITick tick){
if(lastState != IOrder.State.FILLED && order.getState() == IOrder.State.FILLED){
doSomething();
}
lastState = order.getState();
}
Please don't hesitate to say if my question is unclear. Thanks in advance.