Does AMPS validate messages?

AMPS is designed for the highest possible performance. This means that AMPS does not parse (or validate) messages unless AMPS will use the results of parsing the message.

AMPS parses the message if any operation on the message requires parsing or content filtering (including SOW storage with AMPS-generated keys, filters on subscriptions, a delta publish, a delta subscription, a view that uses fields in the message, and so on). If the parsing process fails, AMPS will report an error.

Even when AMPS needs to parse a message, AMPS will avoid unnecessary work. Where possible, AMPS will partially parse the message. For example, consider an NVFIX message like the one below (formatted for clarity, with a ; semicolon replacing the standard field delimiter):

   id=1;type=order;customerId=42;

   quote=Millions and millions of stars;

   sample=More sample data here;

If AMPS needs the /id field to generate the key for the SOW topic, the /customerId for a subscription filter, and the /customerId and /type for a view, AMPS will stop parsing the message after finding the /customerId. AMPS has no use for any additional fields, so there's no reason for AMPS to do additional parsing work.

Notice that, for the JSON message type, AMPS provides an EarlyTerminiationOptimization configuration item. This option defaults to true. When set to false, AMPS will parse JSON messages fully, even when all of the information that AMPS needs from the message is found before the message is completely parsed.

Keywords: message types, validation, parsing, parse error, SOW storage

Last updated