Re: Problem with mqtt component
Hi, Can you show us the code of the myProcessor? I just checked the code of camel-mqtt producer, it will to send the message to mqtt server unless the it can get the byte array from the message body. Please make sure the message body is reread able. -- 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 Tuesday, March 26, 2013 at 9:33 AM, arda.aydin wrote: Hi everyone, I have a from(mqtt).to(mqtt) route but i can't get it work. Here are my route definitions: camel:route id=orderRequestCreatorRoute camel:from uri=mqtt:cheese?subscribeTopicName=CP/#/ camel:process ref=myProcessor/ camel:to uri=mqtt:cheese?publishTopicName=DP/Device1/ /camel:route This doesn't work, the processor prints a log message but i can't consume on DP/Device1 topic. But when i replace the consumer by a file endpoint it works : camel:route id=orderRequestCreatorRoute camel:from uri=file://inbox/ camel:process ref=myProcessor/ camel:to uri=mqtt:cheese?publishTopicName=DP/Device1/ /camel:route Does someone has an idea about it? Thanks in advance. Cheers, Kod -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-mqtt-component-tp5729820.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Integrating 2 deployable units (containing camel routes)
Hi, We have 2 deployable units, EBA files , containing camel routes that are deployed on Websphere. For those that don't know what an EBA is, it's an enterprise bundle archive (basically an EAR file containing OSGI bundles). We would like to have the ability to send messages that are being processed in the camel route in EBA1 to a camel route in EBA2. EBA2 has existing camel http/jms endpoints that we could use to do the integration. It would keep the 2 units loosely coupled and the integration would be straightforward. We're also looking into performance, and using http/jms for communication inside the same jvm might also not be ideal. Is using VM endpoints also an option here ? As both EBAs run in the same JVM, would it be possible to directly exchange messages between these camel routes ? I read on this mailing list that the VM endpoint was primarily created for sharing messages between WAR files deployed in Apache Tomcat etc. What is your take on this ? Thanks... -- View this message in context: http://camel.465427.n5.nabble.com/Integrating-2-deployable-units-containing-camel-routes-tp5729827.html Sent from the Camel - Users mailing list archive at Nabble.com.
got FatalFallbackErrorHandler when trying handing error with bean
i'm trying to catch org.apache.camel.ExchangeTimedOutException using bean, here the spring dsl onException exceptionorg.apache.camel.ExchangeTimedOutException/exception handled constanttrue/constant /handled bean ref=appErrorHandler method=onTimeOutException/ /onException but i got following error log: FatalFallbackErrorHandler FatalFallbackErrorHandler ERROR \-- Previous exception on exchangeId: ... org.apache.camel.ExchangeTimedOutException ... FatalFallbackErrorHandler ERROR \-- New exception on exchangeId: ... org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: [Body is null]] but i got the right body from the caller. -- View this message in context: http://camel.465427.n5.nabble.com/got-FatalFallbackErrorHandler-when-trying-handing-error-with-bean-tp5729828.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Upload file - How to pass InputStream to Camel's route
Hi Raul, thanks for quick answer. This looks easy when you are using @GET, but I am sending @POST request. If I am right, @POST sends data only in headers. I was thinking about attachments, may be, but here it gets more confusing for me :-) Here is my REST implementation: @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Path(/upload) @Produces(MediaType.APPLICATION_JSON) public Response uploadFile( @QueryParam(host) String host, @QueryParam(port) String port, @QueryParam(user) String user, @QueryParam(password) String password, @Multipart(value=folderId) String folderId, @Multipart(value=filename) String filename, @Multipart(value=myfile) DataHandler myfile ){} Thanks -Br, Roman -- View this message in context: http://camel.465427.n5.nabble.com/Upload-file-How-to-pass-InputStream-to-Camel-s-route-tp5729752p5729829.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: got FatalFallbackErrorHandler when trying handing error with bean
I think your appErrorHandler is throwing an exception. Can you check this!? Sent from a mobile device Am 26.03.2013 09:08 schrieb sakti 54k...@gmail.com: i'm trying to catch org.apache.camel.ExchangeTimedOutException using bean, here the spring dsl onException exceptionorg.apache.camel.ExchangeTimedOutException/exception handled constanttrue/constant /handled bean ref=appErrorHandler method=onTimeOutException/ /onException but i got following error log: FatalFallbackErrorHandler FatalFallbackErrorHandler ERROR \-- Previous exception on exchangeId: ... org.apache.camel.ExchangeTimedOutException ... FatalFallbackErrorHandler ERROR \-- New exception on exchangeId: ... org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: [Body is null]] but i got the right body from the caller. -- View this message in context: http://camel.465427.n5.nabble.com/got-FatalFallbackErrorHandler-when-trying-handing-error-with-bean-tp5729828.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel and Perf4j
On Mon, Mar 25, 2013 at 5:44 PM, Henri Tremblay henri.tremb...@gmail.com wrote: I'll guess your are talking about ExchangeSentEvent. Then the starting point will be ExchangeSendingEvent? For what I remember, I tried that. I wasn't working either but a can try again just to make sure. The Tracer and Backlogtracer doesn't seem to provide the metrics I want (or any metrics at all). However, I can parse the log to do my own metrics. That's pretty much what I'm doing right now. I tried hawt.io. It gives a nice view of the the routes but when looking at the metrics, it's pretty much the same thing as JMX. camelwatch is better. I have a dashboard with load average and inflight. Not exactly what I want but I could get to something with a bit of hacking. I must say I wasn't expecting it would be that complex to get my metrics. I'm basically interested in a dashboard of my routes with: - Mean processing time. 95%, 99% percentile - Messages per seconds - Be able to reset the statistics easily - Current inflight - Refresh automatically And btw there is monitoring tools such as - Nagios - The commercial ones from IBM / HP / et all - Hyperic - JBoss Operations Network - and many more as well The latter has Camel plugins (to be released as part of JBoss Fuse 6) so its ready to monitor your Camel apps. And there is some links to blogs/articles about monitoring Camel from our link collection at: http://camel.apache.org/articles On 15 March 2013 15:26, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Mar 15, 2013 at 3:20 PM, Henri Tremblay henri.tremb...@gmail.com wrote: Ok. That's what I thought. It is still strange since technically it is two routes (and the JMX does give me stats on both on them). Its not strange, there is events like ExchangeSentToEndpoint you can use instead etc. See all the event classes we have in the events package. Also you may consider looking at tracer for fine grained tracing / metrics collection http://camel.apache.org/tracer And the new backlog tracer in Camel 2.11 http://camel.apache.org/backlogtracer.html I'll look at the proposed tools and give you some feedback. Thanks! Henri On 15 March 2013 13:11, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Mar 15, 2013 at 12:48 PM, Henri Tremblay henri.tremb...@gmail.com wrote: Hi, I would like to use Camel with Perf4j. I know that Camel JMX already provide statistics but I would like to be able to easily see at once all my routes performance and be able generate nice graph. Perf4j allows me to do that quickly (you know another tool that will do the same with Camel?) Yes hawtio can monitor Camel apps. I suggest to take a look. In the upcoming 1.1 release there is going to be a new plugin for showing stats, us http://hawt.io/ And there is also a tool called CamelWatch http://sksamuel.github.com/camelwatch/ My first try was to extend EventNotifierSupport and react to ExchangeCreatedEvent and ExchangeCompletedEvent. Basically this: public void notify(EventObject event) throws Exception { Exchange exchange = (Exchange) event.getSource(); String tag = exchange.getFromRouteId() + - + exchange.getFromEndpoint(); if (event instanceof ExchangeCreatedEvent) { StopWatch watch = new Slf4JStopWatch(tag); exchange.setProperty(STOP_WATCH_KEY + tag, watch); } else if (event instanceof ExchangeCompletedEvent) { StopWatch watch = (StopWatch) exchange.removeProperty(STOP_WATCH_KEY + tag); watch.stop(); } } Of course it doesn't really work. There is no way to have the route id it seems. Or at least I have strange result. My routes are: from(sql:...).setRouteId(a).to(direct-foo); from(direct:foo).setRouteId(b).to(http:...); And instead of getting something like Created a Completed a Created b Completed b I receive something like Created a-null Created a-a Completed a-a Completed a-a Any idea why it behaves like this and what I can do? Thanks Henri You should likely only react to created / completed events. And that is why you may get a null in the from route. And when you use the direct component its NOT creating a new Exchange but routing the existing exchange. And hence why you wont see events for creating / completed from route b. -- 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 -- Claus Ibsen
Re: Integrating 2 deployable units (containing camel routes)
We use the vm or direct-vm component for inter bundle communication. It should be the fastest integration. But this integration is not so loosely coupled as JMS which can persist the message is the consumer is not up and running... Because of an issue in the vm component we fixed recently [1], you may want wait for the next Camel 2.10.5 or Camel 2.11.0 release (very soon). [1] https://issues.apache.org/jira/browse/CAMEL-6073 Best, Christian On Tue, Mar 26, 2013 at 8:17 AM, ddewaele ddewa...@gmail.com wrote: Hi, We have 2 deployable units, EBA files , containing camel routes that are deployed on Websphere. For those that don't know what an EBA is, it's an enterprise bundle archive (basically an EAR file containing OSGI bundles). We would like to have the ability to send messages that are being processed in the camel route in EBA1 to a camel route in EBA2. EBA2 has existing camel http/jms endpoints that we could use to do the integration. It would keep the 2 units loosely coupled and the integration would be straightforward. We're also looking into performance, and using http/jms for communication inside the same jvm might also not be ideal. Is using VM endpoints also an option here ? As both EBAs run in the same JVM, would it be possible to directly exchange messages between these camel routes ? I read on this mailing list that the VM endpoint was primarily created for sharing messages between WAR files deployed in Apache Tomcat etc. What is your take on this ? Thanks... -- View this message in context: http://camel.465427.n5.nabble.com/Integrating-2-deployable-units-containing-camel-routes-tp5729827.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Upload file - How to pass InputStream to Camel's route
Hi Romain! With @GET you cannot send content with your request. This is possible with @POST. Best, Christian On Tue, Mar 26, 2013 at 9:14 AM, jamalissimo roman.janu...@gmail.comwrote: Hi Raul, thanks for quick answer. This looks easy when you are using @GET, but I am sending @POST request. If I am right, @POST sends data only in headers. I was thinking about attachments, may be, but here it gets more confusing for me :-) Here is my REST implementation: @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Path(/upload) @Produces(MediaType.APPLICATION_JSON) public Response uploadFile( @QueryParam(host) String host, @QueryParam(port) String port, @QueryParam(user) String user, @QueryParam(password) String password, @Multipart(value=folderId) String folderId, @Multipart(value=filename) String filename, @Multipart(value=myfile) DataHandler myfile ){} Thanks -Br, Roman -- View this message in context: http://camel.465427.n5.nabble.com/Upload-file-How-to-pass-InputStream-to-Camel-s-route-tp5729752p5729829.html Sent from the Camel - Users mailing list archive at Nabble.com.
Why such unit test does not work while it works fine with SOAP UI
Hi, When in a Unit Test I use template.requestBody() with a WebService (which is working perfectly using by example SOAP UI), I get the following error : - Is it because the SOAP Acton is not defined ? - As my code is similar to this one ( https://code.google.com/p/camelinaction/source/browse/trunk/chapter6/dataset/src/test/java/camelinaction/AcmeDataSetTest.java?r=47) what could be the problem ? org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: org.fusesource.example.GetCustomerByName@4da3dc1d] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1335) at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:618) at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:454) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:120) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:136) at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:284) at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:314) at org.fusesource.example.camel.webservice.CustomerWebServiceTest.testCustomerFuse(CustomerWebServiceTest.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47) at org.junit.rules.RunRules.evaluate(RunRules.java:18) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.IllegalArgumentException: Get the wrong parameter size to invoke the out service, Expect size 0, Parameter size 1. Please check if the message body matches the CXFEndpoint POJO Dataformat request. at org.apache.camel.component.cxf.CxfProducer.checkParameterSize(CxfProducer.java:262) at org.apache.camel.component.cxf.CxfProducer.getParams(CxfProducer.java:301) at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:112) at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) at org.apache.camel.processor.UnitOfWorkProducer.process(UnitOfWorkProducer.java:63) at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:366) at org.apache.camel.impl.ProducerCache$2.doInProducer(ProducerCache.java:337) at org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:233) at org.apache.camel.impl.ProducerCache.sendExchange(ProducerCache.java:337) at org.apache.camel.impl.ProducerCache.send(ProducerCache.java:192) at org.apache.camel.impl.DefaultProducerTemplate.send(DefaultProducerTemplate.java:115) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:119) ... 35 more Code public class CustomerWebServiceTest extends CamelSpringTestSupport {
Re: Upload file - How to pass InputStream to Camel's route
Exactly. I copied/pasted your example from your first thread, and the @GET slipped in. You can only send content with @POST or @PUT. So just replace @GET with @POST in my example and it should work as expected. Please try it and loop back to us. Regards, *Raúl Kripalani* Enterprise Architect, Open Source Integration specialist, Program Manager | Apache Camel Committer http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Tue, Mar 26, 2013 at 9:23 AM, Christian Müller christian.muel...@gmail.com wrote: Hi Romain! With @GET you cannot send content with your request. This is possible with @POST. Best, Christian On Tue, Mar 26, 2013 at 9:14 AM, jamalissimo roman.janu...@gmail.com wrote: Hi Raul, thanks for quick answer. This looks easy when you are using @GET, but I am sending @POST request. If I am right, @POST sends data only in headers. I was thinking about attachments, may be, but here it gets more confusing for me :-) Here is my REST implementation: @POST @Consumes(MediaType.MULTIPART_FORM_DATA) @Path(/upload) @Produces(MediaType.APPLICATION_JSON) public Response uploadFile( @QueryParam(host) String host, @QueryParam(port) String port, @QueryParam(user) String user, @QueryParam(password) String password, @Multipart(value=folderId) String folderId, @Multipart(value=filename) String filename, @Multipart(value=myfile) DataHandler myfile ){} Thanks -Br, Roman -- View this message in context: http://camel.465427.n5.nabble.com/Upload-file-How-to-pass-InputStream-to-Camel-s-route-tp5729752p5729829.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Integrating 2 deployable units (containing camel routes)
Hi Christian, I was a bit confused by the documentation (does the direct-vm contain a copy/paste error ? It basically says the same as on the vm page). Both support communication across CamelContext instances but yet they differ ? It's also not clear that both can be used for inter OSGI bundle communication. *VM* VM supports communication across CamelContext instances - so you can use this mechanism to communicate across web applications (provided that camel-core.jar is on the system/boot classpath). *Direct-VM* This component differs from the Direct component in that Direct-VM supports communication across CamelContext instances - so you can use this mechanism to communicate across web applications (provided that camel-core.jar is on the system/boot classpath). I used the direct-vm and it does work accross bundles. However, in our case we have 1 Camel route defined in a OSGI bundle (bootstrapped using spring using an OSGI blueprint extender), while another Camel route is defined in a WAR file (the osgi frameworks wraps the war file in an OSGI bundle). I noticed that the route from the WAR file can not send messages using direct-vm to a route in a bundle. A route from a bundle can send a message to a route in another bundle. So I guess I have 2 options : 1. Move the camel route from the WAR into an actual OSGI bundle, put everything in the same EBA and use vm or direct-vm 2. Keep the 2 EBAs seperate (isolated) and integrate them using JMS. -- View this message in context: http://camel.465427.n5.nabble.com/Integrating-2-deployable-units-containing-camel-routes-tp5729827p5729841.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Problem with mqtt component
Hi, Even if i delete the processor it doesn't work. And now with your warning i make this: byte[] ba2 = {1,2,3,4,5}; exchange.getIn().setBody(ba2); inside my processor but i doesn't work. Camel version : 2.10.4 Thanks for your reply, Kod -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-mqtt-component-tp5729820p5729842.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel and Perf4j
Ok. Thank you very much for all these informations. I'll look into it. On 26 March 2013 10:14, Claus Ibsen claus.ib...@gmail.com wrote: On Mon, Mar 25, 2013 at 5:44 PM, Henri Tremblay henri.tremb...@gmail.com wrote: I'll guess your are talking about ExchangeSentEvent. Then the starting point will be ExchangeSendingEvent? For what I remember, I tried that. I wasn't working either but a can try again just to make sure. The Tracer and Backlogtracer doesn't seem to provide the metrics I want (or any metrics at all). However, I can parse the log to do my own metrics. That's pretty much what I'm doing right now. I tried hawt.io. It gives a nice view of the the routes but when looking at the metrics, it's pretty much the same thing as JMX. camelwatch is better. I have a dashboard with load average and inflight. Not exactly what I want but I could get to something with a bit of hacking. I must say I wasn't expecting it would be that complex to get my metrics. I'm basically interested in a dashboard of my routes with: - Mean processing time. 95%, 99% percentile - Messages per seconds - Be able to reset the statistics easily - Current inflight - Refresh automatically And btw there is monitoring tools such as - Nagios - The commercial ones from IBM / HP / et all - Hyperic - JBoss Operations Network - and many more as well The latter has Camel plugins (to be released as part of JBoss Fuse 6) so its ready to monitor your Camel apps. And there is some links to blogs/articles about monitoring Camel from our link collection at: http://camel.apache.org/articles On 15 March 2013 15:26, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Mar 15, 2013 at 3:20 PM, Henri Tremblay henri.tremb...@gmail.com wrote: Ok. That's what I thought. It is still strange since technically it is two routes (and the JMX does give me stats on both on them). Its not strange, there is events like ExchangeSentToEndpoint you can use instead etc. See all the event classes we have in the events package. Also you may consider looking at tracer for fine grained tracing / metrics collection http://camel.apache.org/tracer And the new backlog tracer in Camel 2.11 http://camel.apache.org/backlogtracer.html I'll look at the proposed tools and give you some feedback. Thanks! Henri On 15 March 2013 13:11, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Mar 15, 2013 at 12:48 PM, Henri Tremblay henri.tremb...@gmail.com wrote: Hi, I would like to use Camel with Perf4j. I know that Camel JMX already provide statistics but I would like to be able to easily see at once all my routes performance and be able generate nice graph. Perf4j allows me to do that quickly (you know another tool that will do the same with Camel?) Yes hawtio can monitor Camel apps. I suggest to take a look. In the upcoming 1.1 release there is going to be a new plugin for showing stats, us http://hawt.io/ And there is also a tool called CamelWatch http://sksamuel.github.com/camelwatch/ My first try was to extend EventNotifierSupport and react to ExchangeCreatedEvent and ExchangeCompletedEvent. Basically this: public void notify(EventObject event) throws Exception { Exchange exchange = (Exchange) event.getSource(); String tag = exchange.getFromRouteId() + - + exchange.getFromEndpoint(); if (event instanceof ExchangeCreatedEvent) { StopWatch watch = new Slf4JStopWatch(tag); exchange.setProperty(STOP_WATCH_KEY + tag, watch); } else if (event instanceof ExchangeCompletedEvent) { StopWatch watch = (StopWatch) exchange.removeProperty(STOP_WATCH_KEY + tag); watch.stop(); } } Of course it doesn't really work. There is no way to have the route id it seems. Or at least I have strange result. My routes are: from(sql:...).setRouteId(a).to(direct-foo); from(direct:foo).setRouteId(b).to(http:...); And instead of getting something like Created a Completed a Created b Completed b I receive something like Created a-null Created a-a Completed a-a Completed a-a Any idea why it behaves like this and what I can do? Thanks Henri You should likely only react to created / completed events. And that is why you may get a null in the from route. And when you use the direct component its NOT creating a new Exchange but routing the existing exchange. And hence why you wont see events for creating / completed from route b. -- 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:
Re: Why such unit test does not work while it works fine with SOAP UI
Hi Charles, It is not related the SOAP Action. From the stack trace I can tell you may not pass a right OperationName header. BTW, you can set the defaultOperationName on the CXFEndpointBean or CXFEndpoint URI. -- 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 Tuesday, March 26, 2013 at 5:25 PM, Charles Moulliard wrote: Hi, When in a Unit Test I use template.requestBody() with a WebService (which is working perfectly using by example SOAP UI), I get the following error : - Is it because the SOAP Acton is not defined ? - As my code is similar to this one ( https://code.google.com/p/camelinaction/source/browse/trunk/chapter6/dataset/src/test/java/camelinaction/AcmeDataSetTest.java?r=47) what could be the problem ? org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[Message: org.fusesource.example.GetCustomerByName@4da3dc1d] at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1335) at org.apache.camel.util.ExchangeHelper.extractResultBody(ExchangeHelper.java:618) at org.apache.camel.impl.DefaultProducerTemplate.extractResultBody(DefaultProducerTemplate.java:454) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:120) at org.apache.camel.impl.DefaultProducerTemplate.sendBody(DefaultProducerTemplate.java:136) at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:284) at org.apache.camel.impl.DefaultProducerTemplate.requestBody(DefaultProducerTemplate.java:314) at org.fusesource.example.camel.webservice.CustomerWebServiceTest.testCustomerFuse(CustomerWebServiceTest.java:65) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20) at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:47) at org.junit.rules.RunRules.evaluate(RunRules.java:18) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68) at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222) at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:30) at org.junit.runners.ParentRunner.run(ParentRunner.java:300) at org.junit.runner.JUnitCore.run(JUnitCore.java:157) at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:76) at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:195) at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:63) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120) Caused by: java.lang.IllegalArgumentException: Get the wrong parameter size to invoke the out service, Expect size 0, Parameter size 1. Please check if the message body matches the CXFEndpoint POJO Dataformat request. at org.apache.camel.component.cxf.CxfProducer.checkParameterSize(CxfProducer.java:262) at org.apache.camel.component.cxf.CxfProducer.getParams(CxfProducer.java:301) at org.apache.camel.component.cxf.CxfProducer.process(CxfProducer.java:112) at org.apache.camel.processor.UnitOfWorkProcessor.processAsync(UnitOfWorkProcessor.java:150) at org.apache.camel.processor.UnitOfWorkProcessor.process(UnitOfWorkProcessor.java:117) at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:99) at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:86) at
Re: SMPP stop route problem
I'll looked in the code and the only place I found that an error code could be generated is in org.apache.camel.component.smpp.MessageReceiverListenerImpl line 105 this seems to send back to the smsc an error 255, which is unkown to the smsc. I'll try to confirm that the error is really happening in MessageReceiverListenerImpl.onAcceptDataSm() If this is the case, does it mean, that there's a problem when we still receive messages and the route is in the process of stopping itself ? -- View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729848.html Sent from the Camel - Users mailing list archive at Nabble.com.
from databaes to other
hi everybody when i use to send rows from database to an other it don't work this is what i did: choice when xpath/person/city = 'SMON'/xpath setBody constantSELECT * FROM REPORT.T_INCIDENT WHERE INCIDENT_REF = '001' OR INCIDENT_REF = '002';/constant /setBody to uri=jdbc:reportdb/ to uri=jdbc:db/ /when any one can help me ? -- View this message in context: http://camel.465427.n5.nabble.com/from-databaes-to-other-tp5729847.html Sent from the Camel - Users mailing list archive at Nabble.com.
Clearing ThreadLocal when exchange completes
We are currently using ThreadLocal to store some information that gets included in a log4j converter (and is used in other projects that dont have camel in). Is there a callback I can use that for all routes in my context so that at the end of the route it will get called (without explicitly setting it) For example: from(jms:somequeue) .processRef(someRandomProcessor) .processRef(someProcessorThatSetsThreadLocalValue) .to(jms:someotherqueue) Ideally I'd like the threadlocal cleared when the exchange has been written to the queue, without adding a processor that explicitly clears it (as developers when adding new routes will forget to do it). I know the onCompletion runs in a seperate thread so isn't fit for my purpose. I've noticed syncronisations and unitofworks, but cant seem to find any documentation on it. Would this be fit for purpose? -- View this message in context: http://camel.465427.n5.nabble.com/Clearing-ThreadLocal-when-exchange-completes-tp5729849.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: My camel-CXF tests fails, if they run together
Similar issue with CamelBlueprintTestSupport. Resolution: public class RouteTest extends CamelBlueprintTestSupport { private static int num = 8567; @Override protected String getBlueprintDescriptor() { ++num; return /OSGI-INF/blueprint/blueprint.xml; } @Override protected Properties useOverridePropertiesWithPropertiesComponent() { Properties extra = new Properties(); extra.put(service.address, http://localhost:+(num)); return extra; } - cm:property-placeholder persistent-id=my-placeholders cm:default-properties cm:property name=service.address value= / /cm:default-properties /cm:property-placeholder cxf:cxfEndpoint id=routerEndpoint address={{service.address}}/CxfMtomRouterPayloadModeTest/jaxws-mtom/hello -- View this message in context: http://camel.465427.n5.nabble.com/My-camel-CXF-tests-fails-if-they-run-together-tp696559p5729852.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Clearing ThreadLocal when exchange completes
If you're willing to implement a custom policy, you could implement onEchangeDone() http://camel.apache.org/maven/current/camel-core/apidocs/org/apache/camel/spi/RoutePolicy.html#onExchangeDone%28org.apache.camel.Route,%20org.apache.camel.Exchange%29 You could subclass RoutePolicySupport and override onExchangeDone, which is a no-op there. The route would look like: from(jms:somequeue) .routeId(my.route).routePolicyRef(cleanupPolicy) .processRef(someRandomProcessor) .processRef(someProcessorThatSetsThreadLocalValue) .to(jms:someotherqueue) N.B. the route must have an explicit ID for the policy to find it. On Tue, Mar 26, 2013 at 9:13 AM, davelund david.r.l...@gmail.com wrote: We are currently using ThreadLocal to store some information that gets included in a log4j converter (and is used in other projects that dont have camel in). Is there a callback I can use that for all routes in my context so that at the end of the route it will get called (without explicitly setting it) For example: from(jms:somequeue) .processRef(someRandomProcessor) .processRef(someProcessorThatSetsThreadLocalValue) .to(jms:someotherqueue) Ideally I'd like the threadlocal cleared when the exchange has been written to the queue, without adding a processor that explicitly clears it (as developers when adding new routes will forget to do it). I know the onCompletion runs in a seperate thread so isn't fit for my purpose. I've noticed syncronisations and unitofworks, but cant seem to find any documentation on it. Would this be fit for purpose? -- View this message in context: http://camel.465427.n5.nabble.com/Clearing-ThreadLocal-when-exchange-completes-tp5729849.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Clearing ThreadLocal when exchange completes
Hi David, The cleanest and most modular way to achieve this is by using EventNotifiers [1], as they execute synchronously. Enable only the ExchangeCompletedEvent and add the bean to your registry. The CamelContext will pick it up automatically. Beware of the Asynchronous Routing Engine, as it can inadvertently change the thread in which the response from an endpoint gets processed [2]. Let us know if this helped. [1] http://camel.apache.org/eventnotifier-to-log-details-about-all-sent-exchanges.html [2] http://camel.apache.org/asynchronous-routing-engine.html *Raúl Kripalani* Enterprise Architect, Open Source Integration specialist, Program Manager | Apache Camel Committer http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Tue, Mar 26, 2013 at 1:13 PM, davelund david.r.l...@gmail.com wrote: We are currently using ThreadLocal to store some information that gets included in a log4j converter (and is used in other projects that dont have camel in). Is there a callback I can use that for all routes in my context so that at the end of the route it will get called (without explicitly setting it) For example: from(jms:somequeue) .processRef(someRandomProcessor) .processRef(someProcessorThatSetsThreadLocalValue) .to(jms:someotherqueue) Ideally I'd like the threadlocal cleared when the exchange has been written to the queue, without adding a processor that explicitly clears it (as developers when adding new routes will forget to do it). I know the onCompletion runs in a seperate thread so isn't fit for my purpose. I've noticed syncronisations and unitofworks, but cant seem to find any documentation on it. Would this be fit for purpose? -- View this message in context: http://camel.465427.n5.nabble.com/Clearing-ThreadLocal-when-exchange-completes-tp5729849.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Links to empty pages on website?
Ok, it's fixed now. You may have to delete your browser cache... Best, Christian On Mon, Mar 25, 2013 at 11:23 PM, Christian Müller christian.muel...@gmail.com wrote: Thanks for reporting. I opened a JIRA to track this [1]. It has something to do with our WIKI export. In the meantime, you can read the news also from our WIKI page [2]. [1] https://issues.apache.org/jira/browse/CAMEL-6210 [2] https://cwiki.apache.org/confluence/display/CAMEL/Index Sorry for the inconvenience, Christian On Mon, Mar 25, 2013 at 10:31 PM, Larry Meadors larry.mead...@gmail.comwrote: Every one in the news section. Larry On Mon, Mar 25, 2013 at 3:29 PM, Christian Müller christian.muel...@gmail.com wrote: Which link do you talking about? Best, Christian Sent from a mobile device Am 25.03.2013 15:33 schrieb James Green james.mk.gr...@gmail.com: Here I am suggesting to my boss that if he wants event broadcast and monitoring systems he should seriously check out camel, and each of the news items on the home page links to a page with empty content. Not good! Can someone fix the content to look at least moderately professional? Thanks, James
Re: How to schedule FTP with quartz?
Pontus, I actually gave up on CronScheduledRoutePolicy because I don't want to have to calculate an absolute suspend time based on the start/resume time. What I need is a cron-based policy that specifies the initial start time, which there-after becomes the resume time - this is a cron expression - then I just want a relative run duration, after which, the route is suspended until the next cron-specified resume time. So, after a few days, I finally have that and it works in the unit test - even the initial one-off route start will transparently switch to a resume schedule. The only problem is that I really need this policy to control a route with an FTP consumer. What I'm seeing is that even though the route is suspended, the FTP consumer continues to poll - this partially answers my question about the coding of ScheduleRoutePolicy - which only suspends the consumer - not the route, itself. While my policy suspends the route. I suspect that any route which has a component using PollingConsumerPollStrategy will not behave as I though - which is - you only need to suspend the route and all it's components will be suspended. My suspicion is that components whose Consumers are under the influence of PollingConsumerPollStrategy may not suspend by only suspended the route. -Chris On Sat, Mar 23, 2013 at 3:15 AM, Pontus Ullgren ullg...@gmail.com wrote: This is probably because your route is autoStart=false. So you the first time you need to start it. In my example you see I set both the start and resume schedule to the same cron expression. So the policy will trigger both a start and a resume action. And you will get a WARN log since the first time it can not resume (but it will start) and after that it can not start but it will resume. Perhaps if you share some code it would be easier to help you. //Pontus On 22 Mar 2013 22:06, Chris Wolf cwolf.a...@gmail.com wrote: I found the issue with my custom CronScheduledRoutePolicy - initially the startTime/resumeTime are only scheduled in onInit() - so to re-resume (re-start), you need to call scheduleRoute(Action.RESUME, route); in onStart() ...but now I'm getting: quartz.ScheduledRoutePolicy WARN Route is not in a started state and cannot be resumed. The current route state is Suspended What is the deal? I thought resumeRoute was the inverse of suspenRoute, but this log message seems to indicate that calling CamelContext.suspendRoute(routeId) will put the route into a state that cannot be resumed. Thanks, Chris On Fri, Mar 22, 2013 at 4:04 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, Thanks for that. Since I already has started implementing a class derived from CronScheduledRoutePolicy, I just finished it. It works by starting a Timer thread in onStart/onResume at the end of the time period, the route is suspended, but then upon the next schedule cron start time, I don't see it being resumed - I wonder if the RoutePolicy itself is being suspend too? Well, I try it your way also. Thanks, Chris On Wed, Mar 20, 2013 at 4:34 AM, Pontus Ullgren ullg...@gmail.com wrote: Hello, On Tue, Mar 19, 2013 at 11:22 PM, Chris Wolf cwolf.a...@gmail.com wrote: On Mon, Mar 18, 2013 at 4:57 PM, Pontus Ullgren ullg...@gmail.com wrote: Hello Chris, On Mon, Mar 18, 2013 at 8:54 PM, Chris Wolf cwolf.a...@gmail.com wrote: Claus, I have a few further questions about CronScheduledRoutePolicy. I noticed that it has setters such as setRouteStartTime, setRouteStopTime, each which takes a cron expression string. What I'm looking for is to be able to use a cron expression for the start, but a relative time length for stop. Otherwise, I need to write code to parse the start time expression, then calculate a stop time cron expression. Any ideas? Depending on your needs you could enable sendEmptyMessageWhenIdle on the endpoint and then suspend the route when you receive a empty message. Which means that there is no more files to poll at the moment. You can use the content based route EIP for this. That is interesting to know, thanks. In my case, the files at the remote end are themselves deposited at an irregular rate, but within a defined time window, so during that time window, there will be intermittent idleness... Another solution would be to write your own RoutePolicy to take care of your needs. Yes, this sounds like the best approach... I just started to wonder if it might be possible to combine the CronScheduledRoutePolicy with a SimpleScheduledRoutePolicy. I have _not_ tested this so I'm not sure if it works. It might be that there is a collision in the way they work with Quartz. Also I see that CronScheduledRoutePolicy has setRouteResumeTime, setRouteSuspendTime such that for my FTP poll window, I could either do start/stop or resume/suspend - which is recommended? I would highly recommend
Re: Camel velocity template internationalization
Claus, Thanks for the reply. I could have locale setup as JVM argument, but could you please provide information about property or header I need to set in exchange for locale, if I plan to have language/locale per exchange. Could you please elaborate on how camel uses locale property, I mean does it set's system default locale, I want to know how locale propagates between different frameworks/APIs. Is there any standard parameter defined. Thanks and Regards, Paramjyot -- View this message in context: http://camel.465427.n5.nabble.com/Camel-velocity-template-internationalization-tp5729574p5729861.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SMPP stop route problem
In the SMPP specification, the error code '0x00FF' (which is 255) is documented as Unknow error. It doesn't look wrong to me. If you want to return another error code, simply catch the exception in your route and rethrow an org.jsmpp.extra.ProcessRequestException (with the error code you want) which is returned to the SMSC. Sounds right? In general Camel will first stop the consumer on a route (from smpp://...) so that you will not receive further requests. By default, Camel will shut down gracefully [1]. Do you need more than 5 minutes to shut down? In this case (you should really think about your architecture), it could be happen that you do not ack the message because Camel forced the shut down. But in this case I would expect the SMSC should resend the message. [1] http://camel.apache.org/graceful-shutdown.html Best, Christian On Tue, Mar 26, 2013 at 2:11 PM, fclose f...@closebase.com wrote: I'll looked in the code and the only place I found that an error code could be generated is in org.apache.camel.component.smpp.MessageReceiverListenerImpl line 105 this seems to send back to the smsc an error 255, which is unkown to the smsc. I'll try to confirm that the error is really happening in MessageReceiverListenerImpl.onAcceptDataSm() If this is the case, does it mean, that there's a problem when we still receive messages and the route is in the process of stopping itself ? -- View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729848.html Sent from the Camel - Users mailing list archive at Nabble.com.
CamelOne 2013 Call for Papers closing 14th April 2013.
We want the Apache Camel community to be heard at this years CamelOne! This is the third year of CamelOne, the conference designed for professionals using open source integration and messaging solutions in the enterprise, specifically Apache Camel, ServiceMix, ActiveMQ, Karaf and CXF. The conference will feature a mixture of educational sessions and network events that will enable attendees to meet, learn and share ideas with other members of the open source community. CamelOne 2013 is being held in Boston this year from June 10 - 11th, and you are key to making this year a success. Please submit your war stories and hot topics for talks at the call for papers here - http://camelone.com/apache-camel-conference-2013/cfp/ , and help us make this the best CamelOne yet! thanks, Rob
Re: Smpp stop route recommendations
Please find my comments inline in your mail. Best, Christian On Fri, Mar 22, 2013 at 11:32 AM, fclose f...@closebase.com wrote: Hello, I have configured a route listening for incoming sms messages. We did a mini load test with 2 messages / seconds. this works perfectly but we have a problem when we stop the route, at that time we seem to lose messages What do you mean exactly by loosing messages? The message arrived in your Camel consumer but not in the producer? What did you received from this Camel endpoint in this case? smsc considers that 2 messages were rejected *before *the unbind. So, I have 2 questions: 1/ how would you advise stopping that route ? currently what I'm doing is (simply) camelContext.stopRoute(routeId); This is correct. The DefaultShutdownStrategy ( http://camel.apache.org/graceful-shutdown.html) will shut down your route gracefully. 2/ the route is only receiving sms not sending any it is configured with registeredDelivery = 0 which means : No SMSC delivery receipt requested. No, in this case this option has no effect. It's used to *REQUEST* the SMSC to send a receipt for the case your application has sent a short message and you want to know whether and when the short message was delivered. Should I not use 1 instead of 0 ? possible values: 0: No SMSC delivery receipt requested. 1: SMSC delivery receipt requested where final delivery outcome is success or failure. 2: SMSC delivery receipt requested where the final delivery outcome is delivery failure. -- View this message in context: http://camel.465427.n5.nabble.com/Smpp-stop-route-recommendations-tp5729666.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Route starts when deployed with a cxf endpoint
This route doesn't has an autoStart configuration which means it's started by default. Do I miss something? Best, Christian On Mon, Mar 25, 2013 at 8:34 AM, dkum003 dhananjay.ku...@amadeus.comwrote: Hello Christian, The camel version is 2.10.2 and the route is - from(ftp://ipadress).process(processor()).to (cxf://http://ipadress?serviceName=XXXServiceportName=YYYPort); Regards, Dhananjay -- View this message in context: http://camel.465427.n5.nabble.com/Route-starts-when-deployed-with-a-cxf-endpoint-tp5729593p5729741.html Sent from the Camel - Users mailing list archive at Nabble.com.
Performance puzzle. Slow splitter on object array?
Hi all, We have a very strange performace issue that we think we have narrowed down to a splitter using the hawtio tool (Which is awesome by the way). In the image below the mean processing time tooltip is from the splitter on ${body}. The rest of the endpoints take 1-4ms with the two activemq-vm endpoints in the multicast taknig about 150ms each. https://dl.dropbox.com/u/10007025/hbird/tuning/SlowSplitting2.PNG We think this means that the splitter is taking about 29 seconds to split a list of Objects. We've tried different list sizes, if there are 2 it is quicker, about 500ms, if we go up to 400 it can take 30 seconds per exchange! We are running everything in karaf, our software, activemq and camel. The list contents are always of this class: https://github.com/JohannesKlug/hbird/blob/master/src/core/commons/src/main/java/org/hbird/core/commons/data/GenericPayload.java We have created a little camel integration/unit test. In this the splitter seems comparable to a list of String objects so we don't think there is anything unexpected going on in this class. Thanks in advance for any tips/suggestions. -- View this message in context: http://camel.465427.n5.nabble.com/Performance-puzzle-Slow-splitter-on-object-array-tp5729867.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to schedule FTP with quartz?
Chris, Is there no way for you to calculate a cron expression for when the suspend should occure ? Say that you want the route to start every 10 minutes (starting at 0) and run for 5 minutes then suspend. This would mean that you should be able to define the start/resume cron as 0 0,10,20,30,40,50 * * * * ?. And the suspend cron expression as 0 5,15,25,35,45,55 * * * * ?. The CronScheduledRoutePolicy will trigger a start/resum at 00:00:00 and then a suspend at 00:05:00, then a new start/resume at 00:10:00 and a new suspends at 00:15:00 and so on. // Pontus On Tue, Mar 26, 2013 at 7:39 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, I actually gave up on CronScheduledRoutePolicy because I don't want to have to calculate an absolute suspend time based on the start/resume time. What I need is a cron-based policy that specifies the initial start time, which there-after becomes the resume time - this is a cron expression - then I just want a relative run duration, after which, the route is suspended until the next cron-specified resume time. So, after a few days, I finally have that and it works in the unit test - even the initial one-off route start will transparently switch to a resume schedule. The only problem is that I really need this policy to control a route with an FTP consumer. What I'm seeing is that even though the route is suspended, the FTP consumer continues to poll - this partially answers my question about the coding of ScheduleRoutePolicy - which only suspends the consumer - not the route, itself. While my policy suspends the route. I suspect that any route which has a component using PollingConsumerPollStrategy will not behave as I though - which is - you only need to suspend the route and all it's components will be suspended. My suspicion is that components whose Consumers are under the influence of PollingConsumerPollStrategy may not suspend by only suspended the route. -Chris On Sat, Mar 23, 2013 at 3:15 AM, Pontus Ullgren ullg...@gmail.com wrote: This is probably because your route is autoStart=false. So you the first time you need to start it. In my example you see I set both the start and resume schedule to the same cron expression. So the policy will trigger both a start and a resume action. And you will get a WARN log since the first time it can not resume (but it will start) and after that it can not start but it will resume. Perhaps if you share some code it would be easier to help you. //Pontus On 22 Mar 2013 22:06, Chris Wolf cwolf.a...@gmail.com wrote: I found the issue with my custom CronScheduledRoutePolicy - initially the startTime/resumeTime are only scheduled in onInit() - so to re-resume (re-start), you need to call scheduleRoute(Action.RESUME, route); in onStart() ...but now I'm getting: quartz.ScheduledRoutePolicy WARN Route is not in a started state and cannot be resumed. The current route state is Suspended What is the deal? I thought resumeRoute was the inverse of suspenRoute, but this log message seems to indicate that calling CamelContext.suspendRoute(routeId) will put the route into a state that cannot be resumed. Thanks, Chris On Fri, Mar 22, 2013 at 4:04 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, Thanks for that. Since I already has started implementing a class derived from CronScheduledRoutePolicy, I just finished it. It works by starting a Timer thread in onStart/onResume at the end of the time period, the route is suspended, but then upon the next schedule cron start time, I don't see it being resumed - I wonder if the RoutePolicy itself is being suspend too? Well, I try it your way also. Thanks, Chris On Wed, Mar 20, 2013 at 4:34 AM, Pontus Ullgren ullg...@gmail.com wrote: Hello, On Tue, Mar 19, 2013 at 11:22 PM, Chris Wolf cwolf.a...@gmail.com wrote: On Mon, Mar 18, 2013 at 4:57 PM, Pontus Ullgren ullg...@gmail.com wrote: Hello Chris, On Mon, Mar 18, 2013 at 8:54 PM, Chris Wolf cwolf.a...@gmail.com wrote: Claus, I have a few further questions about CronScheduledRoutePolicy. I noticed that it has setters such as setRouteStartTime, setRouteStopTime, each which takes a cron expression string. What I'm looking for is to be able to use a cron expression for the start, but a relative time length for stop. Otherwise, I need to write code to parse the start time expression, then calculate a stop time cron expression. Any ideas? Depending on your needs you could enable sendEmptyMessageWhenIdle on the endpoint and then suspend the route when you receive a empty message. Which means that there is no more files to poll at the moment. You can use the content based route EIP for this. That is interesting to know, thanks. In my case, the files at the remote end are themselves deposited at an irregular rate, but within a defined time window, so during that time window, there will be
Re: How to schedule FTP with quartz?
Sorry read your message a bit to quick. If you do not want to calculate the suspend cron expression I guess you need to mimic the behaviour of org.apache.camel.routepolicy.quartz.ScheduledRoutePolicy where (as you point out in another email) the consumer is suspended and not the route. I'm sorry can not explain why it's implemented this way, I just know that in the case of the existing scheduled route policies it seem to work as expected. :-) Hopefully somebody with more knowledge of the in and outs of Camel can explain this to us both. // Pontus On Tue, Mar 26, 2013 at 9:12 PM, Pontus Ullgren ullg...@gmail.com wrote: Chris, Is there no way for you to calculate a cron expression for when the suspend should occure ? Say that you want the route to start every 10 minutes (starting at 0) and run for 5 minutes then suspend. This would mean that you should be able to define the start/resume cron as 0 0,10,20,30,40,50 * * * * ?. And the suspend cron expression as 0 5,15,25,35,45,55 * * * * ?. The CronScheduledRoutePolicy will trigger a start/resum at 00:00:00 and then a suspend at 00:05:00, then a new start/resume at 00:10:00 and a new suspends at 00:15:00 and so on. // Pontus On Tue, Mar 26, 2013 at 7:39 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, I actually gave up on CronScheduledRoutePolicy because I don't want to have to calculate an absolute suspend time based on the start/resume time. What I need is a cron-based policy that specifies the initial start time, which there-after becomes the resume time - this is a cron expression - then I just want a relative run duration, after which, the route is suspended until the next cron-specified resume time. So, after a few days, I finally have that and it works in the unit test - even the initial one-off route start will transparently switch to a resume schedule. The only problem is that I really need this policy to control a route with an FTP consumer. What I'm seeing is that even though the route is suspended, the FTP consumer continues to poll - this partially answers my question about the coding of ScheduleRoutePolicy - which only suspends the consumer - not the route, itself. While my policy suspends the route. I suspect that any route which has a component using PollingConsumerPollStrategy will not behave as I though - which is - you only need to suspend the route and all it's components will be suspended. My suspicion is that components whose Consumers are under the influence of PollingConsumerPollStrategy may not suspend by only suspended the route. -Chris On Sat, Mar 23, 2013 at 3:15 AM, Pontus Ullgren ullg...@gmail.com wrote: This is probably because your route is autoStart=false. So you the first time you need to start it. In my example you see I set both the start and resume schedule to the same cron expression. So the policy will trigger both a start and a resume action. And you will get a WARN log since the first time it can not resume (but it will start) and after that it can not start but it will resume. Perhaps if you share some code it would be easier to help you. //Pontus On 22 Mar 2013 22:06, Chris Wolf cwolf.a...@gmail.com wrote: I found the issue with my custom CronScheduledRoutePolicy - initially the startTime/resumeTime are only scheduled in onInit() - so to re-resume (re-start), you need to call scheduleRoute(Action.RESUME, route); in onStart() ...but now I'm getting: quartz.ScheduledRoutePolicy WARN Route is not in a started state and cannot be resumed. The current route state is Suspended What is the deal? I thought resumeRoute was the inverse of suspenRoute, but this log message seems to indicate that calling CamelContext.suspendRoute(routeId) will put the route into a state that cannot be resumed. Thanks, Chris On Fri, Mar 22, 2013 at 4:04 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, Thanks for that. Since I already has started implementing a class derived from CronScheduledRoutePolicy, I just finished it. It works by starting a Timer thread in onStart/onResume at the end of the time period, the route is suspended, but then upon the next schedule cron start time, I don't see it being resumed - I wonder if the RoutePolicy itself is being suspend too? Well, I try it your way also. Thanks, Chris On Wed, Mar 20, 2013 at 4:34 AM, Pontus Ullgren ullg...@gmail.com wrote: Hello, On Tue, Mar 19, 2013 at 11:22 PM, Chris Wolf cwolf.a...@gmail.com wrote: On Mon, Mar 18, 2013 at 4:57 PM, Pontus Ullgren ullg...@gmail.com wrote: Hello Chris, On Mon, Mar 18, 2013 at 8:54 PM, Chris Wolf cwolf.a...@gmail.com wrote: Claus, I have a few further questions about CronScheduledRoutePolicy. I noticed that it has setters such as setRouteStartTime, setRouteStopTime, each which takes a cron expression string. What I'm looking for is to be able to use a cron expression for the start, but
Re: Performance puzzle. Slow splitter on object array?
Can you share your splitter definition? Best, Christian On Tue, Mar 26, 2013 at 8:31 PM, MarkD markjohndo...@googlemail.com wrote: Hi all, We have a very strange performace issue that we think we have narrowed down to a splitter using the hawtio tool (Which is awesome by the way). In the image below the mean processing time tooltip is from the splitter on ${body}. The rest of the endpoints take 1-4ms with the two activemq-vm endpoints in the multicast taknig about 150ms each. https://dl.dropbox.com/u/10007025/hbird/tuning/SlowSplitting2.PNG We think this means that the splitter is taking about 29 seconds to split a list of Objects. We've tried different list sizes, if there are 2 it is quicker, about 500ms, if we go up to 400 it can take 30 seconds per exchange! We are running everything in karaf, our software, activemq and camel. The list contents are always of this class: https://github.com/JohannesKlug/hbird/blob/master/src/core/commons/src/main/java/org/hbird/core/commons/data/GenericPayload.java We have created a little camel integration/unit test. In this the splitter seems comparable to a list of String objects so we don't think there is anything unexpected going on in this class. Thanks in advance for any tips/suggestions. -- View this message in context: http://camel.465427.n5.nabble.com/Performance-puzzle-Slow-splitter-on-object-array-tp5729867.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel velocity template internationalization
Camel doesn't care about the locale. I suggest to have a look how Velocity/Freemarker/... lookup the locale. Than we can see how we can support it (or whether we already support it). Best, Christian On Tue, Mar 26, 2013 at 7:44 PM, paramjyotsingh paramjyotsi...@gmail.comwrote: Claus, Thanks for the reply. I could have locale setup as JVM argument, but could you please provide information about property or header I need to set in exchange for locale, if I plan to have language/locale per exchange. Could you please elaborate on how camel uses locale property, I mean does it set's system default locale, I want to know how locale propagates between different frameworks/APIs. Is there any standard parameter defined. Thanks and Regards, Paramjyot -- View this message in context: http://camel.465427.n5.nabble.com/Camel-velocity-template-internationalization-tp5729574p5729861.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: SMPP stop route problem
Hello Christian thanks for your answer, I'll ask the SMSC specialist why the error 255 is unknown at the smsc level (could depend on the smsc manufacturer ?). Concerning the stop of the route, I saw in the logs that a gracefull shutdown happens [logs], it happens fast (1 second) but the route is receiving 2 messages per second and I have the feeling that a message is still received by the consumer after the stop and that's when the problem appears. I'll redo some tests tomorrow and I hope I'll be able to confirm that. In the logs, I can see that is shutting down with CompleteCurrentTaskOnly option, are there other options for the stop of an individual route ? [logs] 2013-03-22 15:22:43,346 DEBUG There are 1 routes to shutdown 2013-03-22 15:22:43,347 TRACE Shutting down route: smsReceivingRoute with options [Default,CompleteCurrentTaskOnly] 2013-03-22 15:22:43,348 TRACE Suspending: SmppConsumer[smpp://***] 2013-03-22 15:22:43,349 TRACE Suspend complete for: SmppConsumer[smpp://**] 2013-03-22 15:22:43,351 DEBUG Route: smsReceivingRoute suspended and shutdown deferred, was consuming from: Endpoint[smpp://***] 2013-03-22 15:22:43,352 TRACE Shutting down: SmppConsumer[smpp://] 2013-03-22 15:22:43,352 DEBUG Disconnecting from: smpp://... 2013-03-22 15:22:43,352 DEBUG Stopping consumer: SmppConsumer[smpp://] 2013-03-22 15:22:44,363 DEBUG Activity notified 2013-03-22 15:22:44,364 INFO PDUReaderWorker stop 2013-03-22 15:22:44,365 DEBUG unbind response received 2013-03-22 15:22:44,366 INFO Disconnected from: smpp:// 2013-03-22 15:22:44,367 TRACE Shutdown complete for: SmppConsumer[smpp://] 2013-03-22 15:22:44,370 INFO Route: smsReceivingRoute shutdown complete, was consuming from: Endpoint[smpp://] 2013-03-22 15:22:44,370 INFO Graceful shutdown of 1 routes completed in 1 seconds 2013-03-22 15:22:44,372 INFO Route: smsReceivingRoute is stopped, was consuming from: Endpoint[smpp://] 2013-03-22 15:22:44,373 INFO Status Started waiting for stopped. 2013-03-22 15:22:44,507 INFO EnquireLinkSender stop -- View this message in context: http://camel.465427.n5.nabble.com/SMPP-stop-route-problem-tp5729769p5729872.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Performance puzzle. Slow splitter on object array?
Of course, i'll paste the entire route: route id=udpBroadcastReceive from uri=netty:{{broadcastTmProtocol}}://{{broadcastTmHost}}:{{broadcastTmPort}}?receiveBufferSizePredictor=65536amp;decoders=#broadcastDecoderamp;sync=false / split parallelProcessing=true streaming=true simple${body}/simple to uri=bean:payloadCodec?method=decode(GenericPayload)/ multicast parallelProcessing=true streaming=true to uri=activemq-vm:topic:parameterGroupsOut / to uri=activemq-vm:topic:parameterGroupsUnsplit / /multicast /split /route You'll notice this is slightly different to the hawtio diagram. The from seda:udp endpoint which started the route in the image was a product of us making sure it wasn't the netty endpoint/codec causing the bottleneck. It wasn't so we put the route back to the one pasted above. The parallelProcessing and streaming options were adding just in case. The website says they are false by default but the xsd claims they are true :) As you can see it's literally a simple expression on the in body. -- View this message in context: http://camel.465427.n5.nabble.com/Performance-puzzle-Slow-splitter-on-object-array-tp5729867p5729873.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: from databaes to other
Because you do not provide the proper insert statements. Like INSERT INTO FOO (...) VALUES (...). Best, Christian On Tue, Mar 26, 2013 at 2:07 PM, takidean takide...@hotmail.fr wrote: hi everybody when i use to send rows from database to an other it don't work this is what i did: choice when xpath/person/city = 'SMON'/xpath setBody constantSELECT * FROM REPORT.T_INCIDENT WHERE INCIDENT_REF = '001' OR INCIDENT_REF = '002';/constant /setBody to uri=jdbc:reportdb/ to uri=jdbc:db/ /when any one can help me ? -- View this message in context: http://camel.465427.n5.nabble.com/from-databaes-to-other-tp5729847.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Integrating 2 deployable units (containing camel routes)
The direct-vm components is based on the direct component and it's a synchronous invocation. The vm component is based on the seda component and it's an asynchronous invocation. We may should update or WIKI page about using this components in OSGI world. I do not have any experience using WAR deployments and OSGI bundles together... Another option is to register a service in the OSGI registry which can be looked up and used by the other one. Best, Christian On Tue, Mar 26, 2013 at 10:50 AM, ddewaele ddewa...@gmail.com wrote: Hi Christian, I was a bit confused by the documentation (does the direct-vm contain a copy/paste error ? It basically says the same as on the vm page). Both support communication across CamelContext instances but yet they differ ? It's also not clear that both can be used for inter OSGI bundle communication. *VM* VM supports communication across CamelContext instances - so you can use this mechanism to communicate across web applications (provided that camel-core.jar is on the system/boot classpath). *Direct-VM* This component differs from the Direct component in that Direct-VM supports communication across CamelContext instances - so you can use this mechanism to communicate across web applications (provided that camel-core.jar is on the system/boot classpath). I used the direct-vm and it does work accross bundles. However, in our case we have 1 Camel route defined in a OSGI bundle (bootstrapped using spring using an OSGI blueprint extender), while another Camel route is defined in a WAR file (the osgi frameworks wraps the war file in an OSGI bundle). I noticed that the route from the WAR file can not send messages using direct-vm to a route in a bundle. A route from a bundle can send a message to a route in another bundle. So I guess I have 2 options : 1. Move the camel route from the WAR into an actual OSGI bundle, put everything in the same EBA and use vm or direct-vm 2. Keep the 2 EBAs seperate (isolated) and integrate them using JMS. -- View this message in context: http://camel.465427.n5.nabble.com/Integrating-2-deployable-units-containing-camel-routes-tp5729827p5729841.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: oracle.jms.AQjmsFactory and javax.sql.DataSource
In BasicDataSource you can configure whether you will get the underlying connection or a proxy ( accessToUnderlyingConnectionAllowed) . Getting the proxy is the default configuration. May this solves your issue. Best, Christian Sent from a mobile device Am 19.03.2013 15:25 schrieb jinaLu jina...@yahoo.com: I tried like this. In fuseEsb etc xml file I have config: bean id=oracle-AQ class=org.apache.commons.dbcp.BasicDataSource destroy-method=close property name=driverClassName value=oracle.jdbc.OracleDriver/ property name=url value=jdbc:oracle:thin:@ (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=10.10.10)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=mydb)))/ property name=username value=db/ property name=password value=password/ property name=validationQuery value=SELECT 1 FROM DUAL/ /bean bean id=jdbc-oracle-AQ class=lt.etic.smx.tools.cfgmgr.impl.jdbc.JdbcConnectionProbe constructor-arg index=0 value=31000/ property name=dataSource ref=oracle-AQ/ property name=probeQuery value=SELECT 2 FROM DUAL/ /bean In my blueprint xml I have: blueprint:reference id=DBC interface=javax.sql.DataSource filter=(name=oracle-AQ)/ blueprint:bean id=connectionFactoryOracleAQQueue class=oracle.jms.AQjmsFactory factory-method=getQueueConnectionFactory blueprint:argument ref=DBC / /blueprint:bean blueprint:bean id=oracleQueue class=org.apache.camel.component.jms.JmsComponent blueprint:property name=connectionFactory ref=connectionFactoryOracleAQQueue / /blueprint:bean My ruoteBuilder has: from(direct:test) .to(oracleQueue:queue:AQ_Q) But unfortunately I'm getting Caused by: java.lang.ClassCastException: org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.internal.OracleConnection. Any ideas? -- View this message in context: http://camel.465427.n5.nabble.com/oracle-jms-AQjmsFactory-and-javax-sql-DataSource-tp5729223p5729423.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Question about the implementation of routepolicy.quartz.ScheduledRoutePolicy
You don't want to stop all endpoints in the route because there may be inflight Exchanges. Instead, you want to stop the inflow of new messages whilst you keep processing any inflight exchanges. That said, it's safe to stop the entire route (including endpoints) once all inflight exchanges are completed (or immediately if none are alive) – as keeping endpoints started unnecessarily could be a waste of resources. Please feel free to log a JIRA. On the other hand, all routes start with a consumer of some kind. Mind you, it doesn't have to listen on an external protocol. Take for example the direct, seda or timer components, which are virtual endpoints. Regards, *Raúl Kripalani* Enterprise Architect, Open Source Integration specialist, Program Manager | Apache Camel Committer http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Mon, Mar 25, 2013 at 8:08 PM, Chris Wolf cwolf.a...@gmail.com wrote: I am looking at code in org.apache.camel.routepolicy.quartz.ScheduledRoutePolicy - the code that starts/stops/resumes/suspends the route it is a policy for. The question is why is it separately acting on the Consumer? I thought if you call CamelContext.suspendRoute(route) and/or CamelContext.resumeRoute(route), that all the components in the route are suspended/resumed as well? Secondly, why does this code assume there is a Consumer? What if the route has a Producer? I am not being critical - I just want to understand, generally how route suspend/resume works since I am implementing a similar RoutePolicy. Thanks, -Chris protected void onJobExecute(Action action, Route route) throws Exception { [...] } else if (action == Action.SUSPEND) { if (routeStatus == ServiceStatus.Started) { stopConsumer(route.getConsumer()); } else { LOG.warn(Route is not in a started state and cannot be suspended. The current route state is {}, routeStatus); } } else if (action == Action.RESUME) { if (routeStatus == ServiceStatus.Started) { if (ServiceHelper.isSuspended(route.getConsumer())) { startConsumer(route.getConsumer()); } else { LOG.warn(The Consumer {} is not suspended and cannot be resumed., route.getConsumer()); } [...]
Re: got FatalFallbackErrorHandler when trying handing error with bean
Christian Mueller wrote I think your appErrorHandler is throwing an exception. Can you check this!? There is no exception on method onTimeOutException in app ErrorHandler the org.apache.camel.ExchangeTimedOutException came from MinaProducer, because time out occured. the org.apache.camel.CamelExecutionException came from wrapCamelExecutionException from ExpressionBuilder, because Body is null. overall route in my app: [jetty http]-[seda]-[mina] -- View this message in context: http://camel.465427.n5.nabble.com/got-FatalFallbackErrorHandler-when-trying-handing-error-with-bean-tp5729828p5729883.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to schedule FTP with quartz?
Pontus, Ok, I got rid of my RoutePolicy and put back the CronScheduledRoutePolicy and provided both start and resume cron schedules as you suggested, but CronScheduledRoutePolicy has the same issue as my RoutePolicy - suspending the FTPConsumer does NOT stop it from continuing to poll! 56:30,001 CronScheduledRoutePolicy DEBUG Suspended consumer FtpConsumer[ftp://localhost/download?filter=%23cpmdFileFilternoop=truepassword=**username=adpt5] 56:35,100 FtpConsumerWARN Cannot connect/login to: ftp://adpt5@localhost:21. Will skip this poll. 56:35,100 FtpConsumerDEBUG Skipping poll as pre poll check returned false -Chris On Tue, Mar 26, 2013 at 4:12 PM, Pontus Ullgren ullg...@gmail.com wrote: Chris, Is there no way for you to calculate a cron expression for when the suspend should occure ? Say that you want the route to start every 10 minutes (starting at 0) and run for 5 minutes then suspend. This would mean that you should be able to define the start/resume cron as 0 0,10,20,30,40,50 * * * * ?. And the suspend cron expression as 0 5,15,25,35,45,55 * * * * ?. The CronScheduledRoutePolicy will trigger a start/resum at 00:00:00 and then a suspend at 00:05:00, then a new start/resume at 00:10:00 and a new suspends at 00:15:00 and so on. // Pontus On Tue, Mar 26, 2013 at 7:39 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, I actually gave up on CronScheduledRoutePolicy because I don't want to have to calculate an absolute suspend time based on the start/resume time. What I need is a cron-based policy that specifies the initial start time, which there-after becomes the resume time - this is a cron expression - then I just want a relative run duration, after which, the route is suspended until the next cron-specified resume time. So, after a few days, I finally have that and it works in the unit test - even the initial one-off route start will transparently switch to a resume schedule. The only problem is that I really need this policy to control a route with an FTP consumer. What I'm seeing is that even though the route is suspended, the FTP consumer continues to poll - this partially answers my question about the coding of ScheduleRoutePolicy - which only suspends the consumer - not the route, itself. While my policy suspends the route. I suspect that any route which has a component using PollingConsumerPollStrategy will not behave as I though - which is - you only need to suspend the route and all it's components will be suspended. My suspicion is that components whose Consumers are under the influence of PollingConsumerPollStrategy may not suspend by only suspended the route. -Chris On Sat, Mar 23, 2013 at 3:15 AM, Pontus Ullgren ullg...@gmail.com wrote: This is probably because your route is autoStart=false. So you the first time you need to start it. In my example you see I set both the start and resume schedule to the same cron expression. So the policy will trigger both a start and a resume action. And you will get a WARN log since the first time it can not resume (but it will start) and after that it can not start but it will resume. Perhaps if you share some code it would be easier to help you. //Pontus On 22 Mar 2013 22:06, Chris Wolf cwolf.a...@gmail.com wrote: I found the issue with my custom CronScheduledRoutePolicy - initially the startTime/resumeTime are only scheduled in onInit() - so to re-resume (re-start), you need to call scheduleRoute(Action.RESUME, route); in onStart() ...but now I'm getting: quartz.ScheduledRoutePolicy WARN Route is not in a started state and cannot be resumed. The current route state is Suspended What is the deal? I thought resumeRoute was the inverse of suspenRoute, but this log message seems to indicate that calling CamelContext.suspendRoute(routeId) will put the route into a state that cannot be resumed. Thanks, Chris On Fri, Mar 22, 2013 at 4:04 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, Thanks for that. Since I already has started implementing a class derived from CronScheduledRoutePolicy, I just finished it. It works by starting a Timer thread in onStart/onResume at the end of the time period, the route is suspended, but then upon the next schedule cron start time, I don't see it being resumed - I wonder if the RoutePolicy itself is being suspend too? Well, I try it your way also. Thanks, Chris On Wed, Mar 20, 2013 at 4:34 AM, Pontus Ullgren ullg...@gmail.com wrote: Hello, On Tue, Mar 19, 2013 at 11:22 PM, Chris Wolf cwolf.a...@gmail.com wrote: On Mon, Mar 18, 2013 at 4:57 PM, Pontus Ullgren ullg...@gmail.com wrote: Hello Chris, On Mon, Mar 18, 2013 at 8:54 PM, Chris Wolf cwolf.a...@gmail.com wrote: Claus, I have a few further questions about CronScheduledRoutePolicy. I noticed that it has setters such as setRouteStartTime, setRouteStopTime,
Re: Question about the implementation of routepolicy.quartz.ScheduledRoutePolicy
Thanks for the clarification on that. The only problem is that, when using CronScheduledRoutePolicy on a route with an FTP endpoint configured as a consumer, it does NOT seem to prevent the FTP consumer to stop polling even after it has supposedly been suspended. 56:30,001 CronScheduledRoutePolicy DEBUG Suspended consumer FtpConsumer[ftp://localhost/download?filter=%23cpmdFileFilternoop=truepassword=**username=adpt5] 56:35,100 FtpConsumerWARN Cannot connect/login to: ftp://adpt5@localhost:21. Will skip this poll. 56:35,100 FtpConsumerDEBUG Skipping poll as pre poll check returned false Any ideas? Thanks, Chris On Tue, Mar 26, 2013 at 9:11 PM, Raul Kripalani r...@evosent.com wrote: You don't want to stop all endpoints in the route because there may be inflight Exchanges. Instead, you want to stop the inflow of new messages whilst you keep processing any inflight exchanges. That said, it's safe to stop the entire route (including endpoints) once all inflight exchanges are completed (or immediately if none are alive) – as keeping endpoints started unnecessarily could be a waste of resources. Please feel free to log a JIRA. On the other hand, all routes start with a consumer of some kind. Mind you, it doesn't have to listen on an external protocol. Take for example the direct, seda or timer components, which are virtual endpoints. Regards, *Raúl Kripalani* Enterprise Architect, Open Source Integration specialist, Program Manager | Apache Camel Committer http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Mon, Mar 25, 2013 at 8:08 PM, Chris Wolf cwolf.a...@gmail.com wrote: I am looking at code in org.apache.camel.routepolicy.quartz.ScheduledRoutePolicy - the code that starts/stops/resumes/suspends the route it is a policy for. The question is why is it separately acting on the Consumer? I thought if you call CamelContext.suspendRoute(route) and/or CamelContext.resumeRoute(route), that all the components in the route are suspended/resumed as well? Secondly, why does this code assume there is a Consumer? What if the route has a Producer? I am not being critical - I just want to understand, generally how route suspend/resume works since I am implementing a similar RoutePolicy. Thanks, -Chris protected void onJobExecute(Action action, Route route) throws Exception { [...] } else if (action == Action.SUSPEND) { if (routeStatus == ServiceStatus.Started) { stopConsumer(route.getConsumer()); } else { LOG.warn(Route is not in a started state and cannot be suspended. The current route state is {}, routeStatus); } } else if (action == Action.RESUME) { if (routeStatus == ServiceStatus.Started) { if (ServiceHelper.isSuspended(route.getConsumer())) { startConsumer(route.getConsumer()); } else { LOG.warn(The Consumer {} is not suspended and cannot be resumed., route.getConsumer()); } [...]
Re: My camel-CXF tests fails, if they run together
Yeah, I think the better solution could be we can let the CamelBlueprintTestSupport support to create the context per test class. I will work on it today. -- 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 Tuesday, March 26, 2013 at 10:42 PM, milanmilas wrote: Similar issue with CamelBlueprintTestSupport. Resolution: public class RouteTest extends CamelBlueprintTestSupport { private static int num = 8567; @Override protected String getBlueprintDescriptor() { ++num; return /OSGI-INF/blueprint/blueprint.xml; } @Override protected Properties useOverridePropertiesWithPropertiesComponent() { Properties extra = new Properties(); extra.put(service.address, http://localhost:+(num)); return extra; } - cm:property-placeholder persistent-id=my-placeholders cm:default-properties cm:property name=service.address value= / /cm:default-properties /cm:property-placeholder cxf:cxfEndpoint id=routerEndpoint address={{service.address}}/CxfMtomRouterPayloadModeTest/jaxws-mtom/hello -- View this message in context: http://camel.465427.n5.nabble.com/My-camel-CXF-tests-fails-if-they-run-together-tp696559p5729852.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Re: got FatalFallbackErrorHandler when trying handing error with bean
There is no exception on method onTimeOutException in appErrorHandler. the org.apache.camel.ExchangeTimedOutException exception came from MinaProducer, because time out occured the org.apache.camel.CamelExecutionException exceptino came from camel ExpressionBuilder, error message is Body is null. overall my app route: [jetty http] - [seda] - [mina] -- View this message in context: http://camel.465427.n5.nabble.com/got-FatalFallbackErrorHandler-when-trying-handing-error-with-bean-tp5729828p5729881.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: RMI response
i figured it out... route from uri=rmi://localhost:1099/helloService?remoteInterfaces=com.test.HelloService/ *setExchangePattern pattern=InOut/* setBodysimpleHello ${body.args[0]}/simple/setBody /route now it works ... -- View this message in context: http://camel.465427.n5.nabble.com/RMI-response-tp5729876p5729878.html Sent from the Camel - Users mailing list archive at Nabble.com.
RMI response
I want to use my route output body to be the response of my rmi service. But it doesn´t work. My interface: public interface HelloService extends Remote { public String sayHello(String name) throws RemoteException; } My route: route from uri=rmi://localhost:1099/helloService?remoteInterfaces=com.test.HelloService/ setBodysimpleHello ${body.args[0]}/simple/setBody /route The client: Registry registry = LocateRegistry.getRegistry(localhost,1099); HelloService stub = (HelloService) registry.lookup(helloService); System.out.println(response: + stub.sayHello(john)); And response, expected was Hello john response: null If i change setBodysimpleHello ${body.args[0]}/simple/setBody to to uri=bean:helloServiceImpl/ it works. But i don´t want to implement the service as a bean. My route output body should be the return object of my rmi call. -- View this message in context: http://camel.465427.n5.nabble.com/RMI-response-tp5729876.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: My camel-CXF tests fails, if they run together
Hi milanmilas, There's also a helper method that will return the next available port, which might be relevant to what you're doing :) It can be found under AvailablePortFinder, here is an example of its usage `vailablePortFinder.getNextAvailable()` There's more information here about it here too http://camel.apache.org/camel-test.html#CamelTest-Dynamicallyassigningports -- View this message in context: http://camel.465427.n5.nabble.com/My-camel-CXF-tests-fails-if-they-run-together-tp696559p5729858.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: got FatalFallbackErrorHandler when trying handing error with bean
problem fixed if I change seda to direct. [jetty http]-[direct]-[mina] sakti wrote overall route in my app: [jetty http]-[seda]-[mina] -- View this message in context: http://camel.465427.n5.nabble.com/got-FatalFallbackErrorHandler-when-trying-handing-error-with-bean-tp5729828p5729889.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How to schedule FTP with quartz?
Yes, and after Raul's clarification in his response this evening (GMT-4), I changed my RoutePolicy implementation and now it works! For example, to kick off a cron job at 0615 daily, with a run duration of 30 minutes, you would do: CronRoutePolicy ftpPolicy = new CronRoutePolicy(TimeUnit.MINUTES); ftpPolicy.setRouteStartTime(0 15 6 * * ?); ftpPolicy.setPollWindowTime(30); This implementation uses the same Quartz scheduler instance as ScheduledRoutePolicy, but with a different job/trigger naming convention, so there's no duplication and (hopefully) no conflicts. I appreciate your empty message solution, however, in my case, the remote files will intermittently appear during the 30 minute window time, so we have to keep trying, even after getting some files. On Tue, Mar 26, 2013 at 4:43 PM, Pontus Ullgren ullg...@gmail.com wrote: Sorry read your message a bit to quick. If you do not want to calculate the suspend cron expression I guess you need to mimic the behaviour of org.apache.camel.routepolicy.quartz.ScheduledRoutePolicy where (as you point out in another email) the consumer is suspended and not the route. I'm sorry can not explain why it's implemented this way, I just know that in the case of the existing scheduled route policies it seem to work as expected. :-) Hopefully somebody with more knowledge of the in and outs of Camel can explain this to us both. // Pontus On Tue, Mar 26, 2013 at 9:12 PM, Pontus Ullgren ullg...@gmail.com wrote: Chris, Is there no way for you to calculate a cron expression for when the suspend should occure ? Say that you want the route to start every 10 minutes (starting at 0) and run for 5 minutes then suspend. This would mean that you should be able to define the start/resume cron as 0 0,10,20,30,40,50 * * * * ?. And the suspend cron expression as 0 5,15,25,35,45,55 * * * * ?. The CronScheduledRoutePolicy will trigger a start/resum at 00:00:00 and then a suspend at 00:05:00, then a new start/resume at 00:10:00 and a new suspends at 00:15:00 and so on. // Pontus On Tue, Mar 26, 2013 at 7:39 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, I actually gave up on CronScheduledRoutePolicy because I don't want to have to calculate an absolute suspend time based on the start/resume time. What I need is a cron-based policy that specifies the initial start time, which there-after becomes the resume time - this is a cron expression - then I just want a relative run duration, after which, the route is suspended until the next cron-specified resume time. So, after a few days, I finally have that and it works in the unit test - even the initial one-off route start will transparently switch to a resume schedule. The only problem is that I really need this policy to control a route with an FTP consumer. What I'm seeing is that even though the route is suspended, the FTP consumer continues to poll - this partially answers my question about the coding of ScheduleRoutePolicy - which only suspends the consumer - not the route, itself. While my policy suspends the route. I suspect that any route which has a component using PollingConsumerPollStrategy will not behave as I though - which is - you only need to suspend the route and all it's components will be suspended. My suspicion is that components whose Consumers are under the influence of PollingConsumerPollStrategy may not suspend by only suspended the route. -Chris On Sat, Mar 23, 2013 at 3:15 AM, Pontus Ullgren ullg...@gmail.com wrote: This is probably because your route is autoStart=false. So you the first time you need to start it. In my example you see I set both the start and resume schedule to the same cron expression. So the policy will trigger both a start and a resume action. And you will get a WARN log since the first time it can not resume (but it will start) and after that it can not start but it will resume. Perhaps if you share some code it would be easier to help you. //Pontus On 22 Mar 2013 22:06, Chris Wolf cwolf.a...@gmail.com wrote: I found the issue with my custom CronScheduledRoutePolicy - initially the startTime/resumeTime are only scheduled in onInit() - so to re-resume (re-start), you need to call scheduleRoute(Action.RESUME, route); in onStart() ...but now I'm getting: quartz.ScheduledRoutePolicy WARN Route is not in a started state and cannot be resumed. The current route state is Suspended What is the deal? I thought resumeRoute was the inverse of suspenRoute, but this log message seems to indicate that calling CamelContext.suspendRoute(routeId) will put the route into a state that cannot be resumed. Thanks, Chris On Fri, Mar 22, 2013 at 4:04 PM, Chris Wolf cwolf.a...@gmail.com wrote: Pontus, Thanks for that. Since I already has started implementing a class derived from CronScheduledRoutePolicy, I just finished it. It works by starting a Timer thread in
Re: Question about the implementation of routepolicy.quartz.ScheduledRoutePolicy
As for the issue with the consumer appearing to continue to poll - I think my cron resume/suspend expressions were overlapping. Thanks, Chris On Tue, Mar 26, 2013 at 10:06 PM, Chris Wolf cwolf.a...@gmail.com wrote: Thanks for the clarification on that. The only problem is that, when using CronScheduledRoutePolicy on a route with an FTP endpoint configured as a consumer, it does NOT seem to prevent the FTP consumer to stop polling even after it has supposedly been suspended. 56:30,001 CronScheduledRoutePolicy DEBUG Suspended consumer FtpConsumer[ftp://localhost/download?filter=%23cpmdFileFilternoop=truepassword=**username=adpt5] 56:35,100 FtpConsumerWARN Cannot connect/login to: ftp://adpt5@localhost:21. Will skip this poll. 56:35,100 FtpConsumerDEBUG Skipping poll as pre poll check returned false Any ideas? Thanks, Chris On Tue, Mar 26, 2013 at 9:11 PM, Raul Kripalani r...@evosent.com wrote: You don't want to stop all endpoints in the route because there may be inflight Exchanges. Instead, you want to stop the inflow of new messages whilst you keep processing any inflight exchanges. That said, it's safe to stop the entire route (including endpoints) once all inflight exchanges are completed (or immediately if none are alive) – as keeping endpoints started unnecessarily could be a waste of resources. Please feel free to log a JIRA. On the other hand, all routes start with a consumer of some kind. Mind you, it doesn't have to listen on an external protocol. Take for example the direct, seda or timer components, which are virtual endpoints. Regards, *Raúl Kripalani* Enterprise Architect, Open Source Integration specialist, Program Manager | Apache Camel Committer http://about.me/raulkripalani | http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvk On Mon, Mar 25, 2013 at 8:08 PM, Chris Wolf cwolf.a...@gmail.com wrote: I am looking at code in org.apache.camel.routepolicy.quartz.ScheduledRoutePolicy - the code that starts/stops/resumes/suspends the route it is a policy for. The question is why is it separately acting on the Consumer? I thought if you call CamelContext.suspendRoute(route) and/or CamelContext.resumeRoute(route), that all the components in the route are suspended/resumed as well? Secondly, why does this code assume there is a Consumer? What if the route has a Producer? I am not being critical - I just want to understand, generally how route suspend/resume works since I am implementing a similar RoutePolicy. Thanks, -Chris protected void onJobExecute(Action action, Route route) throws Exception { [...] } else if (action == Action.SUSPEND) { if (routeStatus == ServiceStatus.Started) { stopConsumer(route.getConsumer()); } else { LOG.warn(Route is not in a started state and cannot be suspended. The current route state is {}, routeStatus); } } else if (action == Action.RESUME) { if (routeStatus == ServiceStatus.Started) { if (ServiceHelper.isSuspended(route.getConsumer())) { startConsumer(route.getConsumer()); } else { LOG.warn(The Consumer {} is not suspended and cannot be resumed., route.getConsumer()); } [...]
Re: Route starts when deployed with a cxf endpoint
Well i missed to give the camel-context.xml which loads this route builder. Here it is beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd; camelContext autoStartup=false id=bif-camel xmlns=http://camel.apache.org/schema/spring; routeBuilder ref=bifBuilder/ /camelContext bean id=bifBuilder class=com.routes.BIFRouteBuilder/ /beans and we have CronScheduledRoutePolicy set in the route builder to start the route at a specific time.. -- View this message in context: http://camel.465427.n5.nabble.com/Route-starts-when-deployed-with-a-cxf-endpoint-tp5729593p5729895.html Sent from the Camel - Users mailing list archive at Nabble.com.