Once a transformation has been written, its factory has to be registered so that the Bridge is aware of its presence and it can be used:
MyTransformationFactory mtf = new MyTransformationFactory();
Transformations can be defined for individual inbound or outbound flows or, if appropriate, default inbound or outbound transformations can be defined for a pipe. These default transformations are then applied to those inbound or outbound flows within the pipe that do not have their own defined transformations.
Multiple transformations can be “chained” in sequence and the combination attached to a flow or pipe. Thus, a message enters a flow and undergoes the first transformation. The output of the transformation is then passed to the next transformation in the chain and so on until all transformations have been applied and the message passes to the receiving end of the flow.
One or more transformations are attached to a flow or pipe by creating a TransformationDefinitionList
. This list contains a TransformationDefinition
entry for each transformation to be applied and list may consist of a single item if only one transformation is required for the particular flow or pipe it is intended for.
An example is shown below:
//Create a Transformation Definition
TransformationDefinition transdef = bridge.createTransformationDefinition("myTransformationDefinition");;
Then add the transformation definition to the TransformationDefinitionList.
//Add the Transformation Definition to the Transformation Definition List
TransformationDefinitionList transDefList = bridge.createTransformationDefinitionList();
Next add the transformation definition list to either flow or pipe. An example of adding the transformation definition list to the outbound Flow of the pipe:
An example of adding the transformation definition list to the inbound Flow of the pipe:
An example of adding the transformation definition list to a flow:
If required, parameters may be passed to a transformation using the TransformationDefinitino.setInput()
method as illustrated in Using the core transformations
Parent topic: Adding Transformations: XPD621