AW: How to programatically add a route to ClassPathXmlApplicationContext?
I would try to let Spring inject the CamelContext into my class. There you could add your routes. @Autowired CamelContext ctx; public void init() { ctx.addRoutes(new RouteBuilder() { public void configure() { from(...) ... } }); } Jan -Ursprüngliche Nachricht- Von: bonnahu [mailto:bonn...@gmail.com] Gesendet: Donnerstag, 15. August 2013 05:33 An: users@camel.apache.org Betreff: How to programatically add a route to ClassPathXmlApplicationContext? Hi everyone, I want to add a new route to an ClassPathXmlApplicationContext programatically. Like the code below, after the springContext is created, can we add a new route to the springContext? Is there a solution? String filename = META-INF/spring/camel-context.xml; AbstractXmlApplicationContext springContext = new ClassPathXmlApplicationContext(filename); thanks in advance! -- View this message in context: http://camel.465427.n5.nabble.com/How-to- programatically-add-a-route-to-ClassPathXmlApplicationContext- tp5737288.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Mina Synchronous Communication
Can you share your decoder? What version do you use? Best, Christian Am 14.08.2013 08:14 schrieb milltj mil...@drop-tank.com: I have a client application that sends messages via a socket. For each message it sends it requires a response. I have setup the Mina2 component with a custom decoder to receive the messages. This works when I have the following in my camel-context.xml camel:route camel:from uri=mina2:tcp://10.5.60.60:9000?codec=#myDecoder / camel:bean ref=OutputProcessor/ /camel:route However, if I change the from route to include sync=true I get an error. camel:route camel:from uri=mina2:tcp://10.5.60.60:9000?sync=true;codec=#myDecoder / camel:bean ref=OutputProcessor/ /camel:route Error: org.apache.mina.filter.codec.ProtocolDecoderException: org.apache.mina.core.buffer.BufferDataException: dataLength: 1347375948 Not sure why exactly it is doing this. Am I doing something wrong? - Tim -- View this message in context: http://camel.465427.n5.nabble.com/Mina-Synchronous-Communication-tp5737223.html Sent from the Camel - Users mailing list archive at Nabble.com.
SetHeader thread ( route) safety !!?
Hi , I have two route A and B , route A process message for ftp point and push it to AMQ queue after attaching actionId as header , route B pull that message and continue the processing as bellow : route id=A from uri=ftp process ref=doStuff / setHeader headerName=actionId constant101/constant /setHeader log message=${header.actionId}/ to uri=JMS/ /route route id=B from uri=JMS/ setHeader headerName=actionId constant202/constant /setHeader log message=${header.actionId}/ process ref=doAnotherStuff / /route The result is random , for individual message processing ,things run as expected, but in load test where many messages submitted and two route run concurrently,randomly header value are mixed, route A actionId header value populated with route B header value and sometimes route B header value populated with route A header value A header value ! any idea ? camel 2.11.0 AMQ 6.8 - Othman Darwish ProgressSoft Corp. -- View this message in context: http://camel.465427.n5.nabble.com/SetHeader-thread-route-safety-tp5737302.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to check that a file is empty
My original code that has been working for 2-3 years looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); interceptFrom().when(emptyFile).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * For some reason, when using Camel 2.11.0, the above code causes all files to be skipped (even the non-empty ones). I have found another way of doing this that works with Camel 2.11.0. It looks as follows: * interceptFrom().when(header(CamelFileLength).isEqualTo(0)).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * I'm not sure what is happening. Since I have a workaround I'm OK but it seems like the behaviour of the SimpleLanguage has changed somehow. Could be a bug or at least something worth documenting. Any thoughts? /Bengt 2013/8/14 Bengt Rodehav be...@rodehav.com Thanks for the tip. It would probably be good enough although I also want to move the empty files to a dedicated directory to clearly show what took place. Do you know f the syntax for checking the file length has changed in Simple language (or rather File language)? Looking at the documentation I can't see that I'm doing anything wrong. /Bengt 2013/8/14 Claus Ibsen claus.ib...@gmail.com See also the readLockMinLength option On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav be...@rodehav.com wrote: I have recently upgraded Camel to version 2.11.0. In my file transfer services I have used a predicate together with interceptors to avoid transferring empty files but instead move them into a subfolder called skipped. However, this has stopped working. My predicate looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); * I'm not exactly sure in what version this functionality broke but I'm sure it worked in version 2.7.1. Is there a better way to do this in Camel 2.11.0? /Bengt -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
ExchangePatterns ?
Hey there, I've been playing around with the different ExchangePatterns but couldn't figure out 100% how they work. I'm assuming that ExchangePatterns are set on a Exchange based level. But during my investigation on the message headers I couldn't find the property for the ExchangePattern (I examined the message headers using AMQ Webconsole so I'm only 99% sure I got so see them all). I can also rule out Route based level because I examined the routes using JConsole and couldn't find any reference to ExchangePattern. Assuming they are set on a Exchange I'm wondering why I can't change the them in different routes. I'm trying to do something like this: route from uri=jetty:http://0.0.0.0:9000/test/ setExchangePattern pattern=InOnly/ to uri=activemq:in_http_1d3329c4-e516-4ac6-b086-c9d696f21208 / /route route from uri=activemq:in_http_1d3329c4-e516-4ac6-b086-c9d696f21208/ setExchangePattern pattern=InOut/ setHeader headerName=CamelHttpMethod constantPOST/constant /setHeader to uri=https://posttestserver.com/post.php/ to uri=activemq:in_http_af1f4dea-8299-4132-8640-1fa29234945c/ /route route from uri=activemq:in_http_af1f4dea-8299-4132-8640-1fa29234945c/ to uri=file:/tmp/results?autoCreate=trueamp;charset=utf-8amp;fileExist=Override/ /route I expose a Jetty http endpoint where people can post to, they don't care about the response just sending back a 200 is fine here. That's why I use the In Only exchange pattern works fine. Now the next route I'm posting to another http service but in contrary to the first route I want to capture the response and pass it on. Since the ExchangePattern is set on an Exchange I would assume setting it back to default InOut would enable me to capture the http response. However that's not the case! I'm confused over here, could anybody explain to me if I'm right? Or could suggest another solution to my problem? Niels Stevens -- View this message in context: http://camel.465427.n5.nabble.com/ExchangePatterns-tp5737308.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: ExchangePatterns ?
Hi, for an explanation about exchange pattern have a look here: http://camel.apache.org/request-reply.html first of all I would set the exchange pattern as an argument on the to-element cause I think that makes the routes much more readable. Nevertheless I cannot find an error at your implementation. are you sure the HTTP POST method gives back a response? you may explain your problem in more detail. consider using the tracer to see whats happening in your route. regards, Marco Am 15.08.2013 11:14, schrieb Niels: Hey there, I've been playing around with the different ExchangePatterns but couldn't figure out 100% how they work. I'm assuming that ExchangePatterns are set on a Exchange based level. But during my investigation on the message headers I couldn't find the property for the ExchangePattern (I examined the message headers using AMQ Webconsole so I'm only 99% sure I got so see them all). I can also rule out Route based level because I examined the routes using JConsole and couldn't find any reference to ExchangePattern. Assuming they are set on a Exchange I'm wondering why I can't change the them in different routes. I'm trying to do something like this: route from uri=jetty:http://0.0.0.0:9000/test/ setExchangePattern pattern=InOnly/ to uri=activemq:in_http_1d3329c4-e516-4ac6-b086-c9d696f21208 / /route route from uri=activemq:in_http_1d3329c4-e516-4ac6-b086-c9d696f21208/ setExchangePattern pattern=InOut/ setHeader headerName=CamelHttpMethod constantPOST/constant /setHeader to uri=https://posttestserver.com/post.php/ to uri=activemq:in_http_af1f4dea-8299-4132-8640-1fa29234945c/ /route route from uri=activemq:in_http_af1f4dea-8299-4132-8640-1fa29234945c/ to uri=file:/tmp/results?autoCreate=trueamp;charset=utf-8amp;fileExist=Override/ /route I expose a Jetty http endpoint where people can post to, they don't care about the response just sending back a 200 is fine here. That's why I use the In Only exchange pattern works fine. Now the next route I'm posting to another http service but in contrary to the first route I want to capture the response and pass it on. Since the ExchangePattern is set on an Exchange I would assume setting it back to default InOut would enable me to capture the http response. However that's not the case! I'm confused over here, could anybody explain to me if I'm right? Or could suggest another solution to my problem? Niels Stevens -- View this message in context: http://camel.465427.n5.nabble.com/ExchangePatterns-tp5737308.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to check that a file is empty
Hi This is because you use the simple language wrong as you create an expression, and NOT a predicate. I have logged a ticket to improve on this, so you have static methods to easily create a predicate https://issues.apache.org/jira/browse/CAMEL-6639 On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav be...@rodehav.com wrote: My original code that has been working for 2-3 years looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); interceptFrom().when(emptyFile).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * For some reason, when using Camel 2.11.0, the above code causes all files to be skipped (even the non-empty ones). I have found another way of doing this that works with Camel 2.11.0. It looks as follows: * interceptFrom().when(header(CamelFileLength).isEqualTo(0)).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * I'm not sure what is happening. Since I have a workaround I'm OK but it seems like the behaviour of the SimpleLanguage has changed somehow. Could be a bug or at least something worth documenting. Any thoughts? /Bengt 2013/8/14 Bengt Rodehav be...@rodehav.com Thanks for the tip. It would probably be good enough although I also want to move the empty files to a dedicated directory to clearly show what took place. Do you know f the syntax for checking the file length has changed in Simple language (or rather File language)? Looking at the documentation I can't see that I'm doing anything wrong. /Bengt 2013/8/14 Claus Ibsen claus.ib...@gmail.com See also the readLockMinLength option On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav be...@rodehav.com wrote: I have recently upgraded Camel to version 2.11.0. In my file transfer services I have used a predicate together with interceptors to avoid transferring empty files but instead move them into a subfolder called skipped. However, this has stopped working. My predicate looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); * I'm not exactly sure in what version this functionality broke but I'm sure it worked in version 2.7.1. Is there a better way to do this in Camel 2.11.0? /Bengt -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
RE: How can FTP Component connect to FTP Server via GXS Proxy
Hi, are you talking about the GXS box FTP Server from http://www.gxs.com/? I wasted some time to get the connection to GXS FTP working. Their ftp server uses a slightly different protocol called GMark III. To get the files downloaded you have to send the correct gmark III commands on the protocol channel. I did this using a bean not with the ftp component. Regards Martin -- View this message in context: http://camel.465427.n5.nabble.com/How-can-FTP-Component-connect-to-FTP-Server-via-GXS-Proxy-tp5713818p5737316.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: ExchangePatterns ?
Thanks for the reply ;) It triggered me to enable tracing then I found the solution. Apperently when you have 2 http endpoints the exchange The consuming http endpoint would set the Exchange.HTTP_URI header and the producing http endpoint would use that URL instead of the URL defined on the component itself. I needed to set the bridgeEndpoint to true on the producing endpoint which solved my problem. Thanks Niels Stevens -- View this message in context: http://camel.465427.n5.nabble.com/ExchangePatterns-tp5737308p5737317.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to check that a file is empty
Thanks Claus. I do believe that the PredicateBuilder.toPredicate method I use does take an expression as a parameter and returns a Predicate. Which method should I have used? /Bengt 2013/8/15 Claus Ibsen claus.ib...@gmail.com Hi This is because you use the simple language wrong as you create an expression, and NOT a predicate. I have logged a ticket to improve on this, so you have static methods to easily create a predicate https://issues.apache.org/jira/browse/CAMEL-6639 On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav be...@rodehav.com wrote: My original code that has been working for 2-3 years looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); interceptFrom().when(emptyFile).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * For some reason, when using Camel 2.11.0, the above code causes all files to be skipped (even the non-empty ones). I have found another way of doing this that works with Camel 2.11.0. It looks as follows: * interceptFrom().when(header(CamelFileLength).isEqualTo(0)).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * I'm not sure what is happening. Since I have a workaround I'm OK but it seems like the behaviour of the SimpleLanguage has changed somehow. Could be a bug or at least something worth documenting. Any thoughts? /Bengt 2013/8/14 Bengt Rodehav be...@rodehav.com Thanks for the tip. It would probably be good enough although I also want to move the empty files to a dedicated directory to clearly show what took place. Do you know f the syntax for checking the file length has changed in Simple language (or rather File language)? Looking at the documentation I can't see that I'm doing anything wrong. /Bengt 2013/8/14 Claus Ibsen claus.ib...@gmail.com See also the readLockMinLength option On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav be...@rodehav.com wrote: I have recently upgraded Camel to version 2.11.0. In my file transfer services I have used a predicate together with interceptors to avoid transferring empty files but instead move them into a subfolder called skipped. However, this has stopped working. My predicate looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); * I'm not exactly sure in what version this functionality broke but I'm sure it worked in version 2.7.1. Is there a better way to do this in Camel 2.11.0? /Bengt -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: How to check that a file is empty
There should be non static methods on simple language to create a predicate. On Thu, Aug 15, 2013 at 1:43 PM, Bengt Rodehav be...@rodehav.com wrote: Thanks Claus. I do believe that the PredicateBuilder.toPredicate method I use does take an expression as a parameter and returns a Predicate. Which method should I have used? /Bengt 2013/8/15 Claus Ibsen claus.ib...@gmail.com Hi This is because you use the simple language wrong as you create an expression, and NOT a predicate. I have logged a ticket to improve on this, so you have static methods to easily create a predicate https://issues.apache.org/jira/browse/CAMEL-6639 On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav be...@rodehav.com wrote: My original code that has been working for 2-3 years looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); interceptFrom().when(emptyFile).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * For some reason, when using Camel 2.11.0, the above code causes all files to be skipped (even the non-empty ones). I have found another way of doing this that works with Camel 2.11.0. It looks as follows: * interceptFrom().when(header(CamelFileLength).isEqualTo(0)).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * I'm not sure what is happening. Since I have a workaround I'm OK but it seems like the behaviour of the SimpleLanguage has changed somehow. Could be a bug or at least something worth documenting. Any thoughts? /Bengt 2013/8/14 Bengt Rodehav be...@rodehav.com Thanks for the tip. It would probably be good enough although I also want to move the empty files to a dedicated directory to clearly show what took place. Do you know f the syntax for checking the file length has changed in Simple language (or rather File language)? Looking at the documentation I can't see that I'm doing anything wrong. /Bengt 2013/8/14 Claus Ibsen claus.ib...@gmail.com See also the readLockMinLength option On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav be...@rodehav.com wrote: I have recently upgraded Camel to version 2.11.0. In my file transfer services I have used a predicate together with interceptors to avoid transferring empty files but instead move them into a subfolder called skipped. However, this has stopped working. My predicate looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); * I'm not exactly sure in what version this functionality broke but I'm sure it worked in version 2.7.1. Is there a better way to do this in Camel 2.11.0? /Bengt -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Why can not get the data
Do you just need an Http server for unit testing? Maybe take a look at the class HttpTestServer.java in this directory in Git: https://fisheye6.atlassian.com/browse/camel-git/tests/camel-itest/src/test/java/org/apache/camel/itest/http On Wed, Aug 14, 2013 at 11:01 PM, yiwang imawan...@gmail.com wrote: I rewrite code is as follows: public class TestHttpCamel { private Main main; public static void main(String args[]) throws Exception { TestHttpCamel example = new TestHttpCamel(); example.boot(); } public void boot() throws Exception { main = new Main(); main.enableHangupSupport(); main.addRouteBuilder(new RouteBuilder() { public void configure() { from(http://localhost:8080/wms/query_all_handlover_note?type=source;) .to(file:d:/temp/outbox?fileName=data.txt); } }); main.run(); } } still not get the data.I have direct access to http://localhost:8080/wms/query_all_handlover_note? Type = source,can obtain the json data. The HTTP routing write wrong or need what configuration? -- View this message in context: http://camel.465427.n5.nabble.com/Why-can-not-get-the-data-tp5737243p5737285.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to check that a file is empty
OK - thanks. /Bengt 2013/8/15 Claus Ibsen claus.ib...@gmail.com There should be non static methods on simple language to create a predicate. On Thu, Aug 15, 2013 at 1:43 PM, Bengt Rodehav be...@rodehav.com wrote: Thanks Claus. I do believe that the PredicateBuilder.toPredicate method I use does take an expression as a parameter and returns a Predicate. Which method should I have used? /Bengt 2013/8/15 Claus Ibsen claus.ib...@gmail.com Hi This is because you use the simple language wrong as you create an expression, and NOT a predicate. I have logged a ticket to improve on this, so you have static methods to easily create a predicate https://issues.apache.org/jira/browse/CAMEL-6639 On Thu, Aug 15, 2013 at 9:49 AM, Bengt Rodehav be...@rodehav.com wrote: My original code that has been working for 2-3 years looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); interceptFrom().when(emptyFile).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * For some reason, when using Camel 2.11.0, the above code causes all files to be skipped (even the non-empty ones). I have found another way of doing this that works with Camel 2.11.0. It looks as follows: * interceptFrom().when(header(CamelFileLength).isEqualTo(0)).setHeader(recipient).simple(file://${file:parent}/skipped/${date:now:MMdd}).recipientList(header(recipient)).stop(); * I'm not sure what is happening. Since I have a workaround I'm OK but it seems like the behaviour of the SimpleLanguage has changed somehow. Could be a bug or at least something worth documenting. Any thoughts? /Bengt 2013/8/14 Bengt Rodehav be...@rodehav.com Thanks for the tip. It would probably be good enough although I also want to move the empty files to a dedicated directory to clearly show what took place. Do you know f the syntax for checking the file length has changed in Simple language (or rather File language)? Looking at the documentation I can't see that I'm doing anything wrong. /Bengt 2013/8/14 Claus Ibsen claus.ib...@gmail.com See also the readLockMinLength option On Wed, Aug 14, 2013 at 4:26 PM, Bengt Rodehav be...@rodehav.com wrote: I have recently upgraded Camel to version 2.11.0. In my file transfer services I have used a predicate together with interceptors to avoid transferring empty files but instead move them into a subfolder called skipped. However, this has stopped working. My predicate looks like this: *Predicate emptyFile = PredicateBuilder.toPredicate(SimpleLanguage.simple(${file:length} == 0)); * I'm not exactly sure in what version this functionality broke but I'm sure it worked in version 2.7.1. Is there a better way to do this in Camel 2.11.0? /Bengt -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
wireTap: how to put a map in newExchangeBody?
hello, I have a map with two entries which I would like to use as the new body in a wireTap .wireTap(log:foo).newExchangeBody(myMap).end() I managed doing this by writing a custom Expression, but there must be an easier way of doing this? .newExchangeBody(new Expression() { @Override public T T evaluate(Exchange exchange, ClassT type) { MapString, String newBody = new HashMap(); newBody.put(supplier, (String)exchange.getIn().getHeader(supplierName)); newBody.put(status, started); return exchange.getContext().getTypeConverter().convertTo(type, exchange, newBody); }}) any suggestions would be highly appreciated! cheers, pj -- View this message in context: http://camel.465427.n5.nabble.com/wireTap-how-to-put-a-map-in-newExchangeBody-tp5737340.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: wireTap: how to put a map in newExchangeBody?
.wireTap(log:foo).newExchangeBody(constant(myMap)).end() On Thu, Aug 15, 2013 at 4:01 PM, PJ Walstroem walst...@hotmail.com wrote: hello, I have a map with two entries which I would like to use as the new body in a wireTap .wireTap(log:foo).newExchangeBody(myMap).end() I managed doing this by writing a custom Expression, but there must be an easier way of doing this? .newExchangeBody(new Expression() { @Override public T T evaluate(Exchange exchange, ClassT type) { MapString, String newBody = new HashMap(); newBody.put(supplier, (String)exchange.getIn().getHeader(supplierName)); newBody.put(status, started); return exchange.getContext().getTypeConverter().convertTo(type, exchange, newBody); }}) any suggestions would be highly appreciated! cheers, pj -- View this message in context: http://camel.465427.n5.nabble.com/wireTap-how-to-put-a-map-in-newExchangeBody-tp5737340.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Where can I find an example of specifying a custom resequence comparator in Spring
Try the unit tests of camel-spring On Wed, Aug 14, 2013 at 5:37 PM, bocamel johnz...@gmail.com wrote: I try to keep all my routes in Spring, but I cannot find any example about how to define the following in Spring: .resequence(header(seqnum)).stream().capacity(500).timeout(1).comparator(myComparator) or .resequence(header(seqnum)).stream(myConfig) where myComparator is a custom ExpressionResultComparator and myConfig is a custom StreamResequencerConfig. The online Spring XML examples that I can find do not include custom comparator and config. I would greatly appreciate it if someone can point me to an example. Thanks in advance for any help! -- View this message in context: http://camel.465427.n5.nabble.com/Where-can-I-find-an-example-of-specifying-a-custom-resequence-comparator-in-Spring-tp5737262.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: wireTap: how to put a map in newExchangeBody?
great, thank you :-) -- View this message in context: http://camel.465427.n5.nabble.com/wireTap-how-to-put-a-map-in-newExchangeBody-tp5737340p5737343.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SJMS component and IBM WebsphereMQ class cast error
Created JIRA CAMEL-6641 and attached a patch -- View this message in context: http://camel.465427.n5.nabble.com/SJMS-component-and-IBM-WebsphereMQ-class-cast-error-tp5737010p5737345.html Sent from the Camel - Users mailing list archive at Nabble.com.
Consuming Excel File with consumer template
Hi All, Can some one help me in using excel file with consumer template. I am trying it with a simple route for testing: route id=Generic-Supply-test from uri=timer://foo?fixedRate=trueamp;period=3000 / setHeader headerName=comsumerUrlsimplefile:${properties:inbound_home}/pgsl?include=SOCGEN_2Records.xls/simple/setHeader to uri=bean:locatesConsumer?method=consumeFile / to uri=bean:excelParser?method=convertExcelToDelimited / /route and locatesConsumer.consume excel file as: public void consumeFile(Exchange ex) { String endPointUri=ex.getIn().getHeader(comsumerUrl, String.class); Object body=consumer.receiveBody(endPointUri, 2000,Object.class); if (body != null) { ex.getIn().setBody(body); } } Here the file is being polled and body is set to exchange but when I try to cast it to byste array stream it throws exception: Error while reading excel fileError during type conversion from type: org.apache.camel.component.file.GenericFile to the required type: byte[] with value GenericFile[/home/pgsl/SOCGEN_2Records.XLS] due java.io.FileNotFoundException: /home/pgsl/SOCGEN_2Records.XLS (No such file or directory) My code for convert it to byte stream is as follows: public void convertExcelToDelimited(Exchange ex) { try { byte[] b = ex.getIn().getBody(byte[].class); InputStream in = new ByteArrayInputStream(b); } } Please help if anyone knows the answer. Thanks, Sanjeev -- View this message in context: http://camel.465427.n5.nabble.com/Consuming-Excel-File-with-consumer-template-tp5737346.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Creating then starting a JMS consumer around another component
This is a common pattern I've seen before. It's not practical to have persistent queues/topics with each update to the database table being stored due to the transient nature of the consumer population (number of consumers is variable and their liveliness has no pattern). As Mark points out you need to subscribe to updates, buffer them, get the current 'view of the world' from the authoritative source (ie the database) and then let the updates flow in - potentially discarding duplicates at the start which were already in the image due to the timing. So in camel how can we start a 'route' so that it registers the subscription but 'pause' it whilst we get the table? It seems like we might need three routes and some funky 'on/off' tap logic. I don't see an EIP that supports this. Nigel -- View this message in context: http://camel.465427.n5.nabble.com/Creating-then-starting-a-JMS-consumer-around-another-component-tp5736955p5737347.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Consuming Excel File with consumer template
For those who have the same issue I like to share the information that : I get rid of this bug by using this line InputStream body =consumer.receiveBody(endPointUri,2000,InputStream.class); and changing correspondingly on the ExcelParser class. thanks, -- View this message in context: http://camel.465427.n5.nabble.com/Consuming-Excel-File-with-consumer-template-tp5737346p5737348.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SetHeader thread ( route) safety !!?
I cannot believe it. Can you provide an unit test which show this issue? Best, Christian - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Thu, Aug 15, 2013 at 9:38 AM, Darwish othman.darw...@progressoft.comwrote: Hi , I have two route A and B , route A process message for ftp point and push it to AMQ queue after attaching actionId as header , route B pull that message and continue the processing as bellow : route id=A from uri=ftp process ref=doStuff / setHeader headerName=actionId constant101/constant /setHeader log message=${header.actionId}/ to uri=JMS/ /route route id=B from uri=JMS/ setHeader headerName=actionId constant202/constant /setHeader log message=${header.actionId}/ process ref=doAnotherStuff / /route The result is random , for individual message processing ,things run as expected, but in load test where many messages submitted and two route run concurrently,randomly header value are mixed, route A actionId header value populated with route B header value and sometimes route B header value populated with route A header value A header value ! any idea ? camel 2.11.0 AMQ 6.8 - Othman Darwish ProgressSoft Corp. -- View this message in context: http://camel.465427.n5.nabble.com/SetHeader-thread-route-safety-tp5737302.html Sent from the Camel - Users mailing list archive at Nabble.com.
Need help trying to pull from paged web api
I am a newbie to Camel and am trying to set up Camel route(s) to tackle this situation. I want to update a local database with records that are made available through a web API and periodically pull in new records to the database. Unfortunately, the only API to access the records is a paged API where all records are available from newest to oldest. The web API takes offset and length parameters to specify where to offset into the list and how many records to return, which it returns as XML. So the logic, needs to be that I start at an offset of zero and load pages of records until I get to a record that I already have in my database (determined by the record ID). In the case of an initial load I would keep loading pages until there is no more data (determined by getting an empty result back). Once I have all the new records I need to put them into the database as one DB transaction. I understand the pieces to schedule routes, and to actually do html call to get back the XML results, but am struggling how to handle the looping nature of the task. I want to do the job as much as possible in camel. Any suggestions would be appreciated -- Dale King
Re: Can´t send mail using gmail smtp server using caml smtps component = javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection?
The following test works for me: package org.apache.camel.component.mail; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; public class GMailProducerTest extends CamelTestSupport { @Test public void testProduer() throws Exception { getMockEndpoint(mock:result).expectedMessageCount(1); template.sendBodyAndHeader(direct:start, Message , To, firstname.lastn...@gmail.com); assertMockEndpointsSatisfied(); } @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { public void configure() throws Exception { from(direct:start) .to(smtps:// smtp.gmail.com:465?username=firstname.lastn...@gmail.compassword=*debugMode=true, mock:result); } }; } } Best, Christian - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Mon, Aug 12, 2013 at 10:43 PM, silviolucasfilho slpere...@hotmail.comwrote: I´m using the mail component to send an email usign gmail as relay and I receive the following error all the time: Caused by: javax.mail.MessagingException: Could not connect to SMTP host: smtp.gmail.com, port: 587; nested exception is: javax.net.ssl.SSLException: Unrecognized SSL message, plaintext connection? at com.sun.mail.smtp.SMTPTransport.openServer(SMTPTransport.java:1972) [mail-1.4.5-redhat-1.jar:1.4.5-redhat-1] I´m using the following route configuration (I´m using DSL route configuration): from(START_INSTALLER) .log( Init Installer.) .to(bean:installRoles?method=installAdmin) .to(bean:installRoles?method=installUser) .to(bean:installRootUser?method=installRoot) .to(smtps:// smtp.gmail.com:587?username=te...@gmail.compassword=testedebugMode=trueto=${body.email}mail.smtp.starttls.enable=true ) .log( End Route.); Can anybody help-me? -- View this message in context: http://camel.465427.n5.nabble.com/Can-t-send-mail-using-gmail-smtp-server-using-caml-smtps-component-javax-net-ssl-SSLException-Unreco-tp5737177.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to add Vendor Specific Optional Parameter in CamelSmppOptionalParameters
I'm afraid this is not possible right now, but it could be added. Feel free to log a JIRA and I will work on a patch. Best, Christian - Software Integration Specialist Apache Camel committer: https://camel.apache.org/team V.P. Apache Camel: https://www.apache.org/foundation/ Apache Member: https://www.apache.org/foundation/members.html https://www.linkedin.com/pub/christian-mueller/11/551/642 On Wed, Aug 14, 2013 at 10:35 PM, cartoondog cartoon...@hotmail.com wrote: I am new to Apache Camel and trying to use its SMPP component to send sms to SMSC. However, the smsc vendor needs me to specify the operator id (i.e. mobile phone carrier id) in the smpp optional parameters header with a tag identifier 0x2150 which falls inside the range of SMSC Vendor specific optional parameters as per SMPP 3.4 specification. I am almost done in building the system except this very last part. Hope someone can show me the way to complete the task. Thank you very much in advance -- View this message in context: http://camel.465427.n5.nabble.com/How-to-add-Vendor-Specific-Optional-Parameter-in-CamelSmppOptionalParameters-tp5737268.html Sent from the Camel - Users mailing list archive at Nabble.com.
MTOM message part not formatted correctly according to RFC 1341 using CRLFLF instead of CRLFCRLF
A .Net WCF client is throwing a parsing error on the MTOM message returned from our Camel endpoint. Looking at the message sent by Camel in WireShark, we see the header part is preceded by ”CRLFLF”, ”--”, ”boundary”, instead of ”CRLF”, ”--”, ”boundary”, which is not according to the RFC 1341 specification: - http://www.w3.org/Protocols/rfc1341/0_TableOfContents.html - http://www.w3.org/Protocols/rfc1341/7_2_Multipart.html Is this a known issue in Apache Camel or is there another explanation? Thanks, Clay -- View this message in context: http://camel.465427.n5.nabble.com/MTOM-message-part-not-formatted-correctly-according-to-RFC-1341-using-CRLFLF-instead-of-CRLFCRLF-tp5737366.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Why can not get the data
hi: I have direct access to http://localhost:8080/wms/query_all_handlover_note?type=source;. Can get the json data.I may not need an Http server for unit testing.I download the HttpTestServer.java,but have errors.If you feel the need,so how should I import which packages, normal operation of the HttpTestServer.java? Thank you. -- View this message in context: http://camel.465427.n5.nabble.com/Why-can-not-get-the-data-tp5737243p5737367.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Why can not get the data
Hi: Add the corresponding jar package. Before the code changes for main.addRouteBuilder(new RouteBuilder() { public void configure() { from(jetty://http://localhost:8080/wms/query_all_handlover_note?type=source;) .to(file:d:/temp/outbox?fileName=data.txt); } }); ,other remains the same. still not get the data.I don't know where is my write wrong or what's the problem. Did you see that you get the json data from the server and then stored in the file in a simple example? Thank you -- View this message in context: http://camel.465427.n5.nabble.com/Why-can-not-get-the-data-tp5737243p5737368.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Why can not get the data
began to visit http://localhost:8080/wms/query_all_handlover_note?type=source; ,The results are shown: {total:1,rows:[{id:51,noteNo:43a43d88-4f7f-4364-ad22-cd2076964d7a,from_entry_type:dd,from_entry_no:dd,storage_name:dianlan,model_number:d1,number:ed,unit:d,entry_date:2013-08-14 15:45:25}]} Can get the json data from the server. Then run the program. I have no intention to Visit the url again.there is an error,the following: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot write null body to file: d:\temp\outbox\data.txt How is the problem? -- View this message in context: http://camel.465427.n5.nabble.com/Why-can-not-get-the-data-tp5737243p5737369.html Sent from the Camel - Users mailing list archive at Nabble.com.