camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Bakker <>
Subject useOriginalMessage, but not when after splitter
Date Mon, 06 Feb 2012 09:24:59 GMT

I'm setting up a route where a file is parsed in a few steps, then splitter and for each split
part, some code is run. 

Now, if somewhere along the parsing steps an exception occurs, I want the original file sent
to an alternative endpoint. This is easy with useOriginalMessage.

When an exception occurs after splitting however, I'd like to put just that part into the
alternative endpoint, with a filename similar to originalfile_splitindex.

This is where it gets hairy though. When I use useOriginalMessage, what gets delivered to
the alternative endpoint is the split-result (so not really the original message, but it is
incidentally exactly what I want). However, the headers and attachments of the original message
are used, so I have no way to set, for example the CamelFileName header to include the split

So I guess that I need to setup a second exception clause, but I have no idea on how to differentiate
between exceptions that occur inside the split and exceptions that occur outside the split.
Any ideas? Or am I doing something silly altogether?

I use the Scala DSL, and it looks similar to:

  "Incoming Files" :: "file://incoming" ==> {
    process (MyFileComponents.parser)
    split   (MyFileComponents.fileSplitter) {
      setHeader("CamelFileName", "test") // <-- This does nothing
      process (ex => {
        throw new Exception("Break!")



  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message