The Smooks Mediator can be used to apply lightweight transformations on messages in an efficient manner. Smooks is a powerful framework for processing, manipulating and transforming XML. More information about Smooks can be obtained from the official Smooks website.
The Smooks Mediator requires the transformation definition to be passed in as an external resource. This transformation can be specified as a local entry or be stored in the registry. The mediator UI enables you to point the mediator to an existing local entry or a registry resource.
- Input- User can define the input as text or XML.
- Expression - Specify an XPath as an expression to pick the exact message block. Else, the entire 'message body' will be selected by default.
- Output - Similar to input, the user can define how the output should be. The output type can be text, XML, or Java, and the output can be a property or expression. When the user defines the output as a property, the property will be saved in the messagecontext for future uses. When the user defines the output as an expression, there are additional actions that can be performed:
- Add - The selected node will be added as a child to the message.
- Replace - Selected node will be replaced in the message.
- Sibling - Selected node will be added as a sibling.
Smooks can be used to split a file and send split results to a JMS endpoint. In this case, having a value other than -1 for
jms:highWaterMark in the Smooks configuration file can result in a low throughput for message publishing, since Smooks will spend resources on message counting while the messages are being published. Therefore, it is recommended to use -1 as the
highWaterMark value for high throughput values. Following is a sample Smooks configuration file with this setting. For more information on creating the Smooks configuration file, see the documentation on the official Smooks website.