Java – quickfixj login problem
There are problems with quickfixj The problem is that I can't send the login message correctly In addition, it's hard for me to understand how to set up message flow I don't want to execute transactions, I just retrieve market data
Error:
20140123-22:55:56: No responder,not sending message:
Here are 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
My criteria are: Ĵ
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
The source of my question is: mainly:
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); }
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!
Solution
Take a look at example ordermatch app
It is a recipient, not an initiator, but it is not important
You will notice that it does not manually create a login message and send it The engine will be in initiator This operation is performed automatically on start (or acceptor. Start) (refer to your log: "no responders, no messages" – this is your manual login line trying to send before the engine completes the correct login)
Basically, in the socket initiator Get all codes between start(); And the end of the block and delete it Just put in some sleep action (such as waiting for console input or something else)
You may have other problems, but that's what I see now