Re: requestBodyAndHeader and HEADER_CLOSE_SESSION_WHEN_COMPLETE
Hi guys, Turns out that I'm using MinaProducer and not MinaConsumer of course; MinaConsumer is the one that has the HEADER_CLOSE_SESSION_WHEN_COMPLETE logic and MinaProducer isn't so capable by the looks of it. I was hoping that stopping the template by calling its stop method would in turn cause the MinaProducer to close its session. It does not. I then reverted to the lower level method of creating a producer for my endpoint and then using the following logic: CamelContext camelContext = exchange.getContext(); Endpoint endpoint = camelContext.getEndpoint(smsSenderEndpoint); Producer producer = endpoint.createProducer(); producer.start(); try { ... // For each message to send Exchange smsExchange = producer.createExchange(); smsExchange.getIn().setBody(requestMessage); producer.process(smsExchange); Object replyMessage = smsExchange.getOut().getBody(); … } finally { producer.stop(); } Is this the best approach for sending out a stream of messages through the same channel and then ensuring that the channel is closed down; or should we be looking at some new functionality perhaps in the form of some header or method indicating that a session should be closed by the producer? Kind regards, Christopher -- View this message in context: http://old.nabble.com/requestBodyAndHeader-and-HEADER_CLOSE_SESSION_WHEN_COMPLETE-tp27175565p27283994.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Validate Xml
Hi, I think you can do it with camel validation component. You can find more information about how to use it here[1] [1] http://camel.apache.org/validation.html Willem jpcook wrote: Hi, I noticed you had a validation component for validating xml against xsds. But I wondered if there was a nice way to test if the message body was well formed xml. I have a scenario where I am pulling a xml feed via http but when the feed is unavailable you get back an html page which I also retrieve successfully but want to test if it is valid/well formed xml before passing the message on. I could obviously do this quite easily with a processor or bean class by loading into a dom object but I wondered if there was something neat in Camel that would help. Thanks
Re: Aggregator's not returning combined exchanges, only returns last exchange
Instead of outBatchSize=2 did you try batchSize=2 maybe? Also does it perhaps work properly without that wiretap? On Fri, Jan 22, 2010 at 10:41 AM, lekkie wrote: > > This is what comes form my log: > > 11:38:31,370 | INFO | 0: Batch Sender | MyAggregationStrategy | > rg.tempuri.MyAggregationStrategy 23 | new: Exchange[Message: > StringSource[ xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><_ns_:RequestResponse > xmlns:_ns_="http://services.locator/";> xmlns:tns="http://services.locator/";>-1Unknown > error]] > 11:38:31,370 | INFO | 0: Batch Sender | MyAggregationStrategy | > rg.tempuri.MyAggregationStrategy 30 | newly formed: Exchange[Message: > > http://schemas.xmlsoap.org/soap/envelope/";> > > > > 230 > current > > > > > xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";><_ns_:RequestResponse > xmlns:_ns_="http://services.locator/";> xmlns:tns="http://services.locator/"; >-1Unknown > errorxmlns:xsi="... [Body clipped after 1000 chars, total length > is 1301]] > > > In the log above, myaggregationstrategy prints the concatenated message, but > the problem is that the printed exchange is not returned to uri="direct:ProcessorServices" />, only the last exchange gets to uri="direct:ProcessorServices" />. > > I hope this is clear. > > > > > > Stan Lewis-3 wrote: >> >> Hmmm, I tested your aggregator code as-is on 2.2-SNAPSHOT here and it >> works fine: >> >> 2010-01-22 09:41:18,444 [0: Batch Sender] INFO >> JoinStringAggregatorTest - New: Exchange[Message: one] >> 2010-01-22 09:41:18,444 [0: Batch Sender] INFO >> JoinStringAggregatorTest - old: Exchange[Message: one] >> 2010-01-22 09:41:18,445 [0: Batch Sender] INFO >> JoinStringAggregatorTest - new: Exchange[Message: two] >> 2010-01-22 09:41:18,445 [0: Batch Sender] INFO >> JoinStringAggregatorTest - newly formed: Exchange[Message: >> onetwo] >> 2010-01-22 09:41:18,800 [0: Batch Sender] INFO AGGREGATION_RESULT >> - Exchange[BodyType:String, Body:onetwo] >> >> What version are you running there, can you try the latest snapshot? >> >> On Fri, Jan 22, 2010 at 8:39 AM, lekkie wrote: >>> >>> See code below: >>> >>> package org.tempuri; >>> >>> import org.apache.camel.Exchange; >>> import org.apache.camel.Header; >>> import org.apache.camel.Message; >>> import org.apache.camel.processor.aggregate.AggregationStrategy; >>> import org.apache.commons.logging.Log; >>> import org.apache.commons.logging.LogFactory; >>> >>> public class MyAggregationStrategy implements AggregationStrategy { >>> >>> private static final transient Log LOG = >>> LogFactory.getLog(MyAggregationStrategy.class); >>> >>> public Exchange aggregate(Exchange oldExchange, Exchange >>> newExchange) >>> { >>> >>> if (oldExchange == null) >>> { >>> LOG.info("old is null only new available"); >>> LOG.info("New: " + newExchange); >>> return newExchange; >>> } >>> >>> LOG.info("old: " + oldExchange); >>> LOG.info("new: " + newExchange); >>> >>> Message newIn = newExchange.getIn(); >>> String oldBody = >>> oldExchange.getIn().getBody(String.class); >>> String newBody = newIn.getBody(String.class); >>> newIn.setBody(oldBody + newBody); >>> >>> LOG.info("newly formed: " + newExchange); >>> >>> return newExchange; >>> } >>> >>> >>> } >>> >>> >>> >>> >>> Stan Lewis-3 wrote: Can you post what you're doing in your aggregation strategy? On Fri, Jan 22, 2010 at 4:05 AM, lekkie wrote: > > Hi, > > I want to combine messages from 2 different exchanges into a single > exchange, from the EIP patterns aggregation strategy seems to be right > pattern to use. > > However, after reading the doc > (http://camel.apache.org/aggregator.html), > I > followed the instructns but my aggregation strategy only returns the > last > exchange, even though I specifically configured it to send messages > only > when the outbatchsize is 2. > > I implemented a custom aggregationstrategy with shoulld combine my > exchanges > into one. I log the event in the class and it works fine, what is > beyond > me > is why it returns only the last exchange. > > > See my config here: > class="org.tempuri.MyAggregationStrategy"/> > > http://camel.apache.org/schema/spring"; > trace="true"> > > > > > > > http://services.locator/}Service:ServicesPort"/> > > > > > > > > true > > > > > > > > > > > > log:Respons
Validate Xml
Hi, I noticed you had a validation component for validating xml against xsds. But I wondered if there was a nice way to test if the message body was well formed xml. I have a scenario where I am pulling a xml feed via http but when the feed is unavailable you get back an html page which I also retrieve successfully but want to test if it is valid/well formed xml before passing the message on. I could obviously do this quite easily with a processor or bean class by loading into a dom object but I wondered if there was something neat in Camel that would help. Thanks -- View this message in context: http://old.nabble.com/Validate-Xml-tp27276794p27276794.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: FileConsumer move a file to wrong destination.
OK! The same can be said for CxfProducer? When route: File -> Processor2(getIn()) -> cxf(not comment) -> Log Result ... NG Claus Ibsen-2 wrote: > > On Fri, Jan 22, 2010 at 4:24 PM, ariablu <962...@gmail.com> wrote: >> >> Next test, >> test processor1 -> NG >> test processor2 -> GOOD! >> >> "getOut()" breaks FileExchange data? >> "newName" in GenericFileExpressionRenamer class is defferenet value each >> test. >> > > Ah that is your problem because you use getOut() which creates a > totally new Message which forgets all about the previous one. > > You have to either replace data on IN (which is the easiest to do) > Or copy from IN to OUT > > The getOut() has caused pain before and people should IMHO just stick > to getIn() and manipulate that one. > > > In the future we will rework the API a bit so Camel will detect this > so when you do a getOut() it can safely copy the headers and whatnot. > > > >> [GenericFileExpressionRenamer] >> String newName = expression.evaluate(exchange, String.class); >> >> >> >> [[processor1]] >> package test.impl; >> import org.apache.camel.Exchange; >> import org.apache.camel.Processor; >> public class Trans implements Processor { >> public void process(Exchange exchange) throws Exception { >> exchange.getOut().setHeader("operationNameSpace", >> "http://pc.ws";); >> exchange.getOut().setHeader("operationName", "echo"); >> exchange.getOut().setBody(new Object[]{"A", "B"}); >> } } >> >> [[processor2]] >> package test.impl; >> import org.apache.camel.Exchange; >> import org.apache.camel.Processor; >> public class Trans implements Processor { >> public void process(Exchange exchange) throws Exception { >> exchange.getIn().setHeader("operationNameSpace", >> "http://pc.ws";); >> exchange.getIn().setHeader("operationName", "echo"); >> exchange.getIn().setBody(new Object[]{"A", "B"}); >> } } >> - >> >> >> Claus Ibsen-2 wrote: >>> >>> Hi >>> >>> Can you try using TRACE logging for this log name: >>> org.apache.camel.component.file >>> >>> eg if using log4j then its: >>> log4j.logger.org.apache.camel.component.file=TRACE >>> >>> The should be detailed info how the filename is being evaluated. >>> Wonder if Windows got something mixed up with the path separators. >>> >>> >>> On Fri, Jan 22, 2010 at 11:31 AM, ariablu <962...@gmail.com> wrote: >>>> >>>> Thank you for reply. >>>> >>>> Next try, >>>> using Apache Camel camel-2.2-SNAPSHOT and Spring, >>>> route: File -> Processor -> (cxf) -> Log >>>> >>>> When ... >>>> /_work/test/from/1.txt >>>> >>>> If I run test case, 1.txt file was moved to >>>> /_work/test/backup/20100122 (not directory!) >>>> >>>> But I want >>>> /_work/test/backup/20100122/1.txt >>>> >>>> >>>> [[test case]] >>>> http://camel.apache.org/schema/spring";> >>>> >>> uri="file:c:\_work\test\from?delete=false&noop=false&move=../backup/${date:now:MMdd}/${file:name}"/> >>>> >>>> >>>> >>>> >>>> >>> uri="log:testlog?level=INFO&showExchangeId=true&showProperties=true&showBodyType=true&showBody=true&showOut=true&multiline=true&showHeaders=true"/> >>>> >>>> >>>> >>>> >>>> [[test processor]](not changed) >>>> >>>> [[Log]] >>>> DEBUG ProcessorEndpoint$1 - Starting producer: >>>> Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] >>>> DEBUG ProducerCache - Adding to producer cache with key: >>
Re: Aggregator's not returning combined exchanges, only returns last exchange
This is what comes form my log: 11:38:31,370 | INFO | 0: Batch Sender | MyAggregationStrategy| rg.tempuri.MyAggregationStrategy 23 | new: Exchange[Message: StringSource[http://schemas.xmlsoap.org/soap/envelope/";><_ns_:RequestResponse xmlns:_ns_="http://services.locator/";>http://services.locator/";>-1Unknown error]] 11:38:31,370 | INFO | 0: Batch Sender | MyAggregationStrategy| rg.tempuri.MyAggregationStrategy 30 | newly formed: Exchange[Message: http://schemas.xmlsoap.org/soap/envelope/";> 230 current http://schemas.xmlsoap.org/soap/envelope/";><_ns_:RequestResponse xmlns:_ns_="http://services.locator/";>http://services.locator/"; >-1Unknown errorxmlns:xsi="... [Body clipped after 1000 chars, total length is 1301]] In the log above, myaggregationstrategy prints the concatenated message, but the problem is that the printed exchange is not returned to , only the last exchange gets to . I hope this is clear. Stan Lewis-3 wrote: > > Hmmm, I tested your aggregator code as-is on 2.2-SNAPSHOT here and it > works fine: > > 2010-01-22 09:41:18,444 [0: Batch Sender] INFO > JoinStringAggregatorTest - New: Exchange[Message: one] > 2010-01-22 09:41:18,444 [0: Batch Sender] INFO > JoinStringAggregatorTest - old: Exchange[Message: one] > 2010-01-22 09:41:18,445 [0: Batch Sender] INFO > JoinStringAggregatorTest - new: Exchange[Message: two] > 2010-01-22 09:41:18,445 [0: Batch Sender] INFO > JoinStringAggregatorTest - newly formed: Exchange[Message: > onetwo] > 2010-01-22 09:41:18,800 [0: Batch Sender] INFO AGGREGATION_RESULT > - Exchange[BodyType:String, Body:onetwo] > > What version are you running there, can you try the latest snapshot? > > On Fri, Jan 22, 2010 at 8:39 AM, lekkie wrote: >> >> See code below: >> >> package org.tempuri; >> >> import org.apache.camel.Exchange; >> import org.apache.camel.Header; >> import org.apache.camel.Message; >> import org.apache.camel.processor.aggregate.AggregationStrategy; >> import org.apache.commons.logging.Log; >> import org.apache.commons.logging.LogFactory; >> >> public class MyAggregationStrategy implements AggregationStrategy { >> >> private static final transient Log LOG = >> LogFactory.getLog(MyAggregationStrategy.class); >> >> public Exchange aggregate(Exchange oldExchange, Exchange >> newExchange) >> { >> >> if (oldExchange == null) >> { >> LOG.info("old is null only new available"); >> LOG.info("New: " + newExchange); >> return newExchange; >> } >> >> LOG.info("old: " + oldExchange); >> LOG.info("new: " + newExchange); >> >> Message newIn = newExchange.getIn(); >> String oldBody = >> oldExchange.getIn().getBody(String.class); >> String newBody = newIn.getBody(String.class); >> newIn.setBody(oldBody + newBody); >> >> LOG.info("newly formed: " + newExchange); >> >> return newExchange; >> } >> >> >> } >> >> >> >> >> Stan Lewis-3 wrote: >>> >>> Can you post what you're doing in your aggregation strategy? >>> >>> On Fri, Jan 22, 2010 at 4:05 AM, lekkie wrote: Hi, I want to combine messages from 2 different exchanges into a single exchange, from the EIP patterns aggregation strategy seems to be right pattern to use. However, after reading the doc (http://camel.apache.org/aggregator.html), I followed the instructns but my aggregation strategy only returns the last exchange, even though I specifically configured it to send messages only when the outbatchsize is 2. I implemented a custom aggregationstrategy with shoulld combine my exchanges into one. I log the event in the class and it works fine, what is beyond me is why it returns only the last exchange. See my config here: >>> class="org.tempuri.MyAggregationStrategy"/> http://camel.apache.org/schema/spring"; trace="true"> http://services.locator/}Service:ServicesPort"/> true log:Response only print out response from >>> uri="nmr:{http://services.locator/}Service:ServicesPort"/>. Meanwhile, the log inside myStratRef (myAggregatorStrategy), which I ask to concatenate the old & new exchanges shows both exchanges were concatenated. How do I get this concatenated exchange to be sent (to log:Resposne)? Regards. -- View this message in context: http://old.nabble.com/Aggregator%27s-not-returning-co
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
> Which OS are you running? Could you write that down in the JIRA as well. I'm running Windows Vista Business Service Pack 2, 32 bit. I have put this in the Jira (#CAMEL-2394) https://issues.apache.org/activemq/browse/CAMEL-2394 -- View this message in context: http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27275060.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: FileConsumer move a file to wrong destination.
On Fri, Jan 22, 2010 at 4:24 PM, ariablu <962...@gmail.com> wrote: > > Next test, > test processor1 -> NG > test processor2 -> GOOD! > > "getOut()" breaks FileExchange data? > "newName" in GenericFileExpressionRenamer class is defferenet value each > test. > Ah that is your problem because you use getOut() which creates a totally new Message which forgets all about the previous one. You have to either replace data on IN (which is the easiest to do) Or copy from IN to OUT The getOut() has caused pain before and people should IMHO just stick to getIn() and manipulate that one. In the future we will rework the API a bit so Camel will detect this so when you do a getOut() it can safely copy the headers and whatnot. > [GenericFileExpressionRenamer] > String newName = expression.evaluate(exchange, String.class); > > > > [[processor1]] > package test.impl; > import org.apache.camel.Exchange; > import org.apache.camel.Processor; > public class Trans implements Processor { > public void process(Exchange exchange) throws Exception { > exchange.getOut().setHeader("operationNameSpace", > "http://pc.ws";); > exchange.getOut().setHeader("operationName", "echo"); > exchange.getOut().setBody(new Object[]{"A", "B"}); > } } > > [[processor2]] > package test.impl; > import org.apache.camel.Exchange; > import org.apache.camel.Processor; > public class Trans implements Processor { > public void process(Exchange exchange) throws Exception { > exchange.getIn().setHeader("operationNameSpace", > "http://pc.ws";); > exchange.getIn().setHeader("operationName", "echo"); > exchange.getIn().setBody(new Object[]{"A", "B"}); > } } > - > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Can you try using TRACE logging for this log name: >> org.apache.camel.component.file >> >> eg if using log4j then its: >> log4j.logger.org.apache.camel.component.file=TRACE >> >> The should be detailed info how the filename is being evaluated. >> Wonder if Windows got something mixed up with the path separators. >> >> >> On Fri, Jan 22, 2010 at 11:31 AM, ariablu <962...@gmail.com> wrote: >>> >>> Thank you for reply. >>> >>> Next try, >>> using Apache Camel camel-2.2-SNAPSHOT and Spring, >>> route: File -> Processor -> (cxf) -> Log >>> >>> When ... >>> /_work/test/from/1.txt >>> >>> If I run test case, 1.txt file was moved to >>> /_work/test/backup/20100122 (not directory!) >>> >>> But I want >>> /_work/test/backup/20100122/1.txt >>> >>> >>> [[test case]] >>> http://camel.apache.org/schema/spring";> >>> >> uri="file:c:\_work\test\from?delete=false&noop=false&move=../backup/${date:now:MMdd}/${file:name}"/> >>> >>> >>> >>> >>> >> uri="log:testlog?level=INFO&showExchangeId=true&showProperties=true&showBodyType=true&showBody=true&showOut=true&multiline=true&showHeaders=true"/> >>> >>> >>> >>> >>> [[test processor]](not changed) >>> >>> [[Log]] >>> DEBUG ProcessorEndpoint$1 - Starting producer: >>> Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] >>> DEBUG ProducerCache - Adding to producer cache with key: >>> Endpoint[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] >>> for producer: >>> Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] >>> DEBUG DefaultTypeConverter - Adding fallback type converter as a known >>> type >>> converter to convert from: java.lang.String to: java.lang.Object[] >>> INFO testlog - E
Re: FileConsumer move a file to wrong destination.
Next test, test processor1 -> NG test processor2 -> GOOD! "getOut()" breaks FileExchange data? "newName" in GenericFileExpressionRenamer class is defferenet value each test. [GenericFileExpressionRenamer] String newName = expression.evaluate(exchange, String.class); [[processor1]] package test.impl; import org.apache.camel.Exchange; import org.apache.camel.Processor; public class Trans implements Processor { public void process(Exchange exchange) throws Exception { exchange.getOut().setHeader("operationNameSpace", "http://pc.ws";); exchange.getOut().setHeader("operationName", "echo"); exchange.getOut().setBody(new Object[]{"A", "B"}); } } [[processor2]] package test.impl; import org.apache.camel.Exchange; import org.apache.camel.Processor; public class Trans implements Processor { public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader("operationNameSpace", "http://pc.ws";); exchange.getIn().setHeader("operationName", "echo"); exchange.getIn().setBody(new Object[]{"A", "B"}); } } - Claus Ibsen-2 wrote: > > Hi > > Can you try using TRACE logging for this log name: > org.apache.camel.component.file > > eg if using log4j then its: > log4j.logger.org.apache.camel.component.file=TRACE > > The should be detailed info how the filename is being evaluated. > Wonder if Windows got something mixed up with the path separators. > > > On Fri, Jan 22, 2010 at 11:31 AM, ariablu <962...@gmail.com> wrote: >> >> Thank you for reply. >> >> Next try, >> using Apache Camel camel-2.2-SNAPSHOT and Spring, >> route: File -> Processor -> (cxf) -> Log >> >> When ... >> /_work/test/from/1.txt >> >> If I run test case, 1.txt file was moved to >> /_work/test/backup/20100122 (not directory!) >> >> But I want >> /_work/test/backup/20100122/1.txt >> >> >> [[test case]] >> http://camel.apache.org/schema/spring";> >> > uri="file:c:\_work\test\from?delete=false&noop=false&move=../backup/${date:now:MMdd}/${file:name}"/> >> >> >> >> >> > uri="log:testlog?level=INFO&showExchangeId=true&showProperties=true&showBodyType=true&showBody=true&showOut=true&multiline=true&showHeaders=true"/> >> >> >> >> >> [[test processor]](not changed) >> >> [[Log]] >> DEBUG ProcessorEndpoint$1 - Starting producer: >> Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] >> DEBUG ProducerCache - Adding to producer cache with key: >> Endpoint[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] >> for producer: >> Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] >> DEBUG DefaultTypeConverter - Adding fallback type converter as a known >> type >> converter to convert from: java.lang.String to: java.lang.Object[] >> INFO testlog - Exchange[ >> , Id:308f8107-f7c1-4ec7-b2a9-9dff16b0cbd0 >> , >> Properties:{CamelToEndpoint=log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true, >> CamelBatchSize=1, CamelBatchComplete=true, >> CamelFileExchangeFile=GenericFile[c:\_work\test\from\1.txt], >> CamelBatchIndex=0, CamelFileLockName=c:\_work\test\from\1.txt.camelLock, >> CamelFileLock=c:\_work\test\from\1.txt.camelLock} >> , Headers:{operationNameSpace=http://pc.ws, operationName=echo} >> , BodyType:Object[] >> , Body:[Ljava.lang.Object;@674baa >> , Out: null] >> DEBUG GenericFileOnCompletion - Done processing file: >> GenericFile[c:\_work\test\from\1.txt] using exchange: >> Exchange[GenericFileMessage with body: [Ljava.lang.Object;@674baa] >> DEBUG FileUtil - Tried 1
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
On Fri, Jan 22, 2010 at 3:54 PM, Andy Bourke wrote: > > >> To use the log component you should just do >> > >> http://camel.apache.org/log.html > > Ok, I've got it now. However, sending the output to the log rather than the > file does not stop the rename issue. If it helps the actual error from the > trace log is: > > org.apache.camel.component.file.GenericFileOperationFailedException: Cannot > rename file: GenericFile[extract3.txt] to: GenericFile[\\.camel] > Which OS are you running? Could you write that down in the JIRA as well. > >> How do I create a ticket in Jira? I have never used it. >> > >> No problem we will get you up to speed. JIRA is used a lot in the OS >> world so you may as well start learning >> it to be able to submit bugs or requests for new features etc. > >> Support page here with link to Issue Tracker = JIRA >> http://camel.apache.org/support.html > >> You create an account and then there is a "create new issue button" on >> the "menu bar". > > Ok, I'll get right on it. > > >> >> >> Claus Ibsen-2 wrote: >>> >>> On Fri, Jan 22, 2010 at 2:47 PM, Claus Ibsen >>> wrote: On Fri, Jan 22, 2010 at 2:41 PM, Andy Bourke wrote: > > If I understand it right, the multicast allows the same payload to be > processed by multiple end points? If I remove the multicast then won't > the > second enpoint (in the now non-multicast pipeline) try to process the > output > from the first one? > Correct but just to see if the file gets renamed. Also try the multicast without parallel as well. >>> >>> Could you also try NOT to write to file in the multicast. Instead just >>> do a "log:foo". >>> >>> I suspect it interferes with the original file. >>> Which may also be a good time to spend the day coding to implement a >>> stack based file context >>> so they wont interfere each other. Will also fix the file -> pollEnrich >>> as >>> well. >>> >>> After your findings could you create a ticket in JIRA? And a link back >>> to this forum, eg find it from nabble. >>> After coming back from a business trip I should have to to work on this >>> issue. >>> >>> > > Claus Ibsen-2 wrote: >> >> On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke >> >> wrote: >>> >>> Hi all, >>> >>> I am new to camel and have hit a problem that I hope someone can help >>> me >>> with. >>> >>> I have a route that looks for a file in a directory => unmarshals the >>> file >>> using => transforms the output from the unmarshal (which is >>> List>) to a List of data objetcs => passes the List of >>> data >>> objects to a processor which does the intelligent mapping of the >>> input >>> data >>> to the output which is a List of Objects => passes the List of >>> Objects >>> to >>> a >>> pipeline who's endpoints traverse the List of Objects and >>> extract the data, that they are interested in, formatting the output >>> in >>> to a >>> List of Map objects so that the marshaller can marshal to a >>> named >>> file. >>> >>> This is the route: >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> >>> >>> >>> >> uri="bean:formatOutput?method=formatLineHeader"/> >>> >>> >>> >>> >> uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> >>> >>> >>> >>> >>> >>> As expected, I get a correctly formatted file named Txn_Header.txt >>> and >>> a >>> file named Line_Header.txt in the /outbound directory. So the routing >>> seems >>> to have worked fine. >>> >>> The problem is that the original file does not get renamed in to the >>> .camel >>> subdirectory and so the file gets processed again and again. >>> >>> If I remove the second endpoint in the multicast so that only the >>> Txn_Header.txt file is produced then the original file does get >>> renamed >>> and >>> the route ends successfully. >>> >> >> And with no mulitcast have you tried that? >> >> >>> Can someone help me understand what I have done wrong please? >>> >>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>>
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
> To use the log component you should just do > > http://camel.apache.org/log.html Ok, I've got it now. However, sending the output to the log rather than the file does not stop the rename issue. If it helps the actual error from the trace log is: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot rename file: GenericFile[extract3.txt] to: GenericFile[\\.camel] > How do I create a ticket in Jira? I have never used it. > > No problem we will get you up to speed. JIRA is used a lot in the OS > world so you may as well start learning > it to be able to submit bugs or requests for new features etc. > Support page here with link to Issue Tracker = JIRA > http://camel.apache.org/support.html > You create an account and then there is a "create new issue button" on > the "menu bar". Ok, I'll get right on it. > > > Claus Ibsen-2 wrote: >> >> On Fri, Jan 22, 2010 at 2:47 PM, Claus Ibsen >> wrote: >>> On Fri, Jan 22, 2010 at 2:41 PM, Andy Bourke >>> wrote: If I understand it right, the multicast allows the same payload to be processed by multiple end points? If I remove the multicast then won't the second enpoint (in the now non-multicast pipeline) try to process the output from the first one? >>> >>> Correct but just to see if the file gets renamed. >>> Also try the multicast without parallel as well. >>> >> >> Could you also try NOT to write to file in the multicast. Instead just >> do a "log:foo". >> >> I suspect it interferes with the original file. >> Which may also be a good time to spend the day coding to implement a >> stack based file context >> so they wont interfere each other. Will also fix the file -> pollEnrich >> as >> well. >> >> After your findings could you create a ticket in JIRA? And a link back >> to this forum, eg find it from nabble. >> After coming back from a business trip I should have to to work on this >> issue. >> >> >>> Claus Ibsen-2 wrote: > > On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke > > wrote: >> >> Hi all, >> >> I am new to camel and have hit a problem that I hope someone can help >> me >> with. >> >> I have a route that looks for a file in a directory => unmarshals the >> file >> using => transforms the output from the unmarshal (which is >> List>) to a List of data objetcs => passes the List of >> data >> objects to a processor which does the intelligent mapping of the >> input >> data >> to the output which is a List of Objects => passes the List of >> Objects >> to >> a >> pipeline who's endpoints traverse the List of Objects and >> extract the data, that they are interested in, formatting the output >> in >> to a >> List of Map objects so that the marshaller can marshal to a >> named >> file. >> >> This is the route: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> >> >> >> > uri="bean:formatOutput?method=formatLineHeader"/> >> >> >> >> > uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> >> >> >> >> >> >> As expected, I get a correctly formatted file named Txn_Header.txt >> and >> a >> file named Line_Header.txt in the /outbound directory. So the routing >> seems >> to have worked fine. >> >> The problem is that the original file does not get renamed in to the >> .camel >> subdirectory and so the file gets processed again and again. >> >> If I remove the second endpoint in the multicast so that only the >> Txn_Header.txt file is produced then the original file does get >> renamed >> and >> the route ends successfully. >> > > And with no mulitcast have you tried that? > > >> Can someone help me understand what I have done wrong please? >> >> >> >> -- >> View this message in context: >> http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > >
Re: Aggregator's not returning combined exchanges, only returns last exchange
Hmmm, I tested your aggregator code as-is on 2.2-SNAPSHOT here and it works fine: 2010-01-22 09:41:18,444 [0: Batch Sender] INFO JoinStringAggregatorTest - New: Exchange[Message: one] 2010-01-22 09:41:18,444 [0: Batch Sender] INFO JoinStringAggregatorTest - old: Exchange[Message: one] 2010-01-22 09:41:18,445 [0: Batch Sender] INFO JoinStringAggregatorTest - new: Exchange[Message: two] 2010-01-22 09:41:18,445 [0: Batch Sender] INFO JoinStringAggregatorTest - newly formed: Exchange[Message: onetwo] 2010-01-22 09:41:18,800 [0: Batch Sender] INFO AGGREGATION_RESULT - Exchange[BodyType:String, Body:onetwo] What version are you running there, can you try the latest snapshot? On Fri, Jan 22, 2010 at 8:39 AM, lekkie wrote: > > See code below: > > package org.tempuri; > > import org.apache.camel.Exchange; > import org.apache.camel.Header; > import org.apache.camel.Message; > import org.apache.camel.processor.aggregate.AggregationStrategy; > import org.apache.commons.logging.Log; > import org.apache.commons.logging.LogFactory; > > public class MyAggregationStrategy implements AggregationStrategy { > > private static final transient Log LOG = > LogFactory.getLog(MyAggregationStrategy.class); > > public Exchange aggregate(Exchange oldExchange, Exchange newExchange) > { > > if (oldExchange == null) > { > LOG.info("old is null only new available"); > LOG.info("New: " + newExchange); > return newExchange; > } > > LOG.info("old: " + oldExchange); > LOG.info("new: " + newExchange); > > Message newIn = newExchange.getIn(); > String oldBody = oldExchange.getIn().getBody(String.class); > String newBody = newIn.getBody(String.class); > newIn.setBody(oldBody + newBody); > > LOG.info("newly formed: " + newExchange); > > return newExchange; > } > > > } > > > > > Stan Lewis-3 wrote: >> >> Can you post what you're doing in your aggregation strategy? >> >> On Fri, Jan 22, 2010 at 4:05 AM, lekkie wrote: >>> >>> Hi, >>> >>> I want to combine messages from 2 different exchanges into a single >>> exchange, from the EIP patterns aggregation strategy seems to be right >>> pattern to use. >>> >>> However, after reading the doc (http://camel.apache.org/aggregator.html), >>> I >>> followed the instructns but my aggregation strategy only returns the last >>> exchange, even though I specifically configured it to send messages only >>> when the outbatchsize is 2. >>> >>> I implemented a custom aggregationstrategy with shoulld combine my >>> exchanges >>> into one. I log the event in the class and it works fine, what is beyond >>> me >>> is why it returns only the last exchange. >>> >>> >>> See my config here: >>> >> class="org.tempuri.MyAggregationStrategy"/> >>> >>> http://camel.apache.org/schema/spring"; >>> trace="true"> >>> >>> >>> >>> >>> >>> >>> http://services.locator/}Service:ServicesPort"/> >>> >>> >>> >>> >>> >>> >>> >>> true >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> log:Response only print out response from >> uri="nmr:{http://services.locator/}Service:ServicesPort"/>. >>> >>> Meanwhile, the log inside myStratRef (myAggregatorStrategy), which I ask >>> to >>> concatenate the old & new exchanges shows both exchanges were >>> concatenated. >>> How do I get this concatenated exchange to be sent (to log:Resposne)? >>> >>> Regards. >>> -- >>> View this message in context: >>> http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27270355.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> > > -- > View this message in context: > http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27273231.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
On Fri, Jan 22, 2010 at 3:27 PM, Andy Bourke wrote: > > Please excuse my ignorance Claus, but I don't know what "log:foo" means, I > have tried using it as you have written but I get an exception: > > org.xml.sax.SAXParseException: The prefix "log" for element "log:info" is > not bound > To use the log component you should just do http://camel.apache.org/log.html > I have tried without using parallelProcessing="true" and the problem > remains. > Okay thanks. Not a race condition then. > How do I create a ticket in Jira? I have never used it. > No problem we will get you up to speed. JIRA is used a lot in the OS world so you may as well start learning it to be able to submit bugs or requests for new features etc. Support page here with link to Issue Tracker = JIRA http://camel.apache.org/support.html You create an account and then there is a "create new issue button" on the "menu bar". > > > Claus Ibsen-2 wrote: >> >> On Fri, Jan 22, 2010 at 2:47 PM, Claus Ibsen >> wrote: >>> On Fri, Jan 22, 2010 at 2:41 PM, Andy Bourke >>> wrote: If I understand it right, the multicast allows the same payload to be processed by multiple end points? If I remove the multicast then won't the second enpoint (in the now non-multicast pipeline) try to process the output from the first one? >>> >>> Correct but just to see if the file gets renamed. >>> Also try the multicast without parallel as well. >>> >> >> Could you also try NOT to write to file in the multicast. Instead just >> do a "log:foo". >> >> I suspect it interferes with the original file. >> Which may also be a good time to spend the day coding to implement a >> stack based file context >> so they wont interfere each other. Will also fix the file -> pollEnrich as >> well. >> >> After your findings could you create a ticket in JIRA? And a link back >> to this forum, eg find it from nabble. >> After coming back from a business trip I should have to to work on this >> issue. >> >> >>> Claus Ibsen-2 wrote: > > On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke > > wrote: >> >> Hi all, >> >> I am new to camel and have hit a problem that I hope someone can help >> me >> with. >> >> I have a route that looks for a file in a directory => unmarshals the >> file >> using => transforms the output from the unmarshal (which is >> List>) to a List of data objetcs => passes the List of >> data >> objects to a processor which does the intelligent mapping of the input >> data >> to the output which is a List of Objects => passes the List of Objects >> to >> a >> pipeline who's endpoints traverse the List of Objects and >> extract the data, that they are interested in, formatting the output >> in >> to a >> List of Map objects so that the marshaller can marshal to a >> named >> file. >> >> This is the route: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> >> >> >> > uri="bean:formatOutput?method=formatLineHeader"/> >> >> >> >> > uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> >> >> >> >> >> >> As expected, I get a correctly formatted file named Txn_Header.txt and >> a >> file named Line_Header.txt in the /outbound directory. So the routing >> seems >> to have worked fine. >> >> The problem is that the original file does not get renamed in to the >> .camel >> subdirectory and so the file gets processed again and again. >> >> If I remove the second endpoint in the multicast so that only the >> Txn_Header.txt file is produced then the original file does get >> renamed >> and >> the route ends successfully. >> > > And with no mulitcast have you tried that? > > >> Can someone help me understand what I have done wrong please? >> >> >> >> -- >> View this message in context: >> http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http:/
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
Please excuse my ignorance Claus, but I don't know what "log:foo" means, I have tried using it as you have written but I get an exception: org.xml.sax.SAXParseException: The prefix "log" for element "log:info" is not bound I have tried without using parallelProcessing="true" and the problem remains. How do I create a ticket in Jira? I have never used it. Claus Ibsen-2 wrote: > > On Fri, Jan 22, 2010 at 2:47 PM, Claus Ibsen > wrote: >> On Fri, Jan 22, 2010 at 2:41 PM, Andy Bourke >> wrote: >>> >>> If I understand it right, the multicast allows the same payload to be >>> processed by multiple end points? If I remove the multicast then won't >>> the >>> second enpoint (in the now non-multicast pipeline) try to process the >>> output >>> from the first one? >>> >> >> Correct but just to see if the file gets renamed. >> Also try the multicast without parallel as well. >> > > Could you also try NOT to write to file in the multicast. Instead just > do a "log:foo". > > I suspect it interferes with the original file. > Which may also be a good time to spend the day coding to implement a > stack based file context > so they wont interfere each other. Will also fix the file -> pollEnrich as > well. > > After your findings could you create a ticket in JIRA? And a link back > to this forum, eg find it from nabble. > After coming back from a business trip I should have to to work on this > issue. > > >> >>> >>> Claus Ibsen-2 wrote: On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke wrote: > > Hi all, > > I am new to camel and have hit a problem that I hope someone can help > me > with. > > I have a route that looks for a file in a directory => unmarshals the > file > using => transforms the output from the unmarshal (which is > List>) to a List of data objetcs => passes the List of > data > objects to a processor which does the intelligent mapping of the input > data > to the output which is a List of Objects => passes the List of Objects > to > a > pipeline who's endpoints traverse the List of Objects and > extract the data, that they are interested in, formatting the output > in > to a > List of Map objects so that the marshaller can marshal to a > named > file. > > This is the route: > > > > > > > > > > > > > > > uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> > > > uri="bean:formatOutput?method=formatLineHeader"/> > > > > uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> > > > > > > As expected, I get a correctly formatted file named Txn_Header.txt and > a > file named Line_Header.txt in the /outbound directory. So the routing > seems > to have worked fine. > > The problem is that the original file does not get renamed in to the > .camel > subdirectory and so the file gets processed again and again. > > If I remove the second endpoint in the multicast so that only the > Txn_Header.txt file is produced then the original file does get > renamed > and > the route ends successfully. > And with no mulitcast have you tried that? > Can someone help me understand what I have done wrong please? > > > > -- > View this message in context: > http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27273273.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration:
Re: FTP Component - How to Disconnect?
Hi everybody, Thank you all for the light-speed-like response! Cheers, Gunnar Claus Ibsen wrote: Hi I have created the ticket https://issues.apache.org/activemq/browse/CAMEL-2391 And also implemented this new feature. There is a new option disconnect=true which will disconnect from the remote ftp server right after use. It can be used on both the consumer or producer side. Will be in the next Camel 2.2 release, which is due next month. On Fri, Jan 22, 2010 at 6:23 AM, Claus Ibsen wrote: On Thu, Jan 21, 2010 at 10:02 PM, Christian Müller wrote: Hey Gunnar, you are right. At present, we disconnect only after a failed write/upload from the server. Currently you have no choice to configure a session disconnect after a write. @Claus: Should Gunnar open a JIRA ticket for that or won't we change this? +1 to open a ticket in JIRA. Regards, Christian On Thu, Jan 21, 2010 at 6:46 PM, Gunnar Hillert wrote: Hi, I am creating a simple flow uploading files using FTP and FTPs. Here is the process definition: I drop a file in a folder, Camel picks it up and uploads it to the server. Everything works perfectly. My problem is that I would like to disconnect from the FTP server (terminate session) every time a file is uploaded. It seems though that the connection to the FTP server is kept open. Thus, if I drop a new file into my monitored folder the same FTP session is reused. I would like that not to happen. How can I configure my camel process to disconnect from the FTP Server? I did not find any information on this. Thanks a lot for your help! Regards Gunnar -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
On Fri, Jan 22, 2010 at 2:47 PM, Claus Ibsen wrote: > On Fri, Jan 22, 2010 at 2:41 PM, Andy Bourke > wrote: >> >> If I understand it right, the multicast allows the same payload to be >> processed by multiple end points? If I remove the multicast then won't the >> second enpoint (in the now non-multicast pipeline) try to process the output >> from the first one? >> > > Correct but just to see if the file gets renamed. > Also try the multicast without parallel as well. > Could you also try NOT to write to file in the multicast. Instead just do a "log:foo". I suspect it interferes with the original file. Which may also be a good time to spend the day coding to implement a stack based file context so they wont interfere each other. Will also fix the file -> pollEnrich as well. After your findings could you create a ticket in JIRA? And a link back to this forum, eg find it from nabble. After coming back from a business trip I should have to to work on this issue. > >> >> Claus Ibsen-2 wrote: >>> >>> On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke >>> wrote: Hi all, I am new to camel and have hit a problem that I hope someone can help me with. I have a route that looks for a file in a directory => unmarshals the file using => transforms the output from the unmarshal (which is List>) to a List of data objetcs => passes the List of data objects to a processor which does the intelligent mapping of the input data to the output which is a List of Objects => passes the List of Objects to a pipeline who's endpoints traverse the List of Objects and extract the data, that they are interested in, formatting the output in to a List of Map objects so that the marshaller can marshal to a named file. This is the route: >>> uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> >>> uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> As expected, I get a correctly formatted file named Txn_Header.txt and a file named Line_Header.txt in the /outbound directory. So the routing seems to have worked fine. The problem is that the original file does not get renamed in to the .camel subdirectory and so the file gets processed again and again. If I remove the second endpoint in the multicast so that only the Txn_Header.txt file is produced then the original file does get renamed and the route ends successfully. >>> >>> And with no mulitcast have you tried that? >>> >>> Can someone help me understand what I have done wrong please? -- View this message in context: http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Author of Camel in Action: http://www.manning.com/ibsen/ >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> >>> >> >> -- >> View this message in context: >> http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27273273.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
On Fri, Jan 22, 2010 at 2:41 PM, Andy Bourke wrote: > > If I understand it right, the multicast allows the same payload to be > processed by multiple end points? If I remove the multicast then won't the > second enpoint (in the now non-multicast pipeline) try to process the output > from the first one? > Correct but just to see if the file gets renamed. Also try the multicast without parallel as well. > > Claus Ibsen-2 wrote: >> >> On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke >> wrote: >>> >>> Hi all, >>> >>> I am new to camel and have hit a problem that I hope someone can help me >>> with. >>> >>> I have a route that looks for a file in a directory => unmarshals the >>> file >>> using => transforms the output from the unmarshal (which is >>> List>) to a List of data objetcs => passes the List of data >>> objects to a processor which does the intelligent mapping of the input >>> data >>> to the output which is a List of Objects => passes the List of Objects to >>> a >>> pipeline who's endpoints traverse the List of Objects and >>> extract the data, that they are interested in, formatting the output in >>> to a >>> List of Map objects so that the marshaller can marshal to a named >>> file. >>> >>> This is the route: >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >>> >> uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> >>> >>> >>> >>> >>> >>> >>> >> uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> >>> >>> >>> >>> >>> >>> As expected, I get a correctly formatted file named Txn_Header.txt and a >>> file named Line_Header.txt in the /outbound directory. So the routing >>> seems >>> to have worked fine. >>> >>> The problem is that the original file does not get renamed in to the >>> .camel >>> subdirectory and so the file gets processed again and again. >>> >>> If I remove the second endpoint in the multicast so that only the >>> Txn_Header.txt file is produced then the original file does get renamed >>> and >>> the route ends successfully. >>> >> >> And with no mulitcast have you tried that? >> >> >>> Can someone help me understand what I have done wrong please? >>> >>> >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27273273.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
If I understand it right, the multicast allows the same payload to be processed by multiple end points? If I remove the multicast then won't the second enpoint (in the now non-multicast pipeline) try to process the output from the first one? Claus Ibsen-2 wrote: > > On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke > wrote: >> >> Hi all, >> >> I am new to camel and have hit a problem that I hope someone can help me >> with. >> >> I have a route that looks for a file in a directory => unmarshals the >> file >> using => transforms the output from the unmarshal (which is >> List>) to a List of data objetcs => passes the List of data >> objects to a processor which does the intelligent mapping of the input >> data >> to the output which is a List of Objects => passes the List of Objects to >> a >> pipeline who's endpoints traverse the List of Objects and >> extract the data, that they are interested in, formatting the output in >> to a >> List of Map objects so that the marshaller can marshal to a named >> file. >> >> This is the route: >> >> >> >> >> >> >> >> >> >> >> >> >> >> >> > uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> >> >> >> >> >> >> >> > uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> >> >> >> >> >> >> As expected, I get a correctly formatted file named Txn_Header.txt and a >> file named Line_Header.txt in the /outbound directory. So the routing >> seems >> to have worked fine. >> >> The problem is that the original file does not get renamed in to the >> .camel >> subdirectory and so the file gets processed again and again. >> >> If I remove the second endpoint in the multicast so that only the >> Txn_Header.txt file is produced then the original file does get renamed >> and >> the route ends successfully. >> > > And with no mulitcast have you tried that? > > >> Can someone help me understand what I have done wrong please? >> >> >> >> -- >> View this message in context: >> http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > > -- View this message in context: http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27273273.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Aggregator's not returning combined exchanges, only returns last exchange
See code below: package org.tempuri; import org.apache.camel.Exchange; import org.apache.camel.Header; import org.apache.camel.Message; import org.apache.camel.processor.aggregate.AggregationStrategy; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; public class MyAggregationStrategy implements AggregationStrategy { private static final transient Log LOG = LogFactory.getLog(MyAggregationStrategy.class); public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (oldExchange == null) { LOG.info("old is null only new available"); LOG.info("New: " + newExchange); return newExchange; } LOG.info("old: " + oldExchange); LOG.info("new: " + newExchange); Message newIn = newExchange.getIn(); String oldBody = oldExchange.getIn().getBody(String.class); String newBody = newIn.getBody(String.class); newIn.setBody(oldBody + newBody); LOG.info("newly formed: " + newExchange); return newExchange; } } Stan Lewis-3 wrote: > > Can you post what you're doing in your aggregation strategy? > > On Fri, Jan 22, 2010 at 4:05 AM, lekkie wrote: >> >> Hi, >> >> I want to combine messages from 2 different exchanges into a single >> exchange, from the EIP patterns aggregation strategy seems to be right >> pattern to use. >> >> However, after reading the doc (http://camel.apache.org/aggregator.html), >> I >> followed the instructns but my aggregation strategy only returns the last >> exchange, even though I specifically configured it to send messages only >> when the outbatchsize is 2. >> >> I implemented a custom aggregationstrategy with shoulld combine my >> exchanges >> into one. I log the event in the class and it works fine, what is beyond >> me >> is why it returns only the last exchange. >> >> >> See my config here: >> > class="org.tempuri.MyAggregationStrategy"/> >> >> http://camel.apache.org/schema/spring"; >> trace="true"> >> >> >> >> >> >> >> http://services.locator/}Service:ServicesPort"/> >> >> >> >> >> >> >> >> true >> >> >> >> >> >> >> >> >> >> >> >> log:Response only print out response from > uri="nmr:{http://services.locator/}Service:ServicesPort"/>. >> >> Meanwhile, the log inside myStratRef (myAggregatorStrategy), which I ask >> to >> concatenate the old & new exchanges shows both exchanges were >> concatenated. >> How do I get this concatenated exchange to be sent (to log:Resposne)? >> >> Regards. >> -- >> View this message in context: >> http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27270355.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > -- View this message in context: http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27273231.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Renamer failing to rename 'From' File when using multiple endpoints via Multicast
On Fri, Jan 22, 2010 at 1:20 PM, Andy Bourke wrote: > > Hi all, > > I am new to camel and have hit a problem that I hope someone can help me > with. > > I have a route that looks for a file in a directory => unmarshals the file > using => transforms the output from the unmarshal (which is > List>) to a List of data objetcs => passes the List of data > objects to a processor which does the intelligent mapping of the input data > to the output which is a List of Objects => passes the List of Objects to a > pipeline who's endpoints traverse the List of Objects and > extract the data, that they are interested in, formatting the output in to a > List of Map objects so that the marshaller can marshal to a named > file. > > This is the route: > > > > > > > > > > > > > > > uri="file:/data/iq/outbound/?fileName=Txn_Header.txt"/> > > > > > > > uri="file:/data/iq/outbound/?fileName=Line_Header.txt"/> > > > > > > As expected, I get a correctly formatted file named Txn_Header.txt and a > file named Line_Header.txt in the /outbound directory. So the routing seems > to have worked fine. > > The problem is that the original file does not get renamed in to the .camel > subdirectory and so the file gets processed again and again. > > If I remove the second endpoint in the multicast so that only the > Txn_Header.txt file is produced then the original file does get renamed and > the route ends successfully. > And with no mulitcast have you tried that? > Can someone help me understand what I have done wrong please? > > > > -- > View this message in context: > http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: FileConsumer move a file to wrong destination.
Hi Can you try using TRACE logging for this log name: org.apache.camel.component.file eg if using log4j then its: log4j.logger.org.apache.camel.component.file=TRACE The should be detailed info how the filename is being evaluated. Wonder if Windows got something mixed up with the path separators. On Fri, Jan 22, 2010 at 11:31 AM, ariablu <962...@gmail.com> wrote: > > Thank you for reply. > > Next try, > using Apache Camel camel-2.2-SNAPSHOT and Spring, > route: File -> Processor -> (cxf) -> Log > > When ... > /_work/test/from/1.txt > > If I run test case, 1.txt file was moved to > /_work/test/backup/20100122 (not directory!) > > But I want > /_work/test/backup/20100122/1.txt > > > [[test case]] > http://camel.apache.org/schema/spring";> > uri="file:c:\_work\test\from?delete=false&noop=false&move=../backup/${date:now:MMdd}/${file:name}"/> > > > > > uri="log:testlog?level=INFO&showExchangeId=true&showProperties=true&showBodyType=true&showBody=true&showOut=true&multiline=true&showHeaders=true"/> > > > > > [[test processor]](not changed) > > [[Log]] > DEBUG ProcessorEndpoint$1 - Starting producer: > Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] > DEBUG ProducerCache - Adding to producer cache with key: > Endpoint[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] > for producer: > Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] > DEBUG DefaultTypeConverter - Adding fallback type converter as a known type > converter to convert from: java.lang.String to: java.lang.Object[] > INFO testlog - Exchange[ > , Id:308f8107-f7c1-4ec7-b2a9-9dff16b0cbd0 > , > Properties:{CamelToEndpoint=log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true, > CamelBatchSize=1, CamelBatchComplete=true, > CamelFileExchangeFile=GenericFile[c:\_work\test\from\1.txt], > CamelBatchIndex=0, CamelFileLockName=c:\_work\test\from\1.txt.camelLock, > CamelFileLock=c:\_work\test\from\1.txt.camelLock} > , Headers:{operationNameSpace=http://pc.ws, operationName=echo} > , BodyType:Object[] > , Body:[Ljava.lang.Object;@674baa > , Out: null] > DEBUG GenericFileOnCompletion - Done processing file: > GenericFile[c:\_work\test\from\1.txt] using exchange: > Exchange[GenericFileMessage with body: [Ljava.lang.Object;@674baa] > DEBUG FileUtil - Tried 1 to delete file: c:\_work\test\from\1.txt.camelLock > with result: true > DEBUG GenericFileRenameProcessStrategy - Renaming file: > GenericFile[c:\_work\test\from\1.txt] to: GenericFile[..\backup\20100122] > DEBUG FileUtil - Tried 1 to rename file: c:\_work\test\from\1.txt to: > c:\_work\test\from\..\backup\20100122 with result: true > > > > Thanks! > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Could you try with 2.2-SNAPSHOT ? >> >> It is a bit odd since Camel should pickup .done as a relative directly >> and not as a absolute filename. >> >> You can also try to use >> move=.done/${file:name} >> >> Which should be what Camel translates .done to under the covers. >> >> >> >> On Thu, Jan 21, 2010 at 5:08 PM, ariablu <962...@gmail.com> wrote: >>> >>> using Apache Camel 2.1 and Spring, >>> route: File -> Processor -> (cxf) -> Log >>> >>> When ... >>> /_work/test/from/1.txt >>> >>> if I run test case, 1.txt file was moved to >>> /_work/test/from/.done (not directory!) >>> >>> But I want >>> /_work/test/from/.done/1.txt >>> >>> >>> [[test case]] >>> http://camel.apache.org/schema/spring";> >>> >> uri="file:C:\_work\test\from?delete=false&noop=false&move=.done"/> >>> >>> >>> >>> >>> >> uri="log:testlog?level=INFO&showExchangeId=true&showPr
Re: HTTP parameter bug (was passing the HTTPServletRequest from Jetty to a SEDA consumer in Spring DSL)
Hi Wayne, I commit a patch of CAMEL-2386, please check out the last camel-2.2-SNAPSHOT to verify it :) Willem Willem Jiang wrote: I just did a quick test on camel trunk, you can get the URL parameters by using the exchange.getIn().getHeader(Exchange.HTTP_QUERY) When you post the binary data with URI Query. I just took a look at camel-http and found we could parser the URL parameter for the post method. So I created a JIRA[1] and will submit a quick fix for it. [1] https://issues.apache.org/activemq/browse/CAMEL-2386 Willem
Re: Aggregator's not returning combined exchanges, only returns last exchange
Can you post what you're doing in your aggregation strategy? On Fri, Jan 22, 2010 at 4:05 AM, lekkie wrote: > > Hi, > > I want to combine messages from 2 different exchanges into a single > exchange, from the EIP patterns aggregation strategy seems to be right > pattern to use. > > However, after reading the doc (http://camel.apache.org/aggregator.html), I > followed the instructns but my aggregation strategy only returns the last > exchange, even though I specifically configured it to send messages only > when the outbatchsize is 2. > > I implemented a custom aggregationstrategy with shoulld combine my exchanges > into one. I log the event in the class and it works fine, what is beyond me > is why it returns only the last exchange. > > > See my config here: > > > http://camel.apache.org/schema/spring"; > trace="true"> > > > > > > > http://services.locator/}Service:ServicesPort"/> > > > > > > > > true > > > > > > > > > > > > log:Response only print out response from uri="nmr:{http://services.locator/}Service:ServicesPort"/>. > > Meanwhile, the log inside myStratRef (myAggregatorStrategy), which I ask to > concatenate the old & new exchanges shows both exchanges were concatenated. > How do I get this concatenated exchange to be sent (to log:Resposne)? > > Regards. > -- > View this message in context: > http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27270355.html > Sent from the Camel - Users mailing list archive at Nabble.com. > >
Renamer failing to rename 'From' File when using multiple endpoints via Multicast
Hi all, I am new to camel and have hit a problem that I hope someone can help me with. I have a route that looks for a file in a directory => unmarshals the file using => transforms the output from the unmarshal (which is List>) to a List of data objetcs => passes the List of data objects to a processor which does the intelligent mapping of the input data to the output which is a List of Objects => passes the List of Objects to a pipeline who's endpoints traverse the List of Objects and extract the data, that they are interested in, formatting the output in to a List of Map objects so that the marshaller can marshal to a named file. This is the route: As expected, I get a correctly formatted file named Txn_Header.txt and a file named Line_Header.txt in the /outbound directory. So the routing seems to have worked fine. The problem is that the original file does not get renamed in to the .camel subdirectory and so the file gets processed again and again. If I remove the second endpoint in the multicast so that only the Txn_Header.txt file is produced then the original file does get renamed and the route ends successfully. Can someone help me understand what I have done wrong please? -- View this message in context: http://old.nabble.com/Renamer-failing-to-rename-%27From%27-File-when-using-multiple-endpoints-via-Multicast-tp27272407p27272407.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Jetty Security Handler
On Fri, Jan 22, 2010 at 10:29 AM, SwenVogel wrote: > > Hi, > > i use the send() method of the producer template, like in the code snippet > from the first post. > > Means "Custom OnCompletion is triggered when you use a route." that when > i use a standard component for example "file" that the > GenericFileOnCompletion is triggered? > > I thought that a component is like a encapsulated logical unit but it seems > that the internal > semantic changes when i use a route or the ProducerTemplate. It's a little > bit confusing. > > For example when i write a component that must do some important kind of > cleanup > after processing, this cleanup must be done regardless whether i use a route > or a > ProducerTemplate. > > Is there a way to manually trigger the OnCompletitions's? > You can always manually invoke it Synchronization onComp = ... Exchange result = template.send(); comp.onComplete(result); > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Do you send directly to the endpoint of your custom component? >> Custom OnCompletion is triggered when you use a route. >> >> >> >> On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel >> wrote: >>> >>> Hi, >>> >>> i created a customer jetty security handler and configured the spring >>> configuration file accordingly. >>> In the security handler i use my own "exec" camel component for the >>> authentication. >>> >>> In short my "exec" component can executes external programs and makes use >>> of >>> the >>> apache-commons-exec library. >>> >>> The problem is that the OnCompletition's are not called. When is use the >>> component >>> in other routes everything works fine. >>> >>> Here is the code from my "exec" producer that adds the OnCompletition: >>> exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO)); >>> >>> >>> Here the security handler code: >>> >>> String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args=" >>> + username + ";" >>> + credentials; >>> >>> ProducerTemplate template = camelContext.createProducerTemplate(); >>> Exchange result = template.send(authEndpoint, new >>> DefaultExchange(camelContext)); >>> >>> Integer exitCode = result.getOut().getHeader( >>> ExecComponent.EXEC_EXITCODE, Integer.class); >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://old.nabble.com/Jetty-Security-Handler-tp27259580p27270602.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: FileConsumer move a file to wrong destination.
Thank you for reply. Next try, using Apache Camel camel-2.2-SNAPSHOT and Spring, route: File -> Processor -> (cxf) -> Log When ... /_work/test/from/1.txt If I run test case, 1.txt file was moved to /_work/test/backup/20100122 (not directory!) But I want /_work/test/backup/20100122/1.txt [[test case]] http://camel.apache.org/schema/spring";> [[test processor]](not changed) [[Log]] DEBUG ProcessorEndpoint$1 - Starting producer: Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] DEBUG ProducerCache - Adding to producer cache with key: Endpoint[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] for producer: Producer[log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true] DEBUG DefaultTypeConverter - Adding fallback type converter as a known type converter to convert from: java.lang.String to: java.lang.Object[] INFO testlog - Exchange[ , Id:308f8107-f7c1-4ec7-b2a9-9dff16b0cbd0 , Properties:{CamelToEndpoint=log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&showOut=true&showProperties=true, CamelBatchSize=1, CamelBatchComplete=true, CamelFileExchangeFile=GenericFile[c:\_work\test\from\1.txt], CamelBatchIndex=0, CamelFileLockName=c:\_work\test\from\1.txt.camelLock, CamelFileLock=c:\_work\test\from\1.txt.camelLock} , Headers:{operationNameSpace=http://pc.ws, operationName=echo} , BodyType:Object[] , Body:[Ljava.lang.Object;@674baa , Out: null] DEBUG GenericFileOnCompletion - Done processing file: GenericFile[c:\_work\test\from\1.txt] using exchange: Exchange[GenericFileMessage with body: [Ljava.lang.Object;@674baa] DEBUG FileUtil - Tried 1 to delete file: c:\_work\test\from\1.txt.camelLock with result: true DEBUG GenericFileRenameProcessStrategy - Renaming file: GenericFile[c:\_work\test\from\1.txt] to: GenericFile[..\backup\20100122] DEBUG FileUtil - Tried 1 to rename file: c:\_work\test\from\1.txt to: c:\_work\test\from\..\backup\20100122 with result: true Thanks! Claus Ibsen-2 wrote: > > Hi > > Could you try with 2.2-SNAPSHOT ? > > It is a bit odd since Camel should pickup .done as a relative directly > and not as a absolute filename. > > You can also try to use > move=.done/${file:name} > > Which should be what Camel translates .done to under the covers. > > > > On Thu, Jan 21, 2010 at 5:08 PM, ariablu <962...@gmail.com> wrote: >> >> using Apache Camel 2.1 and Spring, >> route: File -> Processor -> (cxf) -> Log >> >> When ... >> /_work/test/from/1.txt >> >> if I run test case, 1.txt file was moved to >> /_work/test/from/.done (not directory!) >> >> But I want >> /_work/test/from/.done/1.txt >> >> >> [[test case]] >> http://camel.apache.org/schema/spring";> >> > uri="file:C:\_work\test\from?delete=false&noop=false&move=.done"/> >> >> >> >> >> > uri="log:testlog?level=INFO&showExchangeId=true&showProperties=true&showBodyType=true&showBody=true&showOut=true&multiline=true&showHeaders=true"/> >> >> >> >> >> [[test processor]] >> package test.impl; >> import org.apache.camel.Exchange; >> import org.apache.camel.Processor; >> public class Trans implements Processor { >> public void process(Exchange exchange) throws Exception { >> exchange.getOut().setHeader("operationNameSpace", >> "http://pc.ws";); >> exchange.getOut().setHeader("operationName", "echo"); >> exchange.getOut().setBody(new Object[]{"A", "B"}); >> } } >> >> [[Log]] >> INFO testlog - Exchange[ >> , Id:ffa13059-6465-4bb0-b9ca-8de545c50618 >> , >> Properties:{CamelToEndpoint=log://testlog?level=INFO&multiline=true&showBody=true&showBodyType=true&showExchangeId=true&showHeaders=true&s
Re: Jetty Security Handler
On Fri, Jan 22, 2010 at 10:29 AM, SwenVogel wrote: > > Hi, > > i use the send() method of the producer template, like in the code snippet > from the first post. > > Means "Custom OnCompletion is triggered when you use a route." that when > i use a standard component for example "file" that the > GenericFileOnCompletion is triggered? > > I thought that a component is like a encapsulated logical unit but it seems > that the internal > semantic changes when i use a route or the ProducerTemplate. It's a little > bit confusing. > All the cross cutting functions such as interceptors, on completion, on exception is route based. Camel does a lot of stuff when building routes which allows it to weave in those cross cutting stuff at the right places etc. You can add some custom completion to your component if its important for your component that it does some cleanup etc. > For example when i write a component that must do some important kind of > cleanup > after processing, this cleanup must be done regardless whether i use a route > or a > ProducerTemplate. > > Is there a way to manually trigger the OnCompletitions's? > No, you can however use the asyncXXXCallback method from producer template which offers on completion callbacks > > > Claus Ibsen-2 wrote: >> >> Hi >> >> Do you send directly to the endpoint of your custom component? >> Custom OnCompletion is triggered when you use a route. >> >> >> >> On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel >> wrote: >>> >>> Hi, >>> >>> i created a customer jetty security handler and configured the spring >>> configuration file accordingly. >>> In the security handler i use my own "exec" camel component for the >>> authentication. >>> >>> In short my "exec" component can executes external programs and makes use >>> of >>> the >>> apache-commons-exec library. >>> >>> The problem is that the OnCompletition's are not called. When is use the >>> component >>> in other routes everything works fine. >>> >>> Here is the code from my "exec" producer that adds the OnCompletition: >>> exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO)); >>> >>> >>> Here the security handler code: >>> >>> String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args=" >>> + username + ";" >>> + credentials; >>> >>> ProducerTemplate template = camelContext.createProducerTemplate(); >>> Exchange result = template.send(authEndpoint, new >>> DefaultExchange(camelContext)); >>> >>> Integer exitCode = result.getOut().getHeader( >>> ExecComponent.EXEC_EXITCODE, Integer.class); >>> >>> -- >>> View this message in context: >>> http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html >>> Sent from the Camel - Users mailing list archive at Nabble.com. >>> >>> >> >> >> >> -- >> Claus Ibsen >> Apache Camel Committer >> >> Author of Camel in Action: http://www.manning.com/ibsen/ >> Open Source Integration: http://fusesource.com >> Blog: http://davsclaus.blogspot.com/ >> Twitter: http://twitter.com/davsclaus >> >> > > -- > View this message in context: > http://old.nabble.com/Jetty-Security-Handler-tp27259580p27270602.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Jetty Security Handler
Hi, i use the send() method of the producer template, like in the code snippet from the first post. Means "Custom OnCompletion is triggered when you use a route." that when i use a standard component for example "file" that the GenericFileOnCompletion is triggered? I thought that a component is like a encapsulated logical unit but it seems that the internal semantic changes when i use a route or the ProducerTemplate. It's a little bit confusing. For example when i write a component that must do some important kind of cleanup after processing, this cleanup must be done regardless whether i use a route or a ProducerTemplate. Is there a way to manually trigger the OnCompletitions's? Claus Ibsen-2 wrote: > > Hi > > Do you send directly to the endpoint of your custom component? > Custom OnCompletion is triggered when you use a route. > > > > On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel > wrote: >> >> Hi, >> >> i created a customer jetty security handler and configured the spring >> configuration file accordingly. >> In the security handler i use my own "exec" camel component for the >> authentication. >> >> In short my "exec" component can executes external programs and makes use >> of >> the >> apache-commons-exec library. >> >> The problem is that the OnCompletition's are not called. When is use the >> component >> in other routes everything works fine. >> >> Here is the code from my "exec" producer that adds the OnCompletition: >> exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO)); >> >> >> Here the security handler code: >> >> String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args=" >> + username + ";" >> + credentials; >> >> ProducerTemplate template = camelContext.createProducerTemplate(); >> Exchange result = template.send(authEndpoint, new >> DefaultExchange(camelContext)); >> >> Integer exitCode = result.getOut().getHeader( >> ExecComponent.EXEC_EXITCODE, Integer.class); >> >> -- >> View this message in context: >> http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html >> Sent from the Camel - Users mailing list archive at Nabble.com. >> >> > > > > -- > Claus Ibsen > Apache Camel Committer > > Author of Camel in Action: http://www.manning.com/ibsen/ > Open Source Integration: http://fusesource.com > Blog: http://davsclaus.blogspot.com/ > Twitter: http://twitter.com/davsclaus > > -- View this message in context: http://old.nabble.com/Jetty-Security-Handler-tp27259580p27270602.html Sent from the Camel - Users mailing list archive at Nabble.com.
Aggregator's not returning combined exchanges, only returns last exchange
Hi, I want to combine messages from 2 different exchanges into a single exchange, from the EIP patterns aggregation strategy seems to be right pattern to use. However, after reading the doc (http://camel.apache.org/aggregator.html), I followed the instructns but my aggregation strategy only returns the last exchange, even though I specifically configured it to send messages only when the outbatchsize is 2. I implemented a custom aggregationstrategy with shoulld combine my exchanges into one. I log the event in the class and it works fine, what is beyond me is why it returns only the last exchange. See my config here: http://camel.apache.org/schema/spring"; trace="true"> http://services.locator/}Service:ServicesPort"/> true log:Response only print out response from http://services.locator/}Service:ServicesPort"/>. Meanwhile, the log inside myStratRef (myAggregatorStrategy), which I ask to concatenate the old & new exchanges shows both exchanges were concatenated. How do I get this concatenated exchange to be sent (to log:Resposne)? Regards. -- View this message in context: http://old.nabble.com/Aggregator%27s-not-returning-combined-exchanges%2C-only-returns-last-exchange-tp27270355p27270355.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-quickfix example
Hi Get the attention of Charles Moulliard as he works on that component and with FIX etc. On Thu, Jan 21, 2010 at 12:03 PM, beat glattfelder wrote: > > Hey camel riders > > I have tried the PassivefixGateway example in the test source, but it did > not behave as expected. Though it's supposed route async responses back to > the client it simply wont. Looking at the source, I reckon this behavior is > by design, since the Processor registered with the "quickfix-client" > endpoint simply logs the message. > How can one configure the route in the example to relay back messages > through up the route - or am I missing something? > > Thanks a lot > > -- > View this message in context: > http://old.nabble.com/camel-quickfix-example-tp27256088p27256088.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Jetty Security Handler
Hi Do you send directly to the endpoint of your custom component? Custom OnCompletion is triggered when you use a route. On Thu, Jan 21, 2010 at 4:30 PM, SwenVogel wrote: > > Hi, > > i created a customer jetty security handler and configured the spring > configuration file accordingly. > In the security handler i use my own "exec" camel component for the > authentication. > > In short my "exec" component can executes external programs and makes use of > the > apache-commons-exec library. > > The problem is that the OnCompletition's are not called. When is use the > component > in other routes everything works fine. > > Here is the code from my "exec" producer that adds the OnCompletition: > exchange.addOnCompletion(new ExecOnCompletition(endpoint, processIO)); > > > Here the security handler code: > > String authEndpoint = "exec:authProg?dir=c:/&exitValues=0;1&args=" > + username + ";" > + credentials; > > ProducerTemplate template = camelContext.createProducerTemplate(); > Exchange result = template.send(authEndpoint, new > DefaultExchange(camelContext)); > > Integer exitCode = result.getOut().getHeader( > ExecComponent.EXEC_EXITCODE, Integer.class); > > -- > View this message in context: > http://old.nabble.com/Jetty-Security-Handler-tp27259580p27259580.html > Sent from the Camel - Users mailing list archive at Nabble.com. > > -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Aggregator's old Exchange returns null
Thanks. lekkie wrote: > > I have a custom aggregator set up. The custom aggregator combines the > exchanges of an old and new one and returns them as one. > > However, when I log the old exchange to the ESB log file, it returns null. > > See my snippet below > > . > > > > > > > >uri="nmr:{http://services.locator/}ServicesService:ServicesPort"/> > > > > > > > >outBatchSize="2"> > > > > > > what could b d prob? > -- View this message in context: http://old.nabble.com/Aggregator%27s-old-Exchange-returns-null-tp27247326p27270248.html Sent from the Camel - Users mailing list archive at Nabble.com.