User-Configured Payload Transforms
Message payloads going through a workflow can be transformed using a Spring Expression Language (SpEL) expression as follows:
# <workflow-id> : The workflow ID ([0-19]) # <expression> : A SpEL expression solace.connector.workflows.<workflow-id>.transform-payloads.expressions[0].transform=<expression>
A SpEL expression may reference:
-
payload:
: To access the message payload. -
headers.<header_name>
: To access a message header value.
While the syntax uses an array of expressions, only a single transform expression is supported in this release. Multiple transform expressions may be supported in the future.
Registered Functions
Registered functions are built-in and can be called directly from SpEL expressions. To call a registered function, use the #
character followed by the function name. The following table describes the available registered functions:
Registered Function Signature | Description |
---|---|
|
Returns whether the object Sample usage of this function within a SpEL expression: |
Example 1: To normalize byte[]
and String
payloads as upper-cased String
payloads or leave payloads unchanged when of different types:
solace.connector.workflows.0.transform-payloads.expressions[0].transform ="#isPayloadBytes(payload) ? new String(payload).toUpperCase() : payload instanceof T(String) ? payload.toUpperCase() : payload"
Example 2: To convert String
payloads to byte[]
payloads using a charset
retrieved from a message header or leave payloads unchanged when of different types:
solace.connector.workflows.0.transform-payloads.expressions[0].transform="payload instanceof T(String) ? payload.getBytes(T(java.nio.charset.Charset).forName(headers.charset)) : payload"
For more information about Spring Expression Language (SpEL) expressions, see Spring Expression Language (SpEL).