Parsers
6 min
a parser transforms incoming message data into the format required by a target data store parsers take the raw payload from a message class and process it so that it can be accepted by the cloud databases configured in the assigned type access parsers in cloud management > parsers note for more information on parsers, see parser https //docs cloud google com/manufacturing data engine/docs/concepts/parser in the mde documentation how parsers work a parser is connected to a message class and an output type when a message class expression matches an incoming message, each parser associated with that message class runs its transformation logic against the payload and produces output in the format defined by the assigned type multiple parsers can be connected to the same message class this lets you split a single incoming message into separate outputs for example, a message from a robot or conveyor that contains thousands of data points can be split so that numeric values are processed separately from non numeric data such as alerts and warnings the transformation logic in each parser is written in whistle, a data mapping language designed for transforming structured message payloads parsers list the parsers list shows all defined parsers and the message class and type each one is connected to column description name name of the parser message class name message class the parser is connected to type output type the parser produces type ver version of the assigned type pack configuration pack the parser belongs to disabled whether the parser is disabled actions options to edit or delete the parser to filter the list by message class, use the message class dropdown to include disabled parsers, select show disabled create a parser go to cloud management > parsers click add new parser in the properties section, enter a parser name to enable the parser immediately, select enabled in the parser section, select the message class to connect this parser to select the output type that defines the structure and destination of the transformed data in the code editor, enter the whistle transformation code that maps the incoming message payload to the fields defined by the selected type click save test a parser you can test a parser against a sample input message to verify that the whistle code produces the expected output before the parser processes live data in the parsers list, click the edit icon for the parser you want to test in the edit panel, click run test the test parser panel opens in the input field on the left, enter a sample json message payload click run test the panel displays the transformed output on the right to view a detailed breakdown of the transformation result, click show validation result use the test to confirm that field mappings, data extractions, and any conditional logic in the whistle code work correctly against representative input before applying the parser to live messages whistle transformation code the code editor in the parser section accepts whistle, a data mapping language used to extract and transform values from the incoming message payload a parser typically maps fields such as tag name, timestamp, data values, and metadata from the raw message into the structure expected by the output type the assigned type determines which fields are available in the output and where the transformed data is sent