Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The following piece of code shows how to validate messages:

...

Code Block
languagecpp
void validateLiteMsg( Engine::MsgPipeElem* poolElem )
{
	try
 	{
 		int size;
  		const char* ptr = elem->msg.toRaw(&size);
  		std::auto_ptr<Engine::FIXMessage> nonLiteMsg( Engine::FIXMsgProcessor::singleton()->parse(ptr, size, NULL, false, false ) ); //parse() can throw
  		// validate the message values
 		nonLiteMsg->checkFields();
 		//validate the message structure
 		Parser::Options opts; // set the opts as required
 		opts.verifyTagsValues = false; //already done 
 		nonLiteMsg->checkRequired(opts);
	}
	catch (Parser::ParserException const& e)
 	{
  		sendReject(elem->msg, e.refSeqNum(), e.refTagID(), e.refMsgType(), e.getRejReason(), e.what() );
	}
 	catch (std::exception const &e)
	{
  		logError(e.what());
 	}
}

FIX Antenna HFT Parser exceptions

...