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

Transformer

olegz edited this page Jun 5, 2012 · 8 revisions

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

Continuation from Transformer could be expressed using '-->' operator.

Transformer

Root DSL element for Transformer is transform

val transformer = transform { m: Message[_] => m }

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

For example:

val transformerA = transform { m: Message[_] => m } additionalAttributes(name="myTransformer") //infix

val transformerB = transform { m: Message[_] => m }.additionalAttributes(name="myTransformer") 

will produce a Transformer named 'myTransformer'.

Properties that could be set:

name - component name

Unlike [Service Activator] (https://github.com/SpringSource/spring-integration-dsl-scala/wiki/Service-Activator) Transformer's transform.apply method signature is:

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

where R: NotUnitType - anything but Unit

That is done to guard from Functions that return Unit since it woud violate the contract of the Transformer which must always return a value that is not Void/Unit.


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