MQTT Header and Payload Mapping Prior to Version 3.15.0

Prior to version 3.15.0, the Connector for MQTT used a different configuration syntax to map header and payload values. In addition, certain headers were automatically mapped from the source to the target. This functionality is now deprecated and will be removed in a future release.

If you have existing workflow configurations that rely on the previous transform sections (under transform-headers and transform-payload) or are using a version prior to 3.15.0, do not use the new configuration syntax. The previous and current configuration sections cannot be used together.

For version 3.15.0 or later of this connector, see Mapping Message Headers and Payloads for the instructions to set up your header and payload mappings.

Migrating Your Configuration

To update your header and payload mappings to use the new configuration, you must migrate:

Migrating the Configuration Structure

To update the structure of the configuration, replace solace.connector.workflows.<n>.transform-headers with solace.connector.workflows.<n>.transform. Within each transform section:

  • Add enabled: true to enable transforms.

  • Move transform-headers.expressions to the transform.expressions list property.

Migrating the Expression Syntax

To update the header transformation expressions, make the following changes:

  • Replace all direct header references, headers.<headerName>, with source['headers']['<headerName>'] for reading.

  • Use target['headers']['<headerName>'] = <expression> for writing

  • Replace Java methods in expressions with the corresponding built-in functions. For example:

    • replace T(String).join() with #joinString()

    • replace 'someString'.split() with #splitString()

    • replace 'someString'.toUpperCase() with #upperCaseString()

    • replace 'someString'.toLowerCase() with #lowerCaseString()

Example Migration

This example shows the difference between the old and new syntax.

Old configuration:

solace:
  connector:
    workflows:
      0:
        transform-headers:
          expressions:
            route: "T(String).format('%s/%s', headers.region, headers.status)"
            count: "headers.count.toString()"

New configuration:

solace:
  connector:
    workflows:
      0:
        transform:
          enabled: true
          expressions:
            - transform: "target['headers']['route'] = #joinString('/', source['headers']['region'], source['headers']['status'])"
            - transform: "target['headers']['count'] = #convertNumberToString(source['headers']['count'])"