Having issues w/QuickFixJ. The issue is that I can't correctly send a logon message. Additionally, I'm having a hard-time understanding how to setup the flow of messages. I'm not trying to execute trades, just retrieve market data.
The error:
20140123-22:55:56: No responder, not sending message:
Here's all my details:
Incoming: cat incoming/*
8=FIXT.1.19=11035=A34=149=REDACTED-MD52=20140123-22:55:56.37256=NDXMD98=0108=30141=Y553=REDACTED100554=REDACTED1137=910=231?220140123-22:55:56.470
Outgoing:
20140123-22:55:50: Session FIXT.1.1:REDACTED-MD->NDXMD schedule is weekly, SUN 00:00:00-UTC - FRI 00:00:00-UTC
20140123-22:55:50: Created session: FIXT.1.1:REDACTED-MD->NDXMD
20140123-22:55:53: Initiated logon request
20140123-22:55:56: No responder, not sending message: 8=FIXT.1.19=11035=A34=149=REDACTED-MD52=20140123-22:55:56.37256=NDXMD98=0108=30141=Y553=REDACTED100554=REDACTED1137=910=231
8=FIXT.1.19=8135=A34=149=REDACTED-MD52=20140123-22:55:52.64356=NDXMD98=0108=30141=Y1137=910=114
8=FIXT.1.19=8335=549=NDXMD56=REDACTED-MD52=20140123-22:55:53.75134=158=Missing field. Type 55310=054
8=FIXT.1.19=11035=A34=149=REDACTED-MD52=20140123-22:55:56.37256=NDXMD98=0108=30141=Y553=REDACTED100554=REDACTED1137=910=231
And my stdout is: J
an 23, 2014 10:55:37 PM REDACTED.REDACTEDMain main
INFO: REDACTED startup
Jan 23, 2014 10:55:49 PM quickfix.SessionSchedule <init>
INFO: [FIXT.1.1:REDACTEDB-MD->NDXMD] weekly, SUN 00:00:00-UTC - FRI 00:00:00-UTC
Successfully called onCreate for sessionId : FIXT.1.1:REDACTEDB-MD->NDXMD
Jan 23, 2014 10:55:50 PM quickfix.mina.NetworkingOptions logOption
INFO: Socket option: SocketTcpNoDelay=true
Jan 23, 2014 10:55:50 PM quickfix.mina.NetworkingOptions logOption
INFO: Socket option: SocketSynchronousWrites=false
Jan 23, 2014 10:55:50 PM quickfix.mina.NetworkingOptions logOption
INFO: Socket option: SocketSynchronousWriteTimeout=30000
Jan 23, 2014 10:55:51 PM quickfix.mina.initiator.IoSessionInitiator <init>
INFO: [FIXT.1.1:REDACTEDB-MD->NDXMD] [web-fix.REDACTED.com/194.107.REDACTED:7170]
Jan 23, 2014 10:55:51 PM quickfix.mina.SessionConnector startSessionTimer
INFO: SessionTimer started
Sleeping for start() ....
Jan 23, 2014 10:55:51 PM quickfix.mina.initiator.InitiatorIoHandler sessionCreated
INFO: MINA session created for FIXT.1.1:REDACTEDB-MD->NDXMD: local=/10.215.87.15:34197, class org.apache.mina.transport.socket.nio.SocketSessionImpl, remote=web-fix.REDACTED.com/194.107.REDACTED:7170
Inside toAdmin
Message: 8=FIXT.1.19=8135=A34=149=REDACTEDB-MD52=20140123-22:55:52.64356=NDXMD98=0108=30141=Y1137=910=114
XML: <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<message>
<header>
<field tag="8"><![CDATA[FIXT.1.1]]></field>
<field tag="9"><![CDATA[81]]></field>
<field tag="34"><![CDATA[1]]></field>
<field tag="35"><![CDATA[A]]></field>
<field tag="49"><![CDATA[REDACTEDB-MD]]></field>
<field tag="52"><![CDATA[20140123-22:55:52.643]]></field>
<field tag="56"><![CDATA[NDXMD]]></field>
</header>
<body>
<field tag="98"><![CDATA[0]]></field>
<field tag="108"><![CDATA[30]]></field>
<field tag="141"><![CDATA[Y]]></field>
<field tag="1137"><![CDATA[9]]></field>
</body>
<trailer>
<field tag="10"><![CDATA[114]]></field>
</trailer>
</message>
Header: quickfix.fixt11.Message$Header@10f268de
Trailer: quickfix.Message$Trailer@1ac2cf83
Jan 23, 2014 10:55:53 PM quickfix.mina.AbstractIoHandler messageReceived
SEVERE: Invalid message: Can't determine ApplVerID for message
Jan 23, 2014 10:55:53 PM quickfix.Session disconnect
INFO: [FIXT.1.1:REDACTEDB-MD->NDXMD] Disconnecting: IO Session closed
Successfully logged out for sessionId : FIXT.1.1:REDACTEDB-MD->NDXMD
Inside toAdmin
Message: 8=FIXT.1.19=11035=A34=249=REDACTEDB-MD52=20140123-22:55:56.37256=NDXMD98=0108=30141=Y553=REDACTED100554=REDACTED1137=910=232
XML: <?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
<message>
<header>
<field tag="8"><![CDATA[FIXT.1.1]]></field>
<field tag="9"><![CDATA[110]]></field>
<field tag="34"><![CDATA[2]]></field>
<field tag="35"><![CDATA[A]]></field>
<field tag="49"><![CDATA[REDACTEDB-MD]]></field>
<field tag="52"><![CDATA[20140123-22:55:56.372]]></field>
<field tag="56"><![CDATA[NDXMD]]></field>
</header>
<body>
<field tag="98"><![CDATA[0]]></field>
<field tag="108"><![CDATA[30]]></field>
<field tag="141"><![CDATA[Y]]></field>
<field tag="553"><![CDATA[REDACTED100]]></field>
<field tag="554"><![CDATA[REDACTED]]></field>
<field tag="1137"><![CDATA[9]]></field>
</body>
<trailer>
<field tag="10"><![CDATA[232]]></field>
</trailer>
</message>
Header: quickfix.fixt11.Message$Header@49f8d077
Trailer: quickfix.Message$Trailer@6e3e5a91
Logon Message Sent : false
And my source in question is: MAIN:
try {
Application app = new AFIX();
SessionSettings settings = new SessionSettings("sessionSettings.txt");
FileStoreFactory fileStoreFactory = new FileStoreFactory(settings);
FileLogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new DefaultMessageFactory();
SocketInitiator socketInitiator = new SocketInitiator(app,
fileStoreFactory, settings, logFactory, messageFactory);
socketInitiator.start();
try {
System.out.println("Sleeping for start() ....");
Thread.sleep(5000);
} catch (InterruptedException e) {
e.printStackTrace();
}
SessionID sessionId = socketInitiator.getSessions().get(0);
AFIX.sendLogonRequest(sessionId);
int i = 0;
do {
try {
Thread.sleep(1000);
System.out.println(socketInitiator.isLoggedOn());
} catch (InterruptedException e) {
e.printStackTrace();
}
i++;
} while ((!socketInitiator.isLoggedOn()) && (i < 25));
} catch (ConfigError e) {
... ... ...
public static void sendLogonRequest(SessionID sessionId)
throws SessionNotFound {
quickfix.fixt11.Logon logon = new quickfix.fixt11.Logon();
quickfix.Message.Header header = logon.getHeader();
header.setField(new quickfix.field.BeginString("FIXT.1.1"));
header.setField(new quickfix.field.MsgType("A"));
Properties p = loadProperties();
logon.set(new quickfix.field.Username(p.getProperty("username")));
logon.set(new quickfix.field.Password(p.getProperty("password")));
logon.set(new quickfix.field.HeartBtInt(30));
logon.set(new quickfix.field.ResetSeqNumFlag(true));
logon.set(new quickfix.field.DefaultApplVerID("9"));
logon.set(new quickfix.field.EncryptMethod(0));
boolean sent = Session.sendToTarget(logon, sessionId);
System.out.println("Logon Message Sent : " + sent);
}
And finally my settings:
cat sessionSettings.txt
[DEFAULT]# Settings which apply to all the Sessions.
ConnectionType=initiator
LogonTimeout=30
ReconnectInterval=30
UseDataDictionary=Y
ResetOnLogon=Y
FileStorePath=incoming
FileLogPath=outgoing
[SESSION]# Settings specifically for one session
BeginString=FIXT.1.1
DefaultApplVerID=9
AppDataDictionary=FIX50.xml
SenderCompID=REDACTED-MD
TargetCompID=NDXMD
StartDay=sunday
EndDay=friday
StartTime=00:00:00
EndTime=00:00:00
HeartBtInt=30
CheckLatency=N
MaxLatency=240
SocketConnectPort=7170
SocketConnectHost=web-fix.REDACTED.com
UseDataDictionary=Y
DataDictionary=lib/quickfixj-all-1.5.3.jar!/FIX50SP2.xml
Any help is greatly appreciated!
Look at the example OrderMatch app.
(It's an acceptor, not an initiator, but it doesn't really matter.)
You'll notice that it doesn't manually create a Logon message and send it. The engine does that automatically upon initiator.start
(or acceptor.start
). (See in your log: "No responder, not sending message" -- that's your manual logon line trying to send before the engine has done its proper logon).
Basically, take all that code between socketInitiator.start();
and the end of the block and delete the heck out of it. Just put in some kind of sleep action (like a wait-for-console-input or something) instead.
You may still have other issues, but that's the one I'm seeing now.