Polling consumer does not stop when pollStrategy specified
I have as follows. I want to stop it, modify and start it. from('file://D:/temp/20130801/inbound?pollStrategy=#errorHandlerService') .routeId(routeId) .to(stream:out) My pollStrategy looks like: class ErrorHandlerService extends DefaultPollingConsumerPollStrategy { } The following call does not stop the route. camelContext.getRoute(routeId).getConsumer().stop() If I remove the pollStrategy from URI, it works fine. I tried a lot. But could not figure out what's wrong. :(. Thanks Babu -- View this message in context: http://camel.465427.n5.nabble.com/Polling-consumer-does-not-stop-when-pollStrategy-specified-tp5725104.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Polling consumer does not stop when pollStrategy specified
Hi There is API on CamelContext to stop routes by its id camelContext.stopRoute(routeId); On Tue, Jan 8, 2013 at 9:06 AM, babu.sona2001 babu.sona2...@gmail.com wrote: I have as follows. I want to stop it, modify and start it. from('file://D:/temp/20130801/inbound?pollStrategy=#errorHandlerService') .routeId(routeId) .to(stream:out) My pollStrategy looks like: class ErrorHandlerService extends DefaultPollingConsumerPollStrategy { } The following call does not stop the route. camelContext.getRoute(routeId).getConsumer().stop() If I remove the pollStrategy from URI, it works fine. I tried a lot. But could not figure out what's wrong. :(. Thanks Babu -- View this message in context: http://camel.465427.n5.nabble.com/Polling-consumer-does-not-stop-when-pollStrategy-specified-tp5725104.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
OnException Problem
Hi, I followed this exemple on camel site. http://camel.apache.org/exception-clause.html;. I want to catch all Exception and stop the program when the first Exception is catched. Here the main program : ** public void configure(){ onException(Exception.class).process(new MyFunctionFailureHandler()).stop(); from(file:///D:/fileCamel/in?noop=true) .bean(BeanTest.class, myfonction) .to(file:///D:/fileCamel/in); } ** Here the BeanTest: ** public class BeanTest { public void myfonction(Exchange exchange) throws Exception{ System.out.println(IN myfonction); throw new Exception(); } } ** Here the class MyFunctionFailureHandler . ** public class MyFunctionFailureHandler implements Processor { @Override public void process(Exchange exchange) throws Exception { Throwable caused; caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class); System.out.println(ERREUR EXCEPTION + caused); // send it to our mock endpoint exchange.getContext().createProducerTemplate().send(mock:myerror, exchange); } } ** but it doesn't work . Where should i put the OnException(...) on the main program to catch Exception and stop the program. -- View this message in context: http://camel.465427.n5.nabble.com/OnException-Problem-tp5725110.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: OnException Problem
Hi onException(Exception.class).process(new MyFunctionFailureHandler()).stop(); The .stop() does not stop the program. It stops continue routing the message. Though that is implied when you use onException anyway. See this FAQ http://camel.apache.org/how-can-i-stop-a-route-from-a-route.html You can then stop the route, or stop CamelContext, to stop Camel itself. On Tue, Jan 8, 2013 at 11:15 AM, kikou1984 hichem.ouesl...@atos.net wrote: Hi, I followed this exemple on camel site. http://camel.apache.org/exception-clause.html;. I want to catch all Exception and stop the program when the first Exception is catched. Here the main program : ** public void configure(){ onException(Exception.class).process(new MyFunctionFailureHandler()).stop(); from(file:///D:/fileCamel/in?noop=true) .bean(BeanTest.class, myfonction) .to(file:///D:/fileCamel/in); } ** Here the BeanTest: ** public class BeanTest { public void myfonction(Exchange exchange) throws Exception{ System.out.println(IN myfonction); throw new Exception(); } } ** Here the class MyFunctionFailureHandler . ** public class MyFunctionFailureHandler implements Processor { @Override public void process(Exchange exchange) throws Exception { Throwable caused; caused = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, Throwable.class); System.out.println(ERREUR EXCEPTION + caused); // send it to our mock endpoint exchange.getContext().createProducerTemplate().send(mock:myerror, exchange); } } ** but it doesn't work . Where should i put the OnException(...) on the main program to catch Exception and stop the program. -- View this message in context: http://camel.465427.n5.nabble.com/OnException-Problem-tp5725110.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Transactional aggregator
The Spring DSL is something like the following: camel:route id=routeId camel:from uri=direct:start / camel:transacted / camel:onException camel:exceptionorg.apache.camel.component.http.HttpOperationFailedException/camel:exception camel:redeliveryPolicy disableRedelivery=false redeliveryDelay=10 retryAttemptedLogLevel=WARN/ camel:rollback markRollbackOnly=true / /camel:onException camel:aggregate strategyRef=MyAggregationStrategy camel:correlationExpression camel:constanttrue/camel:constant /camel:correlationExpression camel:completionTimeout camel:simple5000/camel:simple /camel:completionTimeout camel:completionSize camel:simple5/camel:simple /camel:completionSize camel:setHeader headerName=CamelHttpMethod camel:constantPOST/camel:constant /camel:setHeader camel:to uri=http://thisurldoesnotexists?throwExceptionOnFailure=true; / /camel:aggregate /camel:route -- View this message in context: http://camel.465427.n5.nabble.com/Transactional-aggregator-tp5725084p5725113.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Transactional aggregator
Hi If you got the Camel in Action book by any chance then check out chapter 8 and 9 first. Then you should have a better understanding of this. On Tue, Jan 8, 2013 at 11:51 AM, orz vlazy...@gmail.com wrote: The Spring DSL is something like the following: camel:route id=routeId camel:from uri=direct:start / camel:transacted / camel:onException camel:exceptionorg.apache.camel.component.http.HttpOperationFailedException/camel:exception camel:redeliveryPolicy disableRedelivery=false redeliveryDelay=10 retryAttemptedLogLevel=WARN/ camel:rollback markRollbackOnly=true / /camel:onException camel:aggregate strategyRef=MyAggregationStrategy camel:correlationExpression camel:constanttrue/camel:constant /camel:correlationExpression camel:completionTimeout camel:simple5000/camel:simple /camel:completionTimeout camel:completionSize camel:simple5/camel:simple /camel:completionSize camel:setHeader headerName=CamelHttpMethod camel:constantPOST/camel:constant /camel:setHeader camel:to uri=http://thisurldoesnotexists?throwExceptionOnFailure=true; / /camel:aggregate /camel:route -- View this message in context: http://camel.465427.n5.nabble.com/Transactional-aggregator-tp5725084p5725113.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
camel-mail
Hi. I am new to camel. just finished studying 'camel in action' book. but There is no mail configuration information in it. Using camel, I want to send a mail using *smtp* component. I tried everything as much as possible. but There is no progress. All I need is I want to create a new message, setting properties, customizing message body and send it using camel smtp component. I tried following coding. ProducerTemplate template; MapString, Object map = new HashMapString, Object(); map.put(To, davscl...@apache.org); map.put(From, jstrac...@apache.org); map.put(Subject, Camel rocks); String body = Hello Claus.\nYes it does.\n\nRegards James.; template.sendBodyAndHeaders(smtp://davscl...@apache.org, body, map); I am getting null pointer exception in template.sendBodyAndHeaders() method. when I run above code. Thanks in advance... -- View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-mail
Hi Welcome to the community. The code below is from an unit test, which uses a mock mail server (not a real mail server). In your scenario, you should change the details to a real mail server (in case you want to send the emails for real). On Tue, Jan 8, 2013 at 2:28 PM, tamil13 tamilvanan...@gmail.com wrote: Hi. I am new to camel. just finished studying 'camel in action' book. but There is no mail configuration information in it. Using camel, I want to send a mail using *smtp* component. I tried everything as much as possible. but There is no progress. All I need is I want to create a new message, setting properties, customizing message body and send it using camel smtp component. I tried following coding. ProducerTemplate template; MapString, Object map = new HashMapString, Object(); map.put(To, davscl...@apache.org); map.put(From, jstrac...@apache.org); map.put(Subject, Camel rocks); String body = Hello Claus.\nYes it does.\n\nRegards James.; template.sendBodyAndHeaders(smtp://davscl...@apache.org, body, map); I am getting null pointer exception in template.sendBodyAndHeaders() method. when I run above code. Thanks in advance... -- View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Problem with calling a simple POJO after a route
Hi, I'm triying to run a route and do something else after (calling a POJO or just printing something); with the following code : Main main = new Main(); main.enableHangupSupport(); main.addRouteBuilder(new MyRouteBuilder()); main.addRouteBuilder(new MyRouteBuilder2()); main.run(args); System.out.println(End of the program); the MyRouteBuilder and MyRouteBuilder2 are two classe extending the RouteBuilder class and containing routes. So the routes are executed, but anything after (the println command) is ignored. How can I solve this problem? Thank you in advance for your help. Bests, Meriem. -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-calling-a-simple-POJO-after-a-route-tp5725121.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel websocket disconnect trigger
On Sat, Jan 5, 2013 at 7:56 AM, Willem jiang willem.ji...@gmail.com wrote: Hi, Current Camel websocket manage the web socket connection itself with the MemoryWebsocketStore. I'm not sure what kind of resource you need to manage yourself. You should be able to know if the client web socket disconnect if you can pass the customer NodeSynchronization into the WebSocketEndpoint. As current Camel WebSocket doesn't expose the API, you need to hack the code to pass the reference. So is the idea that if the client disconnect (somehow) then the Camel route should trigger a message, so you can deal with client being disconnected? Or is this not the case, to have disconnects being triggered in the routes? from websocket:foo choice if disconnect to log client is disconnected otherwise to bean foo -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Saturday, January 5, 2013 at 10:54 AM, aoisagi wrote: Hi, I just started playing around with camel-websocket, however, there doesn't seem to be a trigger when the client quit the browser. Is there some kind of mechanism to detect disconnected socket so I can recycle some resources that's dedicated to that socket previously? Thanks. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-websocket-disconnect-trigger-tp5724934.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com). -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Problem with calling a simple POJO after a route
Hi On Tue, Jan 8, 2013 at 2:38 PM, Meriem mbenha...@gmail.com wrote: Hi, I'm triying to run a route and do something else after (calling a POJO or just printing something); with the following code : Main main = new Main(); main.enableHangupSupport(); main.addRouteBuilder(new MyRouteBuilder()); main.addRouteBuilder(new MyRouteBuilder2()); main.run(args); System.out.println(End of the program); the MyRouteBuilder and MyRouteBuilder2 are two classe extending the RouteBuilder class and containing routes. So the routes are executed, but anything after (the println command) is ignored. How can I solve this problem? See this FAQ http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html So the main.run() will keep Camel running until you either stop Camel or terminate the JVM. And that is why would wont see the println, until you hit cltr + c to terminate the JVM. Thank you in advance for your help. Bests, Meriem. -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-calling-a-simple-POJO-after-a-route-tp5725121.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: camel-mail
On Tue, Jan 8, 2013 at 2:48 PM, tamil13 tamilvanan...@gmail.com wrote: Yes. We included *real mail server* detail only. This is same code except configuration information. Below code return null pointer exception also. Is there any other code available to create and send mail using *smtp* component? And did you create a template, eg template = camelContext.createProducerTemplate(); So its not null. -- View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5725124.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: camel-mail
Hi See for example http://camel.apache.org/walk-through-an-example.html On Tue, Jan 8, 2013 at 2:51 PM, Claus Ibsen claus.ib...@gmail.com wrote: On Tue, Jan 8, 2013 at 2:48 PM, tamil13 tamilvanan...@gmail.com wrote: Yes. We included *real mail server* detail only. This is same code except configuration information. Below code return null pointer exception also. Is there any other code available to create and send mail using *smtp* component? And did you create a template, eg template = camelContext.createProducerTemplate(); So its not null. -- View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5725124.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: how to break out of a batch?
On Tue, Dec 4, 2012 at 2:57 AM, Willem jiang willem.ji...@gmail.com wrote: I think we could add some feature on the ScheduledPollConsumer to stop processing the message if some kind of flag is set. As current implementation doesn't check if there is some exception is thrown when processing the exchange. I logged a ticket to track this https://issues.apache.org/jira/browse/CAMEL-5941 BTW, I just found the File component support the option of maxMessagesPerPoll. It could be more easy to stop the route if the maxMessagesPerPoll=1. -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.javaeye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: willemjiang On Tuesday, December 4, 2012 at 7:01 AM, Christian Müller wrote: I don't think you really want to stop the route (the route will no longer polling for files and process these files). I think you want to stop processing the exchange (the file) which is faulty. In this case, you can use stop(). https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/RouteStopTest.java Best, Christian On Mon, Dec 3, 2012 at 4:52 PM, bung_ho bung...@hotmail.com (mailto:bung...@hotmail.com) wrote: static -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Problem with calling a simple POJO after a route
On Tue, Jan 8, 2013 at 3:11 PM, Meriem mbenha...@gmail.com wrote: Thank you very much for your reply. But how can I stop camel automatically? my program should execute a route (for example copiying files) and continue with something else that has nothing to do with camel. In fact, I'm using Struts web application: every action should be executed and should give the control back to the struts-config xml file. How can I stop everything after executing routes. The .run method will block until stopping Camel. Instead you can call the start() method on CamelContext which will start and not-block Camel. Thank you very much for your help. Bests, Meriem. -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-calling-a-simple-POJO-after-a-route-tp5725121p5725130.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
SSH - BouncyCastle
Hi, I'm using apache camel 2.10.2 and getting the follow error when try to use ssh component consumer. java.lang.NoClassDefFoundError: org.bouncycastle.crypto.prng.VMPCRandomGenerator The jdk version is: 1.7.0_05. I've try to declare bouncycastle dependency on pom without success. Thanks -- Leandro Franchi http://www.chickenten.com
Re: Problem with calling a simple POJO after a route
I tried with : CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start(); Thread.sleep(1000); context.stop(); System.out.println(End of the program); and it worked. Thank you very much for your help. Bests, Meriem. -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-calling-a-simple-POJO-after-a-route-tp5725121p5725134.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Unable to consume syslog messages
sscott wrote I set up rsyslogd to forward *.* to localhost:5140. Every log message causes Camel to output an InvalidPayloadException caused by a NoTypeConversionAvailableException with the detail No type converter available to convert from type: org.jboss.netty.buffer.BigEndianHeapChannelBuffer to the required type: java.io.InputStream with value BigEndianHeapChannelBuffer(ridx=0, widx=105, cap=105) When I change the from() to be mina:, with or without the sync=false and allowDefaultCodec=false options, and change the maven dependencies to camel-mina from camel-netty, the same exceptions are thrown with the detail No body available of type: java.io.InputStream on: Message: [Body is null]. Caused by: No type converter available to convert from type: null to the required type: java.io.InputStream with value null. In case anybody ever has this problem in the future, it was caused by using maven-assembly-plugin to package all the code into a jar-with-dependencies. I'm assuming it's a TypeConverter / MANIFEST.MF issue. -- View this message in context: http://camel.465427.n5.nabble.com/Unable-to-consume-syslog-messages-tp5724850p5725140.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Polling consumer does not stop when pollStrategy specified
Sorry.. I take that back. camelContext.stopRoute() stops the route. But then, if I call camelCOntext.startRoute(), only the file polling is started. It does not print anything in console. What happens to stream:out? -- View this message in context: http://camel.465427.n5.nabble.com/Polling-consumer-does-not-stop-when-pollStrategy-specified-tp5725104p5725143.html Sent from the Camel - Users mailing list archive at Nabble.com.
recipientList with POST and request body
Hi, I need to send request to a dynamically constructed URL list which provides RESTful web services. So my simplest need is to send POST requests with fixed JSON body, later I may need to construct different JSON body for each URL in the list as well, and since it's RESTful service, DELETE/PUT are also possible. how should I do it? This is standard recipientList pattern from document: route from uri=direct:a / recipientList delimiter=, headermyHeader/header /recipientList /route Should I do: route from uri=servlet:///sendToRecipients / setHeader headerName=WEB_SERVICE_URLS constantconstruct my urls here/constant /setHeader setHeader headerName=CamelHttpMethod constantPOST/constant /setHeader setHeader headerName=Content-Type constantapplication/json/constant /setHeader setBody constant{name:fixed text}/constant /setBody recipientList delimiter=, headerWEB_SERVICE_URLS/header /recipientList /route Thanks for advice. -- View this message in context: http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142.html Sent from the Camel - Users mailing list archive at Nabble.com.
repeating the steps from the route
Following is the route : public class MyRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { // xnc route here String xncFileSupport = ICEndPoints.getValue(XNC_FILE_SUPPORT); if (XNC_SUPPORT_ON.equalsIgnoreCase(xncFileSupport)) { try { InProcessor inproc = new InProcessor(); String rootXncFolder = ICEndPoints.getRootXNCFolder(); String sourceFolder = getXNCSourceURI(pollDelayParameter,rootXncFolder); AgentAuthProcessor authProc = new AgentAuthProcessor(); ConfigurationUtils utils = ConfigurationUtils.getInstance(); Configuration config = utils.getConfig(); String agentUserPwdUrl = MyUtils.getAgentUserPwdUrl(utils, config); // xnc route starts here from(sourceFolder) // the exception clause here .onException(Exception.class) .maximumRedeliveries(redeliveryCount) .redeliveryDelay(redeliveryDelay) .logHandled(true) .logRetryStackTrace(stackValue) .retryAttemptedLogLevel(LoggingLevel.WARN) .retriesExhaustedLogLevel(LoggingLevel.ERROR) .backOffMultiplier(2.0) .handled(true) .to(SEDA_XNC_EXCEPTION) .end() .process(pickupProc) .choice() .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true)) .process(authProc) .to(agentUserPwdUrl) .otherwise() .process(authProc) .end() .process(inproc) .recipientList(header(Constants.DESTINATION_URI)) .process(new CommandResponseProcessor()) // try using xpath here also } } } I want to repeat the following steps from the route based on a condition: .choice() .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true)) .process(authProc) .to(agentUserPwdUrl) .otherwise() .process(authProc) .end() .process(inproc) .recipientList(header(Constants.DESTINATION_URI)) Iam using camel 2.4 , can you please suggest me how to repeat the above steps from the route based on a condition. Thanks, Chandana
CamelOne
Does anyone know if there is going to be a CamelOne Conference this year? Jason
Re: SSH - BouncyCastle
Which version of BouncyCastle? What is your runtime? Can you share the complete stack trace? Sent from a mobile device Am 08.01.2013 15:34 schrieb Leandro Franchi leandro.fran...@gmail.com: Hi, I'm using apache camel 2.10.2 and getting the follow error when try to use ssh component consumer. java.lang.NoClassDefFoundError: org.bouncycastle.crypto.prng.VMPCRandomGenerator The jdk version is: 1.7.0_05. I've try to declare bouncycastle dependency on pom without success. Thanks -- Leandro Franchi http://www.chickenten.com
Re: repeating the steps from the route
We have a loop() in our DSL... Sent from a mobile device Am 08.01.2013 21:46 schrieb Kesireddy, Chandana (ITD) chandana.kesire...@state.ma.us: Following is the route : public class MyRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { // xnc route here String xncFileSupport = ICEndPoints.getValue(XNC_FILE_SUPPORT); if (XNC_SUPPORT_ON.equalsIgnoreCase(xncFileSupport)) { try { InProcessor inproc = new InProcessor(); String rootXncFolder = ICEndPoints.getRootXNCFolder(); String sourceFolder = getXNCSourceURI(pollDelayParameter,rootXncFolder); AgentAuthProcessor authProc = new AgentAuthProcessor(); ConfigurationUtils utils = ConfigurationUtils.getInstance(); Configuration config = utils.getConfig(); String agentUserPwdUrl = MyUtils.getAgentUserPwdUrl(utils, config); // xnc route starts here from(sourceFolder) // the exception clause here .onException(Exception.class) .maximumRedeliveries(redeliveryCount) .redeliveryDelay(redeliveryDelay) .logHandled(true) .logRetryStackTrace(stackValue) .retryAttemptedLogLevel(LoggingLevel.WARN) .retriesExhaustedLogLevel(LoggingLevel.ERROR) .backOffMultiplier(2.0) .handled(true) .to(SEDA_XNC_EXCEPTION) .end() .process(pickupProc) .choice() .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true)) .process(authProc) .to(agentUserPwdUrl) .otherwise() .process(authProc) .end() .process(inproc) .recipientList(header(Constants.DESTINATION_URI)) .process(new CommandResponseProcessor()) // try using xpath here also } } } I want to repeat the following steps from the route based on a condition: .choice() .when(header(Constants.GATEWAY_AUTH_VALUE).isEqualTo(true)) .process(authProc) .to(agentUserPwdUrl) .otherwise() .process(authProc) .end() .process(inproc) .recipientList(header(Constants.DESTINATION_URI)) Iam using camel 2.4 , can you please suggest me how to repeat the above steps from the route based on a condition. Thanks, Chandana
Re: recipientList with POST and request body
Hi, I'm afraid the recipientList will not meet your needs at this time. As you need to change the Http method and request JSON body dynamically, current recipientList just supports to change the Camel Endpoint URI dynamically. So I suggest you to leverage the ProducerTemplate[1] in your customer bean, so you can get full control of message header , body and the Camel Endpoint URI at same time. [1]https://camel.apache.org/producertemplate.html -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Wednesday, January 9, 2013 at 2:48 AM, Zemin Hu wrote: Hi, I need to send request to a dynamically constructed URL list which provides RESTful web services. So my simplest need is to send POST requests with fixed JSON body, later I may need to construct different JSON body for each URL in the list as well, and since it's RESTful service, DELETE/PUT are also possible. how should I do it? This is standard recipientList pattern from document: route from uri=direct:a / recipientList delimiter=, headermyHeader/header /recipientList /route Should I do: route from uri=servlet:///sendToRecipients / setHeader headerName=WEB_SERVICE_URLS constantconstruct my urls here/constant /setHeader setHeader headerName=CamelHttpMethod constantPOST/constant /setHeader setHeader headerName=Content-Type constantapplication/json/constant /setHeader setBody constant{name:fixed text}/constant /setBody recipientList delimiter=, headerWEB_SERVICE_URLS/header /recipientList /route Thanks for advice. -- View this message in context: http://camel.465427.n5.nabble.com/recipientList-with-POST-and-request-body-tp5725142.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Re: Polling consumer does not stop when pollStrategy specified
Can you check if the files are pulled already? If there is no new file to be pulled, the stream:out will not print any things out. -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Wednesday, January 9, 2013 at 2:52 AM, babu.sona2001 wrote: Sorry.. I take that back. camelContext.stopRoute() stops the route. But then, if I call camelCOntext.startRoute(), only the file polling is started. It does not print anything in console. What happens to stream:out? -- View this message in context: http://camel.465427.n5.nabble.com/Polling-consumer-does-not-stop-when-pollStrategy-specified-tp5725104p5725143.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
RecipientList with delimiter argument
Hi All: When I plan to use recipientList component, I can only select one from: Method 1: public RecipientListDefinitionType recipientList(Expression recipients) {...} Method 2: public RecipientListDefinitionType recipientList(Expression recipients, String delimiter) {...} Method 3: public ExpressionClauseRecipientListDefinitionType recipientList() {...} Method 3 has more expression can be used than Method 1 and Method 2 , but unfortunately, we can't specify the delimiter on this case. So I'd like to know, how I can have a method which works like: Method 4: public ExpressionClauseRecipientListDefinitionType recipientList(String delimiter) {...} Thanks a lot GangLiu
Re: Transactional aggregator
Hi, Thanks for your reply. I have already read chapters 8 and 9. I understand that I can use HawtDBAggregationRepository and redirect the aggregated exchange(s) to a DLQ after a certain number of retries. However, that is not what I want. I need it to behave like the following steps 1. Message A sent to jms:queue:test 2. Aggregator takes message A from jms:queue:test 3. Message B sent to jms:queue:test 4. Aggregator takes message B from jms:queue:test and merged as a new exchange 5. Aggregator sends new exchange to Http endpoint and HttpOperationFailedException is thrown. 6. The transaction is rollbacked and Message A B still remain on jms:queue:test -- View this message in context: http://camel.465427.n5.nabble.com/Transactional-aggregator-tp5725084p5725165.html Sent from the Camel - Users mailing list archive at Nabble.com.