thanks, that sadly doesn't work either. I tried
from("direct:testSplit") .split(body().tokenize("\n")).streaming() .setProperty("totalSize", simple("${property.CamelSplitSize}")) .to("mock:result") .end() .log("property ${exchangeProperty.totalSize} updates") .log("should only happen once"); and exchangeProperty.totalSize isn't set outside of the split. Thanks On Fri, Aug 14, 2015 at 6:00 PM, Luis Augusto C. Sauerbronn < lasa...@gmail.com> wrote: > Hi, > > If you want to store an information to use it later during the lifetime of > the request you should place it in the "Exchange Properties" not in the > "Input/Output Headers". > Many endpoints and processors do not pass ahead the received headers. If > you put it on the Exchange properties it will exist through the whole life > cycle of the request. > > Best regards, > > Luis > > 2015-08-14 17:49 GMT-03:00 Wilson MacGyver <wmacgy...@gmail.com>: > > > tried that, sadly no go. any header I set within the split, isn't > > accessible outside of the split block either. > > > > On Tue, Aug 11, 2015 at 4:54 AM, mailingl...@j-b-s.de < > > mailingl...@j-b-s.de> > > wrote: > > > > > Hi! > > > > > > Try the following: in your split route just set a new header field with > > > the value of "splitsize". Ok, this assignment is made more than once > > > redundantly per each splitted element, but header properties you create > > on > > > the original message are retained (hopefully :-) > > > > > > Jens > > > > > > Von meinem iPhone gesendet > > > > > > > Am 10.08.2015 um 21:49 schrieb Wilson MacGyver <wmacgy...@gmail.com > >: > > > > > > > > I'm sorry my message isn't clear. I've read the docs and the chapter > > that > > > > deal with this in the camel book. The issue I have isn't with the > each > > > time > > > > part. > > > > > > > > It's the final log part after the split is done. My goal is after the > > end > > > > of the split block to send an email logging the total number updates. > > > > > > > > But as you can see, CamelSplitSize is no longer set outside of the > > split > > > > block. So I have no way of sending that to a SMTP route. > > > > > > > > On Mon, Aug 10, 2015 at 4:15 PM Christian Müller < > > > > christian.muel...@gmail.com> wrote: > > > > > > > >> Sure, that's how stream works. We do not load the entire payload > into > > > >> memory. > > > >> Why don't you use the property CamelSplitIndex? In this case, the > > output > > > >> will be > > > >> > > > >> [Test worker] INFO route1 - each time 0 > > > >> > > > >> [Test worker] INFO route1 - each time 1 > > > >> > > > >> [Test worker] INFO route1 - each time 2 > > > >> > > > >> Best, > > > >> > > > >> Christian > > > >> ----------------- > > > >> > > > >> Software Integration Specialist > > > >> > > > >> Apache Member > > > >> V.P. Apache Camel | Apache Camel PMC Member | Apache Camel committer > > > >> Apache Incubator PMC Member > > > >> > > > >> https://www.linkedin.com/pub/christian-mueller/11/551/642 > > > >> > > > >> On Mon, Aug 10, 2015 at 4:35 AM, Wilson MacGyver < > wmacgy...@gmail.com > > > > > > >> wrote: > > > >> > > > >>> public class SplitTest extends CamelTestSupport { > > > >>> > > > >>> @EndpointInject(uri = "mock:result") > > > >>> > > > >>> protected MockEndpoint resultEndpoint; > > > >>> > > > >>> > > > >>> @Produce(uri = "direct:testSplit") > > > >>> > > > >>> protected org.apache.camel.ProducerTemplate template; > > > >>> > > > >>> > > > >>> @Test > > > >>> > > > >>> public void testWithString() throws Exception{ > > > >>> > > > >>> String content = "a\nb\nc"; > > > >>> > > > >>> > > > >>> resultEndpoint.expectedMessageCount(3); > > > >>> > > > >>> > > > >>> template.sendBodyAndHeader( > > > >>> > > > >>> content, > > > >>> > > > >>> "foo", "bar"); > > > >>> > > > >>> > > > >>> resultEndpoint.assertIsSatisfied(); > > > >>> > > > >>> } > > > >>> > > > >>> > > > >>> @Override > > > >>> > > > >>> protected RouteBuilder createRouteBuilder() { > > > >>> > > > >>> return new RouteBuilder() { > > > >>> > > > >>> public void configure() { > > > >>> > > > >>> from("direct:testSplit") > > > >>> > > > >>> .split(body().tokenize("\n")).streaming() > > > >>> > > > >>> .log("each time > > ${property.CamelSplitSize}") > > > >>> > > > >>> .to("mock:result") > > > >>> > > > >>> .end() > > > >>> > > > >>> .log("Processed ${property.CamelSplitSize} > > > >>> updates") > > > >>> > > > >>> .log("should only happen once"); > > > >>> > > > >>> } > > > >>> > > > >>> }; > > > >>> > > > >>> } > > > >>> > > > >>> } > > > >>> > > > >>> > > > >>> running this, I get the following > > > >>> > > > >>> > > > >>> > > > >>> [Test worker] INFO route1 - each time > > > >>> > > > >>> [Test worker] INFO route1 - each time > > > >>> > > > >>> [Test worker] INFO route1 - each time 3 > > > >>> > > > >>> [Test worker] INFO route1 - Processed updates > > > >>> > > > >>> [Test worker] INFO route1 - should only happen once > > > >>> > > > >>> > > > >>> given the input of 3 lines. CamelSplitSize is only set at the end > of > > > the > > > >>> split. so only the 3rd time has the 3 displayed which is correct. > > > >>> > > > >>> however notice it says Processed updates, because the property is > > > only > > > >>> set within the split..end block > > > >>> > > > >>> that's what I meant by out of scope > > > >>> > > > >>> > > > >>> > > > >>> On Sun, Aug 9, 2015 at 3:23 PM, Christian Müller < > > > >>> christian.muel...@gmail.com> wrote: > > > >>> > > > >>>> What do you mean with "is out of scope"? > > > >>>> You can use the message header to get this information. > > > >>>> > > > >>>> Best, > > > >>>> > > > >>>> Christian > > > >>>> ----------------- > > > >>>> > > > >>>> Software Integration Specialist > > > >>>> > > > >>>> Apache Member > > > >>>> V.P. Apache Camel | Apache Camel PMC Member | Apache Camel > committer > > > >>>> Apache Incubator PMC Member > > > >>>> > > > >>>> https://www.linkedin.com/pub/christian-mueller/11/551/642 > > > >>>> > > > >>>> On Thu, Aug 6, 2015 at 5:26 PM, Wilson MacGyver < > > wmacgy...@gmail.com> > > > >>>> wrote: > > > >>>> > > > >>>>> I figured out what I was doing wrong. It's because I was using > > > >> filter > > > >>>> with > > > >>>>> bean. I didn't realize I had to add an end() to terminate the > > > >> filtering > > > >>>>> > > > >>>>> > > > >>>>> from() > > > >>>>> > > > >>>>> .split(body().tokenize("\n")).streaming() > > > >>>>> > > > >>>>> .process() /do stuff > > > >>>>> > > > >>>>> .filter().method(MyFilter.class, "keepIt") > > > >>>>> > > > >>>>> .to("mock:result") > > > >>>>> > > > >>>>> .end() > > > >>>>> > > > >>>>> .log("final time ${property.CamelSplitSize}") > > > >>>>> > > > >>>>> .to(smtp://) > > > >>>>> > > > >>>>> > > > >>>>> now I have a different problem. I need to know the # of total > > > >>> processed. > > > >>>>> But the CamelSplitSize property is out of scope. Anyway to work > > > >> around > > > >>>>> that? > > > >>>>> > > > >>>>> > > > >>>>> Thanks > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> On Thu, Jul 23, 2015 at 2:03 PM, Claus Ibsen < > > claus.ib...@gmail.com> > > > >>>>> wrote: > > > >>>>> > > > >>>>>> You must be doing some more inside the splitter and you may > need 2 > > > >> x > > > >>>> end > > > >>>>>> > > > >>>>>> On Thu, Jul 23, 2015 at 7:45 PM, Wilson MacGyver < > > > >>> wmacgy...@gmail.com> > > > >>>>>> wrote: > > > >>>>>>> hmm, if I understand you correctly, this isn't working for me. > > > >>>>>>> > > > >>>>>>> I have > > > >>>>>>> > > > >>>>>>> from() > > > >>>>>>> > > > >>>>>>> .split(body().tokenize("\n")).streaming() > > > >>>>>>> > > > >>>>>>> .process() /do stuff > > > >>>>>>> > > > >>>>>>> .end() > > > >>>>>>> > > > >>>>>>> .log("${in.body}") > > > >>>>>>> > > > >>>>>>> .to(smtp://) > > > >>>>>>> > > > >>>>>>> > > > >>>>>>> say if the file has 100 lines, I'd except to see the log once > if > > > >> I > > > >>>>>>> understand what you are saying correctly. but I see the log 100 > > > >>>> times. > > > >>>>>>> > > > >>>>>>> > > > >>>>>>> Thanks, > > > >>>>>>> > > > >>>>>>> > > > >>>>>>> > > > >>>>>>> On Thu, Jul 23, 2015 at 1:24 PM, Claus Ibsen < > > > >>> claus.ib...@gmail.com> > > > >>>>>> wrote: > > > >>>>>>> > > > >>>>>>>> You can do that after the splitter > > > >>>>>>>> > > > >>>>>>>> <from> > > > >>>>>>>> <split> > > > >>>>>>>> ... inside splitter > > > >>>>>>>> </split> > > > >>>>>>>> .. split done > > > >>>>>>>> <to email> send email here > > > >>>>>>>> > > > >>>>>>>> In Java DSL you can use .end() to end the split block. > > > >>>>>>>> > > > >>>>>>>> On Thu, Jul 23, 2015 at 7:21 PM, Wilson MacGyver < > > > >>>> wmacgy...@gmail.com > > > >>>>>> > > > >>>>>>>> wrote: > > > >>>>>>>>> Hi, > > > >>>>>>>>> > > > >>>>>>>>> I'm processing a large file. so I use .split and .streaming > to > > > >>>>> process > > > >>>>>>>> it a > > > >>>>>>>>> record at a time. > > > >>>>>>>>> > > > >>>>>>>>> I would like to send an email alert upon completion of > > > >>> processing > > > >>>>> the > > > >>>>>>>> file. > > > >>>>>>>>> > > > >>>>>>>>> but I can't figure out where to do that. > > > >>>>>>>>> > > > >>>>>>>>> I know I can check to see if it's the last exchange using > > > >>> property > > > >>>>>>>>> "CamelSplitComplete", but it's set to true on the last > > > >> exchange. > > > >>>> So > > > >>>>> I > > > >>>>>>>> still > > > >>>>>>>>> need to let it finish. > > > >>>>>>>>> > > > >>>>>>>>> Is there a good way to this? > > > >>>>>>>>> > > > >>>>>>>>> Thanks, > > > >>>>>>>>> Mac > > > >>>>>>>>> > > > >>>>>>>>> -- > > > >>>>>>>>> Omnem crede diem tibi diluxisse supremum. > > > >>>>>>>> > > > >>>>>>>> > > > >>>>>>>> > > > >>>>>>>> -- > > > >>>>>>>> Claus Ibsen > > > >>>>>>>> ----------------- > > > >>>>>>>> http://davsclaus.com @davsclaus > > > >>>>>>>> Camel in Action 2nd edition: http://www.manning.com/ibsen2 > > > >>>>>>> > > > >>>>>>> > > > >>>>>>> > > > >>>>>>> -- > > > >>>>>>> Omnem crede diem tibi diluxisse supremum. > > > >>>>>> > > > >>>>>> > > > >>>>>> > > > >>>>>> -- > > > >>>>>> Claus Ibsen > > > >>>>>> ----------------- > > > >>>>>> http://davsclaus.com @davsclaus > > > >>>>>> Camel in Action 2nd edition: http://www.manning.com/ibsen2 > > > >>>>> > > > >>>>> > > > >>>>> > > > >>>>> -- > > > >>>>> Omnem crede diem tibi diluxisse supremum. > > > >>> > > > >>> > > > >>> > > > >>> -- > > > >>> Omnem crede diem tibi diluxisse supremum. > > > >> > > > > > > > > > > > -- > > Omnem crede diem tibi diluxisse supremum. > > > -- Omnem crede diem tibi diluxisse supremum.