Hi, quickfix/j experts:
I am writing a test client to a Fix Server. I have the problem to
reconnect and re-logon after socket exception, which can be reproduced
by disable local network connection and enable afterwards. I tried to
create a new SocketInitiator, but I could not re-logon after the new
session is established. Could you please help me?
=20
The code I writing is as follow:
=20
Application fixapp =3Dnew
MarketDataClient(dataReceiver,sbsymbols,userName,passWord);
=20
SessionID clientSessionID =3D new =
SessionID(FixVersions.BEGINSTRING_FIX43,
senderCompID, targetCompID);=20
SessionSettings settings =3D new SessionSettings();
HashMap<String,String> defaults =3D new HashMap<String,String>();
defaults.put("ConnectionType", "initiator");
defaults.put("SocketConnectHost", hostname);
defaults.put("SocketConnectPort", String.valueOf(port));
defaults.put("StartTime", "00:00:00");
defaults.put("EndTime", "00:00:00");
defaults.put("HeartBtInt", "30");
defaults.put("FileStorePath", "output/data/client");
defaults.put("ValidateUserDefinedFields", "N");
defaults.put("RefreshMessageStoreAtLogon","Y");
defaults.put("ResetOnLogout","N");
defaults.put("ResetOnDisconnect","N");
defaults.put("FileLogPath", fileLogPath);
settings.set(defaults);
settings.setString(clientSessionID, "BeginString",
FixVersions.BEGINSTRING_FIX43);
settings.setString(clientSessionID, "DataDictionary", dadaDictionaryPath
+ "/FIX43.xml");
settings.setString(clientSessionID,"ReconnectInterval","1");
MessageStoreFactory storeFactory =3D new FileStoreFactory(settings);
LogFactory logFactory =3D new FileLogFactory(settings);
MessageFactory messageFactory =3D new DefaultMessageFactory();
ThreadedInitiator initiator =3D new SocketInitiator(fixapp, =
storeFactory,
settings, logFactory, messageFactory);
initiator.start();
=20
Regards,=20
=20
Simon=20
_____ =20
From: Oren Miller [mailto:or...@qu...]=20
Sent: Wednesday, October 11, 2006 2:52 PM
To: Ding, Simon
Subject: Re: Reconnect after socket exception
Ah, I didn't realize you were using QuickFIX/J. You should really post
this to the quickfix/j mailing list. Information on posting to the list
can be found here:
https://lists.sourceforge.net/lists/listinfo/quickfixj-users=20
You will find more people most knowledgeable about QuickFIX/J on this
list.=20
--oren
On Oct 11, 2006, at 1:43 PM, Ding, Simon wrote:
Hi, Oren:
Greatly appreciate your response.
As you advised. I wrote the following code, and specify
"ReconnectInterval" to 1 and other values. It still did not re-connect
after I disable network connection and enable work connection. From the
log file, I saw "ERROR quickfix.mina.initiator.InitiatorIoHandler -
socket exception". I am using qickfix/j 1.0.3.
=20
Please help me.
=20
Thanks a lot,
=20
Simon
=20
LavaFxMarketDataClient fixapp =3Dnew
LavaFxMarketDataClient(dataReceiver,sbsymbols,userName,passWord);
=09
=09
=09
=09
SessionID clientSessionID =3D new
SessionID(FixVersions.BEGINSTRING_FIX43, senderCompID, targetCompID);=20
SessionSettings settings =3D new SessionSettings();
HashMap<String,String> defaults =3D new HashMap<String,String>();
defaults.put("ConnectionType", "initiator");
defaults.put("SocketConnectHost", hostname);
defaults.put("SocketConnectPort", String.valueOf(port));
defaults.put("StartTime", "00:00:00");
defaults.put("EndTime", "00:00:00");
defaults.put("HeartBtInt", "30");
defaults.put("FileStorePath", "output/data/client");
defaults.put("ValidateUserDefinedFields", "N");
defaults.put("RefreshMessageStoreAtLogon","Y");
defaults.put("ResetOnLogout","N");
defaults.put("ResetOnDisconnect","N");
defaults.put("FileLogPath", fileLogPath);
settings.set(defaults);
settings.setString(clientSessionID, "BeginString",
FixVersions.BEGINSTRING_FIX43);
settings.setString(clientSessionID, "DataDictionary",
dadaDictionaryPath + "/FIX43.xml");
settings.setString(clientSessionID,"ReconnectInterval","1");
=09
=09
=09
=09
MessageStoreFactory storeFactory =3D new
FileStoreFactory(settings);
LogFactory logFactory =3D new FileLogFactory(settings);
MessageFactory messageFactory =3D new DefaultMessageFactory();
ThreadedInitiator initiator =3D new SocketInitiator(fixapp,
storeFactory, settings, logFactory, messageFactory);
initiator.start();
=20
_____ =20
From: Oren Miller [mailto:or...@qu...]=20
Sent: Wednesday, October 11, 2006 2:29 PM
To: Ding, Simon
Cc: as...@qu...
Subject: Re: Reconnect after socket exception
=09
=09
QuickFIX should handle reconnects for you. The amount
of time between reconnects is based on the ReconnectInterval, which I
believe defaults to 30 seconds. You can set this as low as 1 second.
Have you tried taking no action and just waiting for QF to reconnect at
the interval?=20
--oren
On Oct 11, 2006, at 1:21 PM, Ding, Simon wrote:
Hey, quickfix experts:=20
I am writing a test client to a Fix Server. I
have the problem to reconnect and re-logon after socket exception, which
can be reproduced by disable local network connection. I tried to create
a new SocketInitiator, but could be re-logon after the new session is
established. Could you please help me?
Regards,=20
Simon=20
|