Re: InOut pattern issue with FTP.
I don't want to create another FTP endpoint to poll the reply files because in splitter I am splitting a big request file into small requests and uploading the request files on FTP in parallel threads[till this point my code is working] and want to aggregate the reply file by the same thread who has uploaded the request file to FTP[At least I want response from FTP to the same thread, that's the InOut EIP talks about] So as you suggested when I will use a dedicated FTP component to poll the reply files, FTP thread will work sequentially to poll all the reply files.Means if there are 50 reply files then it will take a lot of time to finish the polling, which will be a bottleneck for us.Also I will have to take care of many things like aggregation,thread sync,notification etc.That's why I don't think this will be a better approach to go ahead instead of looking into the cause why InOut is not working for FTP. My expectation from FTP Component:- If I am using InOut EIP for the endpoint say ftp:xyz then it should must return me response object and this object must have the file which is passed to include property.Every thread must be able to work individually for the same. P.S- I want to translate our code into Camel otherwise I have the Java code for the same. But I want to do it in pure Camel way to support my POC[Proof of Concept] as well.So that I can propose to translate the complete project into camel.Till now single thread execution of File and FTP component is the main bottleneck for me to go ahead.Also,if we will find the way to implement the above scenario then it will act as a workaround to poll multiple files in multithreaded environment and we will find its implementation in Camel Way Only.Thanks a lot Claus.Happy weekends :) -- View this message in context: http://camel.465427.n5.nabble.com/InOut-pattern-issue-with-FTP-tp5725273p5725438.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: JPA component throwing Attempt to cast instance [Ljava.lang.Object
On Sat, Jan 12, 2013 at 1:18 AM, Chris Wolf cwolf.a...@gmail.com wrote: Hello Christian, I'm using 2.10.0. Ok, from your hint, I found: http://camel.apache.org/scheduledroutepolicy.html so that should be enough to get me going. Any ideas about the other issue? cast except when using jpa in consumer mode with consumeDelete=true? Can you post your Camel route. And the @Entity class that you use? The class cast exception does indicate some kind of array error, not sure why (eg that JDK class cast exception has always not been good at showing the exact types in use, so there is no confusion) Thanks, -Chris On Fri, Jan 11, 2013 at 5:37 PM, Christian Müller christian.muel...@gmail.com wrote: Which version of Camel do you use? Have a look at route policy and/or the quartz component for sheduling routes. Best, Christian Am 11.01.2013 20:23 schrieb Chris Wolf cwolf.a...@gmail.com: I have a JPA endpoint setup as a consumer, just performing a basic query. If I have consumeDelete=false configured, then it works and I see the entities. When consumeDelete=false is not configured (default is to remove), then the error occurs upon JpaTemplate calling EntityManagerImpl.remove(arg) - but arg is of type Object[] - not the entity. Second issue is I'd like the route to just perform the query once. As it is, invokes the query in a loop. Thanks Chris P.S. the EntityManagerImpl.remove(arg) issue is not due to the entities not being enhanced - I verified that with javap. FailedObject: [Ljava.lang.Object;@1e3a0ec. Will commit all previous successful processed message, and ignore this last failure. javax.persistence.PersistenceException: openjpa-2.2.0-r422266:1244990 nonfatal user error org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance [Ljava.lang.Object;@1e3a0ec to PersistenceCapable failed. Ensure that it has been enhanced. FailedObject: [Ljava.lang.Object;@1e3a0ec at org.apache.camel.component.jpa.JpaConsumer$1.doInJpa(JpaConsumer.java:102) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1$1.doInJpa(JpaTemplateTransactionStrategy.java:82) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:183) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:146) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1.doInTransaction(JpaTemplateTransactionStrategy.java:80) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78) at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:75) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: openjpa-2.2.0-r422266:1244990 nonfatal user error org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance [Ljava.lang.Object;@1e3a0ec to PersistenceCapable failed. Ensure that it has been enhanced. FailedObject: [Ljava.lang.Object;@1e3a0ec at org.apache.openjpa.kernel.BrokerImpl.assertPersistenceCapable(BrokerImpl.java:4662) at org.apache.openjpa.kernel.BrokerImpl.cascadeTransient(BrokerImpl.java:2681) at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2769) at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2740) at org.apache.openjpa.kernel.DelegatingBroker.delete(DelegatingBroker.java:1102) at org.apache.openjpa.persistence.EntityManagerImpl.remove(EntityManagerImpl.java:730) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at
Re: Camel Exchange object query
On Fri, Jan 11, 2013 at 10:30 PM, gilboy josephoto...@gmail.com wrote: Hi Assume the following route: *From Endpoint A - Processor B - Processor C - Processor D - To Endpoint E* From my understanding, the consumer for Endpoint A is responsible for creating the exchange in this route. My question is - is it the same instance of the exchange object that moves through the different processors in the route or is the channel between each processor creating a new instance of the exchange object There were a couple of questions at stackoverflow about the Camel concepts that may clear up a few things http://stackoverflow.com/questions/14195675/apache-camel-terminology-subtleties http://stackoverflow.com/questions/14195898/apache-camel-what-is-actually-being-routed Thanks Joe -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Exchange-object-query-tp5725423.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: MEP Query
On Sat, Jan 12, 2013 at 12:01 AM, gilboy josephoto...@gmail.com wrote: Hi Assume I have the following route: *from(endpoint1).to(endpoint2).to(endpoint3).to(endpoint4) * What dictates the MEP on the exchange. Is it the consumer for endpoint1 since it creates the exchange? Yes its the consumer which initially create the exchange and sets its MEP Or can the MEP change throughout the route, e.g. could the producer for endpoint3 change the MEP? Yes the MEP can be changed at any point. Though there is no producer which will change it. Instead there is an EIP for that where you can change it during routing http://camel.apache.org/request-reply.html Notice there is a difference between using setExchangePattern and to ... pattern=xxx/ The former changes the MEP on the Exchange from this point forward. The latter sets the MEP temporary when sending the exchange to the given endpoint, and restores the MEP afterwards. This is also documented in the javadoc of the DSL. Thanks Joe -- View this message in context: http://camel.465427.n5.nabble.com/MEP-Query-tp5725428.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: How to send a templated mail with attachment?
Which Camel version do you use? How the stack trace looks like? Do you consider to provide a unit test to show the issue? Than it's easier for us to find/fix the issue. Best, Christian Am 11.01.2013 09:40 schrieb Arjen Duursma duur...@zorgdomein.nl: The same (missing attachments) seems to be happening to other components as well. I have a route retrieving reports on failed mail attempts (multipart/report) from a pop3 component. Using a xslt transform for generating the actual body before remailing it. After 'saving' the relevant information as an attachement (tested and works) I try to enrich the message based on some identifier from the subject of the original mail. I do this by including: route from direct:extra-info / setBodyxquery ... /setBody to uri:jdbc:... / marshalxstream encoding=UTF-8 //marshal /route After this route, the attachements are gone :-( I modified the route to call this route using the 'enrich' pattern using a generic ReplaceBodyAggregation. This fails due to a NullPointerException in the XmlConverter during the xslt rendering of the replaced body. The system doesn't seem to be able to find typeconverters in the CamelContext. If I make the ReplaceBodyAggregation less generic by specifying the expected body class as Document.class, it suddenly works. -- View this message in context: http://camel.465427.n5.nabble.com/How-to-send-a-templated-mail-with-attachment-tp5125167p5725353.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: InOut pattern issue with FTP.
On Sat, Jan 12, 2013 at 8:40 AM, satyaPrakash satya...@gmail.com wrote: I don't want to create another FTP endpoint to poll the reply files because in splitter I am splitting a big request file into small requests and uploading the request files on FTP in parallel threads[till this point my code is working] and want to aggregate the reply file by the same thread who has uploaded the request file to FTP[At least I want response from FTP to the same thread, that's the InOut EIP talks about] So as you suggested when I will use a dedicated FTP component to poll the reply files, FTP thread will work sequentially to poll all the reply files.Means if there are 50 reply files then it will take a lot of time to finish the polling, which will be a bottleneck for us.Also I will have to take care of many things like aggregation,thread sync,notification etc.That's why I don't think this will be a better approach to go ahead instead of looking into the cause why InOut is not working for FTP. My expectation from FTP Component:- If I am using InOut EIP for the endpoint say ftp:xyz then it should must return me response object and this object must have the file which is passed to include property.Every thread must be able to work individually for the same. The FTP component does not support request/reply. That is not natural to FTP. You would need to code this yourself. For example from a java bean / Camel processor. Then use a producer to send the ftp file. And a consumer to download the reply file. P.S- I want to translate our code into Camel otherwise I have the Java code for the same. But I want to do it in pure Camel way to support my POC[Proof of Concept] as well.So that I can propose to translate the complete project into camel.Till now single thread execution of File and FTP component is the main bottleneck for me to go ahead.Also,if we will find the way to implement the above scenario then it will act as a workaround to poll multiple files in multithreaded environment and we will find its implementation in Camel Way Only.Thanks a lot Claus.Happy weekends :) -- View this message in context: http://camel.465427.n5.nabble.com/InOut-pattern-issue-with-FTP-tp5725273p5725438.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: JPA component throwing Attempt to cast instance [Ljava.lang.Object
It looks like the result of your JPA query is a list of Object/Entity arrays instead a list of Entities. Can you share your basic query? Can you set the log level of org.apache.camel.component.jpa to TRACE and share the log with us? Best, Christian On Sat, Jan 12, 2013 at 1:18 AM, Chris Wolf cwolf.a...@gmail.com wrote: Hello Christian, I'm using 2.10.0. Ok, from your hint, I found: http://camel.apache.org/scheduledroutepolicy.html so that should be enough to get me going. Any ideas about the other issue? cast except when using jpa in consumer mode with consumeDelete=true? Thanks, -Chris On Fri, Jan 11, 2013 at 5:37 PM, Christian Müller christian.muel...@gmail.com wrote: Which version of Camel do you use? Have a look at route policy and/or the quartz component for sheduling routes. Best, Christian Am 11.01.2013 20:23 schrieb Chris Wolf cwolf.a...@gmail.com: I have a JPA endpoint setup as a consumer, just performing a basic query. If I have consumeDelete=false configured, then it works and I see the entities. When consumeDelete=false is not configured (default is to remove), then the error occurs upon JpaTemplate calling EntityManagerImpl.remove(arg) - but arg is of type Object[] - not the entity. Second issue is I'd like the route to just perform the query once. As it is, invokes the query in a loop. Thanks Chris P.S. the EntityManagerImpl.remove(arg) issue is not due to the entities not being enhanced - I verified that with javap. FailedObject: [Ljava.lang.Object;@1e3a0ec. Will commit all previous successful processed message, and ignore this last failure. javax.persistence.PersistenceException: openjpa-2.2.0-r422266:1244990 nonfatal user error org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance [Ljava.lang.Object;@1e3a0ec to PersistenceCapable failed. Ensure that it has been enhanced. FailedObject: [Ljava.lang.Object;@1e3a0ec at org.apache.camel.component.jpa.JpaConsumer$1.doInJpa(JpaConsumer.java:102) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1$1.doInJpa(JpaTemplateTransactionStrategy.java:82) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:183) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:146) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1.doInTransaction(JpaTemplateTransactionStrategy.java:80) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78) at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:75) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: openjpa-2.2.0-r422266:1244990 nonfatal user error org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance [Ljava.lang.Object;@1e3a0ec to PersistenceCapable failed. Ensure that it has been enhanced. FailedObject: [Ljava.lang.Object;@1e3a0ec at org.apache.openjpa.kernel.BrokerImpl.assertPersistenceCapable(BrokerImpl.java:4662) at org.apache.openjpa.kernel.BrokerImpl.cascadeTransient(BrokerImpl.java:2681) at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2769) at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2740) at org.apache.openjpa.kernel.DelegatingBroker.delete(DelegatingBroker.java:1102) at org.apache.openjpa.persistence.EntityManagerImpl.remove(EntityManagerImpl.java:730) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at
Re: JPA component throwing Attempt to cast instance [Ljava.lang.Object
And by the way, we are using OpenJPA 2.2.1 instead of 2.2.0, which you are using. Can you upgrade? Best, Christian On Fri, Jan 11, 2013 at 8:23 PM, Chris Wolf cwolf.a...@gmail.com wrote: I have a JPA endpoint setup as a consumer, just performing a basic query. If I have consumeDelete=false configured, then it works and I see the entities. When consumeDelete=false is not configured (default is to remove), then the error occurs upon JpaTemplate calling EntityManagerImpl.remove(arg) - but arg is of type Object[] - not the entity. Second issue is I'd like the route to just perform the query once. As it is, invokes the query in a loop. Thanks Chris P.S. the EntityManagerImpl.remove(arg) issue is not due to the entities not being enhanced - I verified that with javap. FailedObject: [Ljava.lang.Object;@1e3a0ec. Will commit all previous successful processed message, and ignore this last failure. javax.persistence.PersistenceException: openjpa-2.2.0-r422266:1244990 nonfatal user error org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance [Ljava.lang.Object;@1e3a0ec to PersistenceCapable failed. Ensure that it has been enhanced. FailedObject: [Ljava.lang.Object;@1e3a0ec at org.apache.camel.component.jpa.JpaConsumer$1.doInJpa(JpaConsumer.java:102) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1$1.doInJpa(JpaTemplateTransactionStrategy.java:82) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:183) at org.springframework.orm.jpa.JpaTemplate.execute(JpaTemplate.java:146) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy$1.doInTransaction(JpaTemplateTransactionStrategy.java:80) at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:130) at org.apache.camel.component.jpa.JpaTemplateTransactionStrategy.execute(JpaTemplateTransactionStrategy.java:78) at org.apache.camel.component.jpa.JpaConsumer.poll(JpaConsumer.java:75) at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:139) at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:91) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441) at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:317) at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:150) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:98) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.runPeriodic(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:204) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) at java.lang.Thread.run(Thread.java:662) Caused by: openjpa-2.2.0-r422266:1244990 nonfatal user error org.apache.openjpa.persistence.ArgumentException: Attempt to cast instance [Ljava.lang.Object;@1e3a0ec to PersistenceCapable failed. Ensure that it has been enhanced. FailedObject: [Ljava.lang.Object;@1e3a0ec at org.apache.openjpa.kernel.BrokerImpl.assertPersistenceCapable(BrokerImpl.java:4662) at org.apache.openjpa.kernel.BrokerImpl.cascadeTransient(BrokerImpl.java:2681) at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2769) at org.apache.openjpa.kernel.BrokerImpl.delete(BrokerImpl.java:2740) at org.apache.openjpa.kernel.DelegatingBroker.delete(DelegatingBroker.java:1102) at org.apache.openjpa.persistence.EntityManagerImpl.remove(EntityManagerImpl.java:730) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.springframework.orm.jpa.JpaTemplate$CloseSuppressingInvocationHandler.invoke(JpaTemplate.java:425) at $Proxy12.remove(Unknown Source) at org.apache.camel.component.jpa.JpaConsumer$3.deleteObject(JpaConsumer.java:337) at org.apache.camel.component.jpa.JpaConsumer.processBatch(JpaConsumer.java:159) at org.apache.camel.component.jpa.JpaConsumer$1.doInJpa(JpaConsumer.java:97) ... 18 more --
Re: Retrieve failed Route from deadLetterChannel ?
Hi I have logged a ticket to let the route id be accessible for end users https://issues.apache.org/jira/browse/CAMEL-5959 On Fri, Jan 11, 2013 at 7:44 PM, ncolomer ncolo...@octo.com wrote: Hi Camel community, I am facing a problem using the Camel's deadLetterChannel. I have several Routes that process messages and delegate to a Route-scoped errorHandler when something bad happen (HTTP endpoint timeout for instance). What I try to achieve is to implement a generic Route as deadLetterChannel to handle all kind of Route failure and act accordingly (actually, persist object on the filesystem and send an email). The problem is that filename and mail subject are different, depending on the Route the failure was triggered from. I need to implement some logic to retrieve the failure context (i.e. from which Route it was triggered) and set some headers accordingly. Is there a possibility to retrieve failed Route (instance / ID or URI) via the Exchange object (Processor) ? If it's not the case, can we set headers in the Route specific errorHandler that will be used in the generic deadLetterChannel (worse as Route depends on caller) ? Do you see a better way ? My Java code currently looks like that : MyRoute route definition : from(MyRoute.URI).routeId(MyRoute.ID) .errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage() .maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay) .log(MyRoute.FAILURE).logHandled(true) .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true) .retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false)) // ... Route's stuff ... DeadLetterRoute route definition : from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID) .process(new DeadLetterProcessor()) // Retrieves failed route and set headers accordingly .setHeader(from, simple(${properties:mail.from})) .setHeader(to, simple(${properties:mail.to})) .to(file:{{error.directory}}) .to(smtp:{{mail.server.url}}); Thanks in advance for your help, Nicolas -- View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Problem with calling a simple POJO after a route
As Claus already mentioned in this thread, have a look at http://camel.apache.org/running-camel-standalone-and-have-it-keep-running.html . Best, Christian On Wed, Jan 9, 2013 at 5:01 PM, Mark elihusma...@gmail.com wrote: How can I keep the CamelContext running after I call start() in a standalone java application? Thread.sleep(xxx) does not seem to be an adequate solution for a production system. On Tue, Jan 8, 2013 at 9:40 AM, Meriem mbenha...@gmail.com wrote: I tried with : CamelContext context = new DefaultCamelContext(); context.addRoutes(new MyRouteBuilder()); context.start(); Thread.sleep(1000); context.stop(); System.out.println(End of the program); and it worked. Thank you very much for your help. Bests, Meriem. -- View this message in context: http://camel.465427.n5.nabble.com/Problem-with-calling-a-simple-POJO-after-a-route-tp5725121p5725134.html Sent from the Camel - Users mailing list archive at Nabble.com. --
Re: little issue with ActiveMQ Consumer having prefetch set to 0 (polling)
On Fri, Jan 11, 2013 at 3:27 PM, Marco Crivellaro marco.cr...@gmail.com wrote: Any idea on how Client ID and Connection ID are created when connecting to ActiveMQ? I assume they are created by the JMS client (eg ActiveMQ). -- View this message in context: http://camel.465427.n5.nabble.com/little-issue-with-ActiveMQ-Consumer-having-prefetch-set-to-0-polling-tp5725050p5725391.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Remove an advice
Can you share your route and your unit test? Than it's easier (for me) to understand where your issues are. Have a look at the many AdviceWith* unit tests at [1]. [1] https://svn.apache.org/repos/asf/camel/trunk/camel-core/src/test/java/org/apache/camel/processor/interceptor/ Best, Christian On Sat, Jan 5, 2013 at 4:55 PM, Henri Tremblay henri.tremb...@gmail.comwrote: Hum... I'm already creating the advice in the test (not in the setup). I'll try but isUseAdviceWith seems only not to start the context. So I don't see how this can help me to set my original route back. On 4 January 2013 18:06, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Jan 4, 2013 at 6:02 PM, Henri Tremblay henri.tremb...@gmail.com wrote: That's what I'm doing. routeDefinitionUnderTest.adviceWith(context(), new AdviceWithRouteBuilder() { @Override public void configure() throws Exception { weaveById(doTry*).before().setHeader(JMSMessageID, constant(DuplicateID)); } }); But I have two tests in my test case. The second one still use the tainted context (yes, if you tell me that another test case won't have the problem, I can separate the tests in two classes). You can do the advice in the test method itself. Then it ought to be local to that given test only. As we do at http://camel.apache.org/advicewith.html And see the green box about the tip. On 4 January 2013 17:11, Christian Müller christian.muel...@gmail.com wrote: You can use adviceWith [1] in your test. In this case you don't have to touch your original route. [1] http://camel.apache.org/advicewith.html Best, Christian On Fri, Jan 4, 2013 at 4:52 PM, Henri Tremblay henri.tremb...@gmail.com wrote: Hi, Happy new year to everyone. I'm doing integration tests. I'm reading from a JMS queue and then doing some special stuff is the JMSMessageID already exist. I want to test that the special stuff is correctly called. So right now I'm doing this: - Adding an advice at the beginning of the route that set the JMSMessageID - Sending two messages Everything is fine but since it's an integration tests, my route is now dirty and cannot be reused for other tests. So I'm stuck. I'm using a org.apache.camel.test.junit4.CamelTestSupport. The camel context comes from a SingletonBeanFactory somewhere else (I can't change that). So, I would like a solution to get an unweaved route back. The solution is can see: - But back the original route. (How?) - Remove the weaving on the route (How?) - Reload the context with it's original content (How?) - Set the JMSMessageId without weaving (How?) - ??? Any ideas are welcome Cheers, Henri -- -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen --
Re: Retrieve failed Route from deadLetterChannel ?
Hi Claus, Thank you for your answer and the quick fix! This is exactly what I needed :) Best regards, Nicolas 2013/1/12 Claus Ibsen-2 [via Camel] ml-node+s465427n5725448...@n5.nabble.com Hi I have logged a ticket to let the route id be accessible for end users https://issues.apache.org/jira/browse/CAMEL-5959 On Fri, Jan 11, 2013 at 7:44 PM, ncolomer [hidden email]http://user/SendEmail.jtp?type=nodenode=5725448i=0 wrote: Hi Camel community, I am facing a problem using the Camel's deadLetterChannel. I have several Routes that process messages and delegate to a Route-scoped errorHandler when something bad happen (HTTP endpoint timeout for instance). What I try to achieve is to implement a generic Route as deadLetterChannel to handle all kind of Route failure and act accordingly (actually, persist object on the filesystem and send an email). The problem is that filename and mail subject are different, depending on the Route the failure was triggered from. I need to implement some logic to retrieve the failure context (i.e. from which Route it was triggered) and set some headers accordingly. Is there a possibility to retrieve failed Route (instance / ID or URI) via the Exchange object (Processor) ? If it's not the case, can we set headers in the Route specific errorHandler that will be used in the generic deadLetterChannel (worse as Route depends on caller) ? Do you see a better way ? My Java code currently looks like that : MyRoute route definition : from(MyRoute.URI).routeId(MyRoute.ID) .errorHandler(deadLetterChannel(DeadLetterRoute.URI).useOriginalMessage() .maximumRedeliveries(maximumRedeliveries).redeliveryDelay(redeliveryDelay) .log(MyRoute.FAILURE).logHandled(true) .retriesExhaustedLogLevel(LoggingLevel.ERROR).logStackTrace(true) .retryAttemptedLogLevel(LoggingLevel.WARN).logRetryStackTrace(false)) // ... Route's stuff ... DeadLetterRoute route definition : from(DeadLetterRoute.URI).routeId(DeadLetterRoute.ID) .process(new DeadLetterProcessor()) // Retrieves failed route and set headers accordingly .setHeader(from, simple(${properties:mail.from})) .setHeader(to, simple(${properties:mail.to})) .to(file:{{error.directory}}) .to(smtp:{{mail.server.url}}); Thanks in advance for your help, Nicolas -- View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: [hidden email]http://user/SendEmail.jtp?type=nodenode=5725448i=1 Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen -- If you reply to this email, your message will be added to the discussion below: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725448.html To unsubscribe from Retrieve failed Route from deadLetterChannel ?, click herehttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_codenode=5725420code=bmNvbG9tZXJAb2N0by5jb218NTcyNTQyMHw5MDU2MzAzMjc= . NAMLhttp://camel.465427.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewerid=instant_html%21nabble%3Aemail.namlbase=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespacebreadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml -- View this message in context: http://camel.465427.n5.nabble.com/Retrieve-failed-Route-from-deadLetterChannel-tp5725420p5725462.html Sent from the Camel - Users mailing list archive at Nabble.com.
Route branches identification for logging purposes ( CXFRS + operation name header condition)
Hello, In my Camel project, I have exposed several cxf:rsServer on same address/port but listening on different root paths. Every root path then continue with more specific paths defined with CXF @Path. Which resource is requested is possible to find out thanks to CxfConstant.OPERATION_NAME. So one chunk of a route looks like this, for example: .when(header(CxfConstants.OPERATION_NAME).isEqualTo(getFoo)) .to(...) .when(header(CxfConstants.OPERATION_NAME).isEqualTo(getBar)) .to(...) ... My need is that I'd like to know, which branch of the condition is invokedprocessed so I can use the information in log file. More specifically, I'm logging elapsed time in the route ( http://java.dzone.com/articles/measure-elapsed-time-camel). I know how long the route takes to finish, there is a routeId, but I don't know which branch was in action for particular log record. Is there a way how to put some marker to every branch within one route so I can recognize it in the log file? Thanks for help. -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi
Re: CXFRS: Share port number across bundles
Hi Raul and Sergey, Guys please, could you explain more for me the second option ? I missed the point I guess. Thanks! On Jan 11, 2013 3:00 PM, Sergey Beryozkin sberyoz...@gmail.com wrote: Hi Raúl On 11/01/13 13:28, Raul Kripalani wrote: Hi Sergey, Thanks for the quick answer. We were already on our way to implement the second option! Just a thought off the top of my head... Does it make sense to enhance CXF or the Jetty CXF Transport so that it's able to figure out this situation transparently and build the servlet mappings accordingly? This is possible when CXF Servlet transport is used (with default context /cxf which is configurable and relative endpoint address values) but not when every endpoint with an absolute address is powered by (CXF) Jetty transport. Besides, the URI path starting from a given root resource's @Path value is not visible to CXF transports given that this @Path value does not represent the final URI path segment in most cases. Cheers, Sergey Regards, *Raúl Kripalani* Apache Camel Committer Enterprise Architect, Program Manager, Open Source Integration specialist http://about.me/raulkripalani | http://www.linkedin.com/in/** raulkripalani http://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvkhttp://twitter.com/**raulvkhttp://twitter.com/raulvk On Fri, Jan 11, 2013 at 1:13 PM, Sergey Beryozkinsberyoz...@gmail.com** wrote: Hi On 11/01/13 12:53, Raul Kripalani wrote: Hi all, Quick question. Has anyone tried to run several CXFRS consumers on different bundles binding to the same port (e.g. 9007), where each consumer has a different root resource stemming from a different path? *Bundle A:* cxf:rsServer id=rsServer address=http://0.0.0.0:9007; serviceClass=com.mycompany.ResourceA / *Bundle B:* cxf:rsServer id=rsServer address=http://0.0.0.0:9007; serviceClass=com.mycompany.ResourceB / *ResourceA* annotated with @Path(/resourceA) *ResourceB* annotated with @Path(/resourceB) It looks like the latest bundle to initialise gets ownership of the port, i.e. they become mutually exclusive. will cxf:rsServer work with relative addresses, example, the first one with /resourceA, second - with /resourceB, and both ResourceA ResourceB root resources having @Path(/) ? May be another option is to have a single cxf:rsServer listening on http://0.0.0.0:9007;, with it root resource listening on / and dynamically managing subresources which in turn can handle /resourceA, /resourceB, etc, where every subresource is provided or removed externally via different bundles ? Cheers, Sergey Any ideas on how to make this work? Do you think this question is more on the Camel or CXF side of the fence? Thanks! *Raúl Kripalani* Apache Camel Committer Enterprise Architect, Program Manager, Open Source Integration specialist http://about.me/raulkripalani | http://www.linkedin.com/in/** raulkripalanihttp://www.**linkedin.com/in/raulkripalanihttp://www.linkedin.com/in/raulkripalani http://blog.raulkr.net | twitter: @raulvkhttp://twitter.com/raulvkhttp://twitter.com/**raulvk http://twitter.com/**raulvk http://twitter.com/raulvk
Re: Route branches identification for logging purposes ( CXFRS + operation name header condition)
Here is a way to do it. I think you can structure your routes (one route per branch) to make it simpler to use JMX to monitor activities each branch. .when(header(CxfConstants.OPERATION_NAME).isEqualTo(getFoo)) .to(direct:getFooBranch) .when(header(CxfConstants.OPERATION_NAME).isEqualTo(getBar)) .to(direct:getBarBranch) ... from(direct:getFooBranch).to(...) from(direct:getBarBranch).to(...) Check out the wiki on Camel-jmx. http://camel.apache.org/camel-jmx.html HTH On 01/12/2013 09:35 AM, Martin Stiborský wrote: Hello, In my Camel project, I have exposed several cxf:rsServer on same address/port but listening on different root paths. Every root path then continue with more specific paths defined with CXF @Path. Which resource is requested is possible to find out thanks to CxfConstant.OPERATION_NAME. So one chunk of a route looks like this, for example: .when(header(CxfConstants.OPERATION_NAME).isEqualTo(getFoo)) .to(...) .when(header(CxfConstants.OPERATION_NAME).isEqualTo(getBar)) .to(...) ... My need is that I'd like to know, which branch of the condition is invokedprocessed so I can use the information in log file. More specifically, I'm logging elapsed time in the route ( http://java.dzone.com/articles/measure-elapsed-time-camel). I know how long the route takes to finish, there is a routeId, but I don't know which branch was in action for particular log record. Is there a way how to put some marker to every branch within one route so I can recognize it in the log file? Thanks for help.
Re: camel-smpp in trx mode
The smslib model is a bit different. The smslib camel consumer pull the short messages for the SMSC. And only if a consumer is defined ( from(smslib://...) ). In the smpp Camel component, the SMPP library push the short messages (and delivery receipt messages) to the client if the client is connected in the TRX mode. Assume there is only one producer ( to(smpp://...) ) defined and no consumer. The SMPP library push the message to the client. Because there is no Camel consumer, there is no route which can consume/handle/process/... this message. What is a good/acceptable behavior in this case? Best, Christian On Thu, Jan 10, 2013 at 1:37 PM, Alex Anderson a...@frontlinesms.comwrote: On 4 January 2013 17:26, Christian Müller christian.muel...@gmail.com wrote: I think we don't have another camel component where the endpoint is a consumer and producer. I'm not sure how/if it works or if we hit problems in other areas (exception handling, ...). We do this for the camel-smslib component. The endpoint represents a serial connection to an SMS modem, and therefore must deal with either sending or receiving of messages or both. I have no idea if this is a recommended approach from camel perspective, but it works for us. My interpretation of the camel doc was that returning `true` from Endpoint.isSingleton() should allow for one Endpoint per URI, but multiple consumers/producers tied to the Endpoint. You can see example at https://github.com/frontlinesms/camel-smslib/blob/master/src/main/java/net/frontlinesms/camel/smslib/SmslibEndpoint.java --
Re: camel sql
Please find my commets inline: On Sat, Jan 5, 2013 at 6:56 AM, pointerness rohit.venkatacha...@nomura.comwrote: Hi, I am evaluating camel for our product. I am trying to use a camel route in an existing web application. We use spring-jdbc queryforlist to fetch data from DB. I thought camel's sql component should be a straight fit. However I get either bad sql grammar or class not found when I try to use the sql component. Please share the query with us. Please share the stack trace with us. Otherwise it's hard to tell what you are doing wrong (You didn't mentioned the Camel version, the database vendor, your runtime environment, the query, the class which is not found, ...). Please read http://camel.apache.org/support.html I had success when I invoked the existing java bean via camel route, but sql for some reason doesn't work. The route I am using is routefrom uri=directato uri=sql:{{property.sqlquer}}/to uri=someJavaBean//route In the application the query is stored in a constant. Did you try to put the query direcly into this route definition? I tried setting it as header value. Even that did not work. I got a parsing exception, Which header key do you use? Can you share the stack trace of this parsing exception? so decided to use a property file. In both cases I was able to log the sql query and did not see any error. Even though it's a complex query, it's static. I then tried a very simple sql query which will return me a single column. even that is failing. Any ideas where I am going round. As this is a working porject, I am confident the build path iscorrect. I am not able to figure out why I am getting a class not found for spring's rowmapper. Which version of Spring do you use? -- View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935.html Sent from the Camel - Users mailing list archive at Nabble.com. --
Re: camel sql
camel-sql doesn't support changing the sql query by passing a special header. Checkout the documentation [1]. If you have a need for this, feel free to log a JIRA [2]. [1] http://camel.apache.org/sql-component.html [2] http://camel.apache.org/contributing.html Best, Christian On Sat, Jan 5, 2013 at 10:52 AM, pointerness rohit.venkatacha...@nomura.com wrote: Yep worked with 3.0. Thanks. Worked with sql query stored in a property file. not with header. I have put a map entry with keysqlQuery. I use the map as the header argument to producerTemplate request body and header method. Am trying to use it in the route as to uri=${header.sqlQuery}/ Is this allowed? -- View this message in context: http://camel.465427.n5.nabble.com/camel-sql-tp5724935p5724945.html Sent from the Camel - Users mailing list archive at Nabble.com. --
Re: transactions that span multiple routes
I do not have a solution at present, but I'm wondering what happens if you commit the exchange (than the message is deleted from the queue and the database is updated) and than your route fails? Also as far as I know, the default transaction timeout for SPTM is 120 seconds. May be your 30 seconds are ok for one transaction? Best, Christian On Wed, Jan 9, 2013 at 6:51 PM, erstanl erst...@gmail.com wrote: Willem, thanks for the idea. Here is a resulting issue I have run into. The 1st route takes a message from queue/batch/ready, it throws it into the seda queue. It basically takes every message it can and stuffs it into the seda queue as fast as it can. The second route does process them as I would expect, but I cannot allow the first route to consume more than one at a time. There are many more machines running this same route that will not have a chance to get any messages. route from uri=q:queue:queue/batch/ready / transacted/ to uri=bean:batchListener?method=init / to uri=seda:queue.process / /route route from uri=seda:queue.process / to uri=bean:batchProcessor?method=process / /route So I came up with this. It fulfills the ability to consume only as many as needed to process, but I don't think its handling the transaction boundary well because of the blockWhenFull attribute. It appears that the blocking on the first route is holding the transaction open until it is able to commit the message to the seda queue. route from uri=q:queue:queue/batch/ready / transacted/ to uri=bean:batchListener?method=init / to uri=seda:queue.process?size=2amp;blockWhenFull=trueamp;concurrentConsumers=1 / /route route from uri=seda:queue.process?size=2amp;blockWhenFull=trueamp;concurrentConsumers=1 / to uri=bean:batchProcessor?method=process / /route I understand that the seda component is asynchronous, and that we are essentially using it to clip off the transaction at the route boundary. But that has its obvious downside of draining the actvemq queue in rapid fashion and queuing them in seda. It is almost as if I need to us a vm component instead of seda, but vm will participate in the transaction, which is the original problem. I have looked into using a throttle on the first route, but the data size being transferred is very inconsistent, and I cant rely on the throttle to feed the second route appropriately. I appreciate your help. If you could please let me know how I might be able to use camel to achieve what I have mentioned above. -- View this message in context: http://camel.465427.n5.nabble.com/transactions-that-span-multiple-routes-tp5723735p5725194.html Sent from the Camel - Users mailing list archive at Nabble.com. --
Re: MEP Query
Thanks for the response. Sorry - 1 other question on this. If my route looks like: *from(endpoint1).to(endpoint2).to(endpoint3).to(endpoint4) * Assume the consumer for endpoint1 sets the MEP to InOut. If endpoint4 is a file endpoint what gets returned to the producer, i.e. the file endpoint only supports InOnly. Would it be the response from endpoint3? Thanks Joe -- View this message in context: http://camel.465427.n5.nabble.com/MEP-Query-tp5725428p5725476.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: MEP Query
On Sun, Jan 13, 2013 at 12:40 AM, gilboy josephoto...@gmail.com wrote: Thanks for the response. Sorry - 1 other question on this. If my route looks like: *from(endpoint1).to(endpoint2).to(endpoint3).to(endpoint4) * Assume the consumer for endpoint1 sets the MEP to InOut. If endpoint4 is a file endpoint what gets returned to the producer, i.e. the file endpoint only supports InOnly. Would it be the response from endpoint3? Yes the above route is using the pipes and filters eip mode by default. So output from previous is input to next. http://camel.apache.org/pipes-and-filters.html The pipeline is the default mode so that is why you can omit it. Thanks Joe -- View this message in context: http://camel.465427.n5.nabble.com/MEP-Query-tp5725428p5725476.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen