Smooks

The smooks component supports the Smooks Library for EDI parsing. The camel-smooks library is provided by the Camel Extra project which hosts all *GPL related components for Camel.

It is only the EDI parsing feature that is implemented in this component. The other features from Smooks are covered in existing camel components.
Parsing from any given data source to EDI is implemented using Camel Data Format.

EDI DataFormat

This component ships with a EDI dataformat that can be used to format from a java.io.InputStream to XML as a org.w3c.Document Object.

  • marshal = currently not supported by Smooks
  • unmarshal = from stream to XML (can be used when reading EDI files)

The EDIDataFormat must be configued with either a:

  • setSmooksConfig(configfile) = a fully Smooks configuration file
  • setMappingModel(modelfile) = just the mapping model xml file and Camel will use a default Smooks configuration

To use the data format simply instantiate an instance, set the configuration (above) and invoke the unmarshal operation in the route builder:

DataFormat edi = new EDIDataFormat();
edi.setMappingModel("my-order-mapping.xml");
...
from("file://edi/in").
  unmarshal(edi).
  to("jms:queue:edi");

And you can also provide the full Smooks configuration file where you can configure Smooks as you want, in case the default configuration isn't useful:

DataFormat edi = new EDIDataFormat();
edi.setSmooksConfig("my-smooks-config.xml");
...
from("file://edi/in").
  unmarshal(edi).
  to("jms:queue:edi");

Dependencies

To use EDI in your camel routes you need to add the a dependency on camel-smooks which implements this data format.

This component is hosted at the Camel Extra project since the Smooks library uses a licenses which cant be included directly in an Apache project.

Graphic Design By Hiram