Message Classes
3 min
a message class evaluates incoming message payloads using a rules engine to determine which parser processes the data each message class contains a spring expression that is evaluated against the message payload when the expression matches, the message is routed to the parser associated with that message class access message classes in cloud management > message classes note for more information on message classes, see create message classes https //docs cloud google com/manufacturing data engine/docs/concepts/source message class in the mde documentation how message classes work when a message arrives, the rules engine evaluates each message class expression in order of priority the first message class whose expression matches the payload determines which parser handles the message lower priority numbers are evaluated first because multiple parsers can connect to a single message class, one matched expression can trigger several parsing operations on the same message this is useful when a message contains different data types, such as numeric values and non numeric alerts, that need to be processed separately create a message class go to cloud management > message classes click add new message class in the properties section, enter a message class name to enable the message class immediately, select enabled in the message class expression section, enter a spring expression that evaluates the message payload the expression should return a true value when the message matches in the priority field, enter a numeric priority message classes are evaluated in ascending order, so lower numbers are evaluated first click save test a message class expression before saving, you can test the expression against a sample message to verify it behaves as expected use the test feature to refine your expression before applying it to live data in the test message section, enter a sample json message payload click run test the validation results section shows whether the expression matched the sample message and confirms whether the evaluation was successful if the test result shows doc matched , the expression evaluates to true for the sample payload and the message class will route matching messages to its associated parser