Details
-
Type: Other
-
Status: Closed
-
Priority: Major
-
Resolution: Incomplete
-
Affects Version/s: 1.3.0
-
Fix Version/s: None
-
Component/s: Engine
-
Labels:None
-
Environment:Windows XP Professional with JRE 1.6.0.03 running Eclipse 3.3.1.1 and QuickFix/J 1.3.0
Description
I`m new to Java but I hope my stupidness regarding this environment is not the case of this issue I`m having.
I`m trying to have a QuickFix/J application running. I`m using the same method used in C# with QuickFix.NET: I`m creating the SessionSettings and its configuration Dictionary manually from code. Anyway, the thing is that when I try to assign the Dictionary object to SessionSettings Eclipse tells me I have a ConfigError. I tried different schematics, I even tried with sample config files, still ConfigError. Here is my code:
import quickfix.ConfigError;
import quickfix.Message;
import quickfix.SessionID;
public class QFApplication extends quickfix.MessageCracker implements quickfix.Application {
public QFApplication() {
quickfix.SessionSettings settings = new quickfix.SessionSettings();
quickfix.Dictionary dictionary = new quickfix.Dictionary("session");
dictionary.setLong(quickfix.Session.SETTING_HEARTBTINT, 600);
dictionary.setLong(quickfix.Initiator.SETTING_RECONNECT_INTERVAL, 1);
dictionary.setString(quickfix.FileStoreFactory.SETTING_FILE_STORE_PATH, "c:/qfstore");
dictionary.setString(quickfix.FileLogFactory.SETTING_FILE_LOG_PATH, "c:/qfstore/log");
dictionary.setString(quickfix.Session.SETTING_START_TIME, "00:00:00");
dictionary.setString(quickfix.Session.SETTING_END_TIME, "00:00:00");
dictionary.setBool(quickfix.Session.SETTING_USE_DATA_DICTIONARY, true);
dictionary.setString(quickfix.Session.SETTING_DATA_DICTIONARY, "c:/qfstore/dictionaries/FIX42.xml");
dictionary.setString("BeginString", quickfix.FixVersions.BEGINSTRING_FIX42);
dictionary.setString(quickfix.SessionSettings.SENDERCOMPID, "sender");
dictionary.setString(quickfix.SessionSettings.TARGETCOMPID, "receiver");
dictionary.setString(quickfix.SessionFactory.SETTING_CONNECTION_TYPE, quickfix.SessionFactory.INITIATOR_CONNECTION_TYPE);
dictionary.setBool(quickfix.Session.SETTING_RESET_ON_LOGON, false);
dictionary.setBool(quickfix.Session.SETTING_RESET_ON_LOGOUT, true);
dictionary.setBool(quickfix.Session.SETTING_RESET_ON_DISCONNECT, true);
dictionary.setString(quickfix.Initiator.SETTING_SOCKET_CONNECT_HOST, "127.0.0.1");
dictionary.setLong(quickfix.Initiator.SETTING_SOCKET_CONNECT_PORT, 1025);
dictionary.setBool(quickfix.Session.SETTING_PERSIST_MESSAGES, true);
/*
so I`m setting up the dictionary all ready to be added to session, I need to create a new session with the BeginString identical with the one from Dictionary otherwise QuickFix will not let me add the dictionary to the sessionid and that "settings.set(session, dictionary);" throws exception in the IDE, I can`t get to the source of it though and when the try / catch is there it will not enter the catch part like it did not crash
*/
quickfix.SessionID session = new quickfix.SessionID(
new quickfix.field.BeginString("FIX.4.2"),
new quickfix.field.SenderCompID("sender"),
new quickfix.field.TargetCompID("receiver")
);
try
catch (ConfigError e)
{ e.printStackTrace(System.out); } quickfix.FileLogFactory logger = new quickfix.FileLogFactory(settings);
quickfix.FileStoreFactory storer = new quickfix.FileStoreFactory(settings);
quickfix.MessageFactory messages = new quickfix.DefaultMessageFactory();
try
catch (ConfigError e)
{ // TODO Auto-generated catch block e.printStackTrace(System.out); }}
public void onCreate(SessionID sessionID) {}
public void onLogon(SessionID sessionID) {}
public void onLogout(SessionID sessionID) {}
public void toAdmin(Message message, SessionID sessionID) {}
public void fromAdmin(Message message, SessionID sessionID)
throws quickfix.FieldNotFound, quickfix.IncorrectDataFormat, quickfix.IncorrectTagValue, quickfix.RejectLogon {}
public void toApp(Message message, SessionID sessionID)
throws quickfix.DoNotSend {}
public void fromApp(Message message, SessionID sessionID)
throws quickfix.FieldNotFound, quickfix.IncorrectDataFormat, quickfix.IncorrectTagValue, quickfix.UnsupportedMessageType
}
all the best and I hope I did not upset any Java gurus out there with my stupid newbie code,
thank you, my respects to you all,
Ionel Roman