This sample demonstrates how to process huge XML messages via the splitting and routing approach using the Smooks mediator. In this sample, the ESB reads a huge XML input file through the VFS transport, then the Smooks mediator splits the message into parts and routes each split fragment to a specified location.
- Enable the VFS transport. For details, see Enable VFS.
- For a list of general prerequisites, see Setting Up the ESB Samples.
- Open the
<ESB_HOME>/repository/sample/synapse_sample_658.xmlfile in a text editor and change the following VFS transport configuration parameters based on the directory locations applicable to you.
transport.vfs.FileURI- The input file location.
transport.vfs.MoveAfterProcess- The location to move the input file after it is processed.
transport.vfs.MoveAfterFailure- The location to move the input file if there happens to be a failure at the time of processing.
- Open the
<ESB_HOME>/repository/samples/resources/smooks/smooks-config-658.xmlfile in a text editor and replace
<file:destinationDirectoryPattern>/home/lakmali/dev/test/smooks/orders</file:destinationDirectoryPattern>configuration line to a directory location applicable to you.
Building the sample
The XML configuration for this sample is as follows:
This configuration file
synapse_sample_658.xml is available in the
To build the sample
Start the ESB with the sample 658 configuration. For instructions on starting a sample ESB configuration, see Starting the ESB with a sample configuration.
The operation log keeps running until the server starts, which usually takes several seconds. Wait until the server has fully booted up and displays a message similar to "WSO2 Carbon started in n seconds."
Executing the sample
To execute the sample
input-message-658.xml file from the
<ESB_HOME>/repository/samples/resources/smooks directory to the location specified as
transport.vfs.FileURI in the configuration.
If you want to try this sample with an input file of your own, be sure that the input file has a XML message similar to the format of
Analyzing the output
You will see the output of the incoming message that is split and routed via the Smooks mediator in the
destinationDirectoryPattern location you specified when following the prerequisites.