I assume you mean that you want to define custom Username/Password settings in your config file. (QF does not have these built-in.)
This link will show you how to use custom settings.
http://www.quickfixj.org/confluence/display/qfj/Using+Custom+Settings
(Ignore the bit in the prose about getSessionSettings()
; this method does not appear to actually exist in the current build.)
In case that page goes down, in a nutshell the process is this:
Somehow give your MessageCracker app a reference to your SessionSettings
object (whether by constructor or get/set or however).
In your toAdmin()
, do something like this:
final String msgType = msg.getHeader().getString(MsgType.FIELD);
if(MsgType.LOGON.compareTo(msgType) == 0)
{
msg.setString(quickfix.fields.Username.FIELD,
mySettings.getString(sessionID, "Username");
msg.setString(quickfix.fields.Password.FIELD,
mySettings.getString(sessionID, "Password");
}
(I haven't compiled this code; please let me know if I have a syntax error and I'll fix it.)
I literally just added the C# equivalent to the QF/n User FAQ yesterday. You must be on the QF/n mail list, or else just have really great timing.
(I should probably add this to the QF/j User FAQ as well.)