filter

Processor that determines if message payloads may proceed, provided the expression returns true when evaluated against the message payload.

Properties

Name Summary

expression

The expression that messages will be evaluated and filtered against.

name

Optional, descriptive name for the processor.

id

Required identifier of the processor, unique across all processors within the flow. Must be between 3 and 30 characters long; contain only lower and uppercase alphabetical characters (a-z and A-Z), numbers, dashes ("-"), and underscores ("_"); and start with an alphabetical character. In other words, it adheres to the regex pattern [a-zA-Z][a-zA-Z0-9_-]{2,29}.

exchangeProperties

Optional set of custom properties in a simple jdk-format, that are added to the message exchange properties before processing the incoming payload. Any existing properties with the same name will be replaced by properties defined here.

retainPayloadOnFailure

Whether the incoming payload is available for error processing on failure. Defaults to false.

Sub-builders

Name Summary

messageLoggingStrategy

Strategy for describing how a processor’s message is logged on the server.

payloadArchivingStrategy

Strategy for archiving payloads.

inboundTransformationStrategy

Strategy that customizes the conversion of an incoming payload by a processor (e.g., string to object). Should be used when the processor’s default conversion logic cannot be used.

Details

Expressions

The filter processor makes it possible to stop the processing of messages that do not match a given expression. Expressions are executed in the standard expression context and must return a boolean value. The following example demonstrates filtering on the property of a JSON compliant payload:

filter {
    id = "filter-message"
    expression = "envelope.payload['value'] == 'testValue'"
}

The boolean value returned when evaluating this expression determines what happens to a message in a flow. true expressions will continue processing the message as normal; false expressions will cancel the message and return a cancellation object. In a REST-based flow, this would generate a response that includes the following property:

"reason": "Message did not match filter expression: <expression>"

If an inboundTransformationStrategy is configured on the filter processor, the expression is evaluated against the converted payload.