Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

EDI DataFormat

This component ships with a EDI dataformat that can be used to format from an InputStream (could be String) to XML.

  • marshal = currently not support by Smmoks
  • 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, invoke on of the appropriate setter and invoke the unmarshl 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");

The default configuration file is provided as a resource in the jar in the location: org/apache/camel/dataformat/edi/default-smooks-config.xmlWe encourage end users to look at the Smooks which supports EDI and Camel natively.