Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: Engine
-
Labels:None
Description
Desc:
i have a quickfix config (for initiator), which doesn't have sender comp id. from my application i get the sender comp id at runtime, which i then set it session settings object. i then create SocketInitiator, and start the initiator. in the onCreate() method, i get sessionID without the sender comp id. am i trying which is not possible? please let me know if i am doing something wrong.
Code:
public boolean initialize(String senderCompID){
SessionSettings settings = null;
try {
settings = new SessionSettings(settingsFileName);
} catch (ConfigError e) {
System.err.println("Could not find FIX setting file.");
e.printStackTrace();
System.exit(-1);
}
String fixVersion = null;
String sndrCompId = senderCompID;
settings.setString(SessionSettings.SENDERCOMPID, senderCompID); // sender compid added in the default session. also tried adding the same in NONE default session in the below lines of code.
String tgtCompId = null;
SessionID sessID;
Iterator<SessionID> ite = settings.sectionIterator();
while(ite.hasNext()) {
sessID = ite.next();
try {
fixVersion = settings.getString(sessID, SessionSettings.BEGINSTRING);
tgtCompId = settings.getString(sessID, SessionSettings.TARGETCOMPID);
//settings.setString(sessID, SessionSettings.SENDERCOMPID, senderCompID); // tried adding in one of the sessions.
}catch (Exception e) {
System.err.println("Could not get [BEGINSTRING] or [TARGETCOMPID] " +
"from session id [" + sessID.toString() + "]-[" + e.toString() + "]");
}
}
String fileStorePath;
String fileLogPath;
try {
fileStorePath = settings.getString("FileStorePath");
} catch (Exception e) {
fileStorePath = null;
System.err.println("Could not get [FileStorePath] [" + e.toString() + "]");
}
try {
fileLogPath = settings.getString("FileLogPath");
if(fileStorePath == null) {
fileStorePath = fileLogPath;
System.out.println("[FileStorePath] set to [FileLogPath] - [" + fileStorePath + "]");
}
} catch (Exception e) {
fileLogPath = null;
System.err.println("Could not get [FileLogPath] [" + e.toString() + "]");
}
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new MessageFactory();
try {
initiator = new SocketInitiator(this, storeFactory, settings, logFactory, messageFactory);
} catch (ConfigError e) {
System.err.println("FIXClient Could not initiate socket!");
e.printStackTrace();
System.exit(-1);
}
String fixedString = fixVersion + "_" + sndrCompId + "_" + tgtCompId; // if i check my settings object i have sender comp id correctly inserted
// further code
initiator.start();
}
i have a quickfix config (for initiator), which doesn't have sender comp id. from my application i get the sender comp id at runtime, which i then set it session settings object. i then create SocketInitiator, and start the initiator. in the onCreate() method, i get sessionID without the sender comp id. am i trying which is not possible? please let me know if i am doing something wrong.
Code:
public boolean initialize(String senderCompID){
SessionSettings settings = null;
try {
settings = new SessionSettings(settingsFileName);
} catch (ConfigError e) {
System.err.println("Could not find FIX setting file.");
e.printStackTrace();
System.exit(-1);
}
String fixVersion = null;
String sndrCompId = senderCompID;
settings.setString(SessionSettings.SENDERCOMPID, senderCompID); // sender compid added in the default session. also tried adding the same in NONE default session in the below lines of code.
String tgtCompId = null;
SessionID sessID;
Iterator<SessionID> ite = settings.sectionIterator();
while(ite.hasNext()) {
sessID = ite.next();
try {
fixVersion = settings.getString(sessID, SessionSettings.BEGINSTRING);
tgtCompId = settings.getString(sessID, SessionSettings.TARGETCOMPID);
//settings.setString(sessID, SessionSettings.SENDERCOMPID, senderCompID); // tried adding in one of the sessions.
}catch (Exception e) {
System.err.println("Could not get [BEGINSTRING] or [TARGETCOMPID] " +
"from session id [" + sessID.toString() + "]-[" + e.toString() + "]");
}
}
String fileStorePath;
String fileLogPath;
try {
fileStorePath = settings.getString("FileStorePath");
} catch (Exception e) {
fileStorePath = null;
System.err.println("Could not get [FileStorePath] [" + e.toString() + "]");
}
try {
fileLogPath = settings.getString("FileLogPath");
if(fileStorePath == null) {
fileStorePath = fileLogPath;
System.out.println("[FileStorePath] set to [FileLogPath] - [" + fileStorePath + "]");
}
} catch (Exception e) {
fileLogPath = null;
System.err.println("Could not get [FileLogPath] [" + e.toString() + "]");
}
MessageStoreFactory storeFactory = new FileStoreFactory(settings);
LogFactory logFactory = new FileLogFactory(settings);
MessageFactory messageFactory = new MessageFactory();
try {
initiator = new SocketInitiator(this, storeFactory, settings, logFactory, messageFactory);
} catch (ConfigError e) {
System.err.println("FIXClient Could not initiate socket!");
e.printStackTrace();
System.exit(-1);
}
String fixedString = fixVersion + "_" + sndrCompId + "_" + tgtCompId; // if i check my settings object i have sender comp id correctly inserted
// further code
initiator.start();
}
Activity
- All
- Comments
- History
- Activity
- Subversion Commits
- Builds