Closed derMaaster closed 7 months ago
Definitely losing data integrity from before OnNewMessage() writes to a Channel and when a new thread reads from the Channel
Hi @derMaaster, one thing that is definitely should be done if there is a need to process the received message later is cloning the message. The engine re-uses the same chunk of memory for every FixMessage that is passed to the OnNewMessage handler. To clone the message you can do something like this:
var messageCopy = (FixMessage)message.Clone();
Hi @viktartse , apologies for getting back to you only now. That does in fact work. And thank you very much.
A note or just FYI - the .Clone function seems to be a relatively expensive operation in terms of memory, and somewhat in terms of memory and also latency to some degree. In the world of high frequency trading. (To my limited knowledge and expertise on those matters.)
I agree a call to .Clone is not very cheap but an alternative would be the engine constructing a new FixMessage object for every new message from scratch instead of reusing the same object. That would also have a cost.
Hi,
I am sure this is not actually an issues with the fix-antenna-net-core library, so feel free to close this issue if my posting here is inappropriate.
I get a false return on
fixMessage.IsTagExists(268)
even though all the message cleary has Tag268 included in the messages according to the log file.My code example here
(This happens on 35=X incoming messages, where 268 is a required field according to the providers dictionary)