2 Replies Latest reply on Sep 28, 2010 12:38 AM by jessica leahy

    Trouble Splitting Messages in Route

    Joseph Krozak Newbie

      I have a simple route that consumes an XML file from a FileEndpoint, passes that to a custom Processor that converts the incoming XML message into potentially multiple, new output XML messages and then passes those to a target FileEndpoint.  So, to be clear, the idea is to convert each incoming XML transaction file into one or more XML transaction files using a different XML schema.

       

      My problem is that the splitter doesn't seem to work.  At the end of my processor, I have an ArrayList of Strings, where each string contains the contents of the output files that need to be created.  So, if the collection has 5 strings, then each string needs to be written to a seperate file.  My problem is that only one output file is ever created.  My route looks like: from ("file:/data/in").pro cess (new CustomProcessor()).split(body()).log("Split line $").to ("file:/data/out");

       

      Whenever i run this, i only get one output file (named as a GUID, which is fine), and it only contains one of the custom processor collection's String entries.  Additionally, I see the following DEBUG message: ... org.apache.camel.util.FileUtil - Tried 1 to delete file /data/in/inputFile1.xml.camelLock with result: true.

       

      Any idea what's going on?  Alternatively I tried making the custom processor append all of the output message strings together with a token, and then have the following split route step use .tokenize(token) to split up the message.  However, the tokenizer only seems to work for tokens like "\n" and not arbitrary symbols like "$", "+" or any other delimiters that would work better for me.  Again, any ideas?

       

      Thanks,

       

      Joe