filter
Processor that determines if message payloads may proceed, provided the JSONiq or SpEL expression returns true for the message.
Properties
| Name | Summary |
|---|---|
|
The JSONiq or SpEL expression that messages will be evaluated and filtered against. |
|
Whether the incoming payload is available for error processing on failure. Defaults to |
|
Optional, descriptive name for the processor. |
|
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 |
|
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. |
Sub-builders
| Name | Summary |
|---|---|
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. |
|
Strategy for describing how a processor’s message is logged on the server. |
|
Strategy for archiving payloads. |
Details
Expressions
The filter processor makes it possible to stop the processing of messages that do not match a given expression.
Expressions are run in the standard expression context and must return a boolean value.
The following JSONiq expression filters on a property of a JSON compliant payload:
filter {
id = "filter-message"
expression = """jsoniq:#input.envelope.payload.value = "testValue" """
}
The same filter in SpEL:
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>"
A JSONiq expression that returns an empty result fails the message instead of filtering it.
If the field is missing, a value comparison such as eq returns an empty result, and the message fails.
A general comparison such as = returns false, so the example above filters the message out.
For details about how the filter processor handles JSONiq expression outcomes, see the processor-specific error handling guide.
If an inboundTransformationStrategy is configured on the filter processor, the expression is evaluated against the converted payload.
Byte Streaming
In a streaming flow, the filter processor acts as a Stream Agnostic Processor.