Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Message filter

olegz edited this page Jun 5, 2012 · 8 revisions

EIP reference for Message Filter can be found here - http://www.eaipatterns.com/Filter.html

Continuation from Message Filter could be expressed using '-->' operator.

Message Filter

Root DSL element for Message Filter is filter

val messageFilter = filter { m: Message[String] => m.getPayload.equals("foo") }

If you need to add any extra properties to the Message Filter you may do so using additionalAttributes method which accepts named parameters.

For example:

val messageFilterA = filter { m: Message[_] => m } additionalAttributes(name="myFilter") //infix

val messageFilterB = filter { m: Message[_] => m }.additionalAttributes(name="myFilter") 

will produce a Message Filter named 'myFilter'.

Properties that could be set:

name - component name

exceptionOnRejection - boolean value which if set to 'true' will result in exception if Message does not pass a filtering criteria. If 'false' the Message wil be simply discarded.

Transformer's filter.apply method signature is:

def apply(function:Function1[_,Boolean])

That is done to guard from Functions that return anything other than Boolean to satisfy the Messaging Filter contract


[Back to Core Messaging Patterns] (https://github.com/SpringSource/spring-integration-dsl-scala/wiki/Core-Messaging-Patterns)