Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

Mule CRC32 Processor

Mule can apply a cyclic redundancy check (CRC) to messages to ensure integrity. The CRC32 processor acts as an enricher to generate a checksum to a message when it enters a system, then act as a filter to verify the checksum when the message leaves the system. If the entry and exit values do not match, CRC terminates the message’s processing.

The CRC32 processor allows the user to verify that a message remains intact between a sender and a receiver. Because it does not itself provide encryption or append a signature to the message, you can use it in conjunction with other security features.

Generating a Checksum

To use the CRC32 processor to generate a checksum on a message, you must, at minimum, configure two elements in your Mule application:

  • Global CRC32 element

  • CRC32 processor

Completing these steps ensures that Mule calculates a checksum based on your payload and enriches the properties of your Mule message with that checksum.

Creating a Global Element with Studio Visual Editor

  1. Create a configure the global element through the Global Element tab at the bottom of the canvas, or directly within the CRC32 building block’s Properties pane by clicking add icon right of the Connector Ref field.

  2. Configure the global element’s attributes according to table below.

    GlobalCRC32Calculation5

    Attribute Required Value

    Name

    X

    A unique name for your global element.

    TargetExpression

    X

    A mule expression, accept the default variable #[variable:crc32].

Creating a Global Element with Studio XML Editor or Standalone

  1. Create a crc32:config element set above all the flows in your applications.

  2. Config the global element’s attributes according to the table below.

    <crc32:config name="Global_CRC32_Calculation" targetExpression="#[variable:crc32]/>
    Attribute Required Value

    name

    X

    A unique name for your global element.

    targetExpression

    X

    A Mule expression, accept the default variable name #[variable:crc32].

Configuring a CRC32 Message Processor with Studio Visual Editor

  1. Insert a CRC32 processor in your Mule flow.

  2. Configure the message processor’s attributes according to the table below.

    crc32

    Attribute Required Value

    Display Name

    X

    A unique name for your message processor.

    Config Reference

    X

    Use the global element you created above.

    Operation

    X

    Calculate

    Input Reference

    By default, Mule calculates based on the entire payload. Use the Input Reference field to specify a different target for the calculation, if necessary.

Configuring a CRC32 Message Processor with XML Editor or Standalone

  1. Insert a crc32:calculate processor in your Mule flow.

  2. Configure the element’s attributes according to the table below.

    <crc32:calculate config-ref="Global_CRC32_Calculation" doc:name="CRC Calculation"/>
    Attribute Required Value

    config-ref

    X

    Use the global element you created above.

    doc:name

    X

    A display name for the element in Studio’s Visual Editor. Not applicable for Standalone.

    input-ref

    By default, Mule calculates based on the entire payload. Use input-ref to specify a different target for the calculation, if necessary.

Verifying a Checksum

To use the CRC32 processor to verify a checksum on a message, you must, at minimum, configure two elements in your Mule application:

  • CRC32 message processor

  • CRC32 global element

Completing these steps ensure that Mule verifies the checksum in the properties of your message by comparing it against the checksum you calculated in the CRC32 calculation, [above].

Configuring a CRC32 Message Processor with Studio Visual Editor

  1. Insert a CRC32 processor into your Mule flow, positioned at the point where you would like to verify the checksum.

  2. Configure the message processor’s attributes according to the table below.

    crc32_2

    Attribute Required Value

    Display Name

    X

    A unique name for your message processor.

    Config Reference

    X

    Create a "blank" global element satisfies Anypoint Studio’s configuration requirements and needs no further configuration.

    1. Click the add icon next to the Config Reference field.

    2. Delete the default text in the Target Expression field, leaving this field blank, then click Ok.

    Operation

    X

    CRC32

    Expected Checksum

    X

    Enter the Expected Checksum, matching the contents of the Target Expression field in the CRC32 global element in your configuration of the CRC32 calculation.

    Input Reference

    By default, Mule calculates based on the entire payload. Use the Input Reference field to specify a different target for the calculation, if necessary.

Configuring a CRC32 Message Processor with Studio XML Editor or Standalone

  1. Not required in Standalone: Create a "blank" crc32:config global element, as per the code below, to satisfy Anypoint Studio’s configuration requirements.

    <crc32:config name="CRC32" doc:name="CRC32"/>
  2. Insert a crc32:filter processor into your Mule flow, positioned at the point where you would like to verify the checksum.

  3. Configure the message processor’s attributes according to the table below.

    <crc32:filter config-ref="CRC32" expectedChecksum="#[flowVars['crc32']]" doc:name="CRC32 Filter"/>
    Attirbute Required Value

    config=ref

    X

    Use the global element you created above.

    doc:name

    X

    A display name for the element in Studio’s Visual Editor. Not applicable for Standalone.

    expectedChecksum

    X

    Enter the Expected Checksum, matching the contents of the Target Expression field in the CRC32 global element in your configuration of the CRC32 calculation.

    input-ref

    By default, Mule calculates based on the entire payload. Use the Input Reference field to specify a different target for the calculation, if necessary.