c# - Quickfix/n, most efficient way to extract message Type? -
what efficient way in quickfix/n 1.4 extract message type defined here: http://www.fixprotocol.org/fiximate3.0/en/fix.5.0sp2/messages_sorted_by_type.html
i use var msgtype = message.getmsgtype(message.tostring());
results in "a" logon message. there better way? try determine message type within toadmin(...)
in order catch outgoing logon request message can add username , password.
i love through messagecracker far have not found way implement catch-all-remaining message types in case have not implemented onmessage overloads. (please see related question: quickfix, there "catch-all" method onmessage handle incoming messages not handled overloaded methods?).
thanks
not title question, key part of it:
i try determine message type within toadmin(...) in order catch outgoing logon request message can add username , password.
here's blob of code pretty nails (taken post qf/n mailing list):
public void toadmin(message message, sessionid sessionid) { // check message type if (message.header.getfield(tags.msgtype) == msgtype.logon) { // yes logon message // check if local variables yourusername , yourpassword set if (!string.isnullorempty(yourusername) && !string.isnullorempty(yourpassword)) { // add username , password fields logon message ((logon) message).set(new username(yourusername)); ((logon) message).set(new password(yourpassword)); } } }
Comments
Post a Comment