Hi And notice I use org.apache.camel.Message objects as container for the answer to return in the custom Expression. I do this as I can then add the custom header with the destination for the recipient list EIP.
If I do not do that then I may have to use the Content Based Router afterwards and check the content where to route the message. On Mon, Oct 5, 2009 at 10:30 AM, Claus Ibsen <[email protected]> wrote: > Hi > > You can use a custom expression to do the splitting and combined with > the recipient list you can in your custom expression also determine > where to message should be routed next. > > See this unit test I added > http://svn.apache.org/viewvc?rev=821717&view=rev > > > > On Mon, Oct 5, 2009 at 9:56 AM, S. Ali Tokmen <[email protected]> > wrote: >> Hello >> >> I'm trying to create a route which does the following: >> >> * Reads a file from the /input path, containing Java-property-like >> entries. Let's assume it for example contains: >> o p1 = x >> o p2 = y >> o p3 = z >> o p4 = t >> * Splits the file into two files and puts it into /output_2 and >> /output_3 >> o /output_2 should only receive the properties p1 and p2, e.g.: >> + p1 = x >> + p2 = y >> o /output_3 should only receive the properties p1 and p3, e.g.: >> + p1 = x >> + p3 = z >> * Once the writing of these files finished, move the original file >> in /input into /backup >> >> I'm attaching some images for illustrating this. >> >> Now, here's the issue: when I do a route like the following: >> >> from("file:/input"). >> to("direct:output_2", "direct:output_3"). >> to("file:/backup"); >> >> from("direct:output_2").process(OnlyKeepPropertyProcessor("p1", >> "p2").to("file:/output_2"); >> from("direct:output_3").process(OnlyKeepPropertyProcessor("p1", >> "p3").to("file:/output_3"); >> >> Then only p1 and p2 is passed to the process3, and the file in /output_3 >> contains only p1. Worse, the backup only backs up what's in output_3... >> >> What is the good EIP for such a route? >> >> Thanks >> >> -- >> >> S. Ali Tokmen >> [email protected] >> >> Office: +33 4 76 29 76 19 >> GSM: +33 66 43 00 555 >> >> Bull, Architect of an Open World TM >> http://www.bull.com >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
