After microservices are connected via routes, transformations can be defined on routes having schema mismatches. In the example shown below, there is a schema mismatch between the Feeder output port and CBR input port and hence the route is shown as a dotted line.
A route transformation can be defined in any one of the following ways:
- Defining a Mapper Project
- Providing a Custom XSL
- Using a Named Configuration
- Importing from a Zip file
Figure 1: Route Transformation options
Defining a Mapper Project
This operation allows the user to define mappings between the source and target port schema using the Fiorano eMapper.
To define the transformation using eMapper, perform the steps below:
Right-click the route and select the Mapper Project option from the Configure Transformation sub menu.
Transformations can be defined on schemas by connecting elements from input structure with output structure elements. Additional computations on elements can also be made by using functions present within the Funclet view.
Figure 2: Route transformation editor
Once the transformation is defined and closed, the transformation will be set on the route and the route appears bold as in the figure below.
Figure 3: Route with the transformation set
Providing a Custom XSL
To provide a Custom XSL, perform the steps below:
- Right-click the route and select Custom XSL from the Configure Transformation menu.
- In the Custom XSL dialog box that is displayed, provide the XSL in the first tab and XSL for the JMS Message (if any) in the second tab. Click OK to set the transformation on the route. The XSLT Engine to be used (Xalan / Saxon / XSLTC) can be specified from the drop-down menu in the top right corner.
- The XSL provided can be tested by clicking the Test button.
Example
By following the steps mentioned above, set the XSL below as a Route Transformation.
To test the XSL, click the Test button and provide an XML in the input tab and click Transform. The output will be displayed in the Output tab.
Figure 4: Custom XSL Dialog
Figure 5: Transformed XML
Using a Named Configuration
Transformations can also be saved in the Configuration Repository as Named Configurations and can be used where required.
To Use a Named Configuration as a route transformation, right-click on the route and select Use Named Configuration. Choose the configuration to be used from the list of available named configurations.
Importing from a Zip file
Users can also import previously exported transformations from a .Zip file by selecting the Import from Archive File [.Zip] from the Configure Transformation menu.
To save the transformation defined on a route as an archive file, right-click on the route on which the route transformation is defined and select Save Configuration as > Archive File.
The transformation defined on the route is executed inside the Peer server. It is advised not to define complex mappings (involving huge schemas and mappings) using Route Transformations since it may affect the Peer server performance. For complex transformations, the XSLT microservice can be used.
To remove a transformation defined on the route, right-click the route and select the Clear Transformation option.
Route transformation can be changed on the route at both configuration time and runtime. During runtime, if the transformation is changed, the changes are automatically deployed to the server. The user need not explicitly synchronize the event process for the changes to take effect.