Contact Us 1-800-596-4880

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:

  • A global CRC32 element

  • A 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 the Studio Visual Editor

  1. Create and configure the global element through the Global Element tab at the bottom of the canvas, or directly within the CRC32 processor’s Properties pane by clicking the (plus) icon to the right of the Connector Ref field.

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

    GlobalCRC32Calculation5
    Attribute Req’d Value

    Name

    x

    A unique name for your global element.

    Target Expression

    x

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

Creating a Global Element with the Studio XML Editor or Standalone

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

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

    <crc32:config name="Global_CRC32_Calculation" targetExpression="#[variable:crc32]/>
    Attribute Req’d 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 the 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+1
    Attribute Req’d Value

    Display Name

    x

    A unique name for your message processor.

    Connector Configuration

    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 the Studio 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 Req’d 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:

  • a CRC32 message processor

  • a 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, Generating a Checksum.

Configuring a CRC32 Message Processor with the 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 Req’d Value

    Display Name

    x

    A unique name for your message processor.

    Connector Configuration

    x

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

    1. Click the (plus) icon next to the Connector Configuration field.

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

    Operation

    x

    CRC32 Filter

    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 the 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"/>
    Attribute Req’d 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.