Re: Tracing exceptions
On Fri, Nov 4, 2011 at 2:50 PM, ahiebl a.hi...@mic-cust.com wrote: Hi, we add a tracer to our camel context that logs to a JPA table, i.e. tracer.setUseJpa(true); This works fine. But when a bean in the traced route throws an exception (e.g. NullPointerException) I would actually expect to see that in the causedByException property. But the exception is null. I think the reason is that in DefaultTraceEventMessage the causedByException is set to exchange.getException, maybe at a time where it is already handled. The exception is still available as property Exchange.CAUSED_BY_EXCEPTION, though. public DefaultTraceEventMessage(final Date timestamp, final ProcessorDefinition? toNode, final Exchange exchange) { this.tracedExchange = exchange; ... this.causedByException = exchange.getException() != null ? exchange.getException().toString() : null; } Is this a bug or is there another way to get that exception traced. This would be really helpful for debugging purposes. Many thanks, Alfred PS: Using Camel 2.6 Yeah we should probably check for that property and store it in the trace event message. Fell free to create a JIRA ticket with this issue. Link from here http://camel.apache.org/support -- View this message in context: http://camel.465427.n5.nabble.com/Tracing-exceptions-tp4964120p4964120.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Adding File name filter for RouteEndpointDefinition
I have code where I dynamically try to add Endpoints and Endpoint Filters to CamelContext. But haven't been able to get FileFilter working on File- or FtpEndpoint's. For example I want to be able to filter only files with given parameters, for example I want to download files only with txt extension. Here's the code : public void testCamel() { camel = new DefaultCamelContext(); RouteDefinition routeDef = new RouteDefinition(); Endpoint from = camel.getEndpoint(file:C:\\FtpTestFolders\\FtpOut?delete=true); //Endpoint from2 = camel.getEndpoint(quartz://myGroup/myTimerName?cron=0+0/5+*+*+*+?); //routeDef.setHeader(Exchange.FILE_NAME, new SimpleExpression(${date:now:MMdd}.txt)); routeDef.setHeader(testi, new ConstantExpression(TAMA ON TESTI)); Endpoint to = camel.getEndpoint(file:C:\\FtpTestFolders\\FtpIn?fileName=filename1.txt); routeDef.from(from).filter().simple(${file:ext} == 'txt').to(to); try { camel.addRouteDefinition(routeDef); camel.start(); } catch (Exception exp) { System.out.println(EXCEPTION starting camel : + exp.toString()); } boolean wait = true; while (wait) { } } } This works in a way that it routes those files that is defined in the filter but it removes all files from the source endpoint. I read about GenericFileFilter but how can I add it programmatically to camel context ? I would like to be able to define per route programmatically which filter parameter I would like to use. Thank you. Your help would be greatly appreciated. Best Regards Tuomas -- View this message in context: http://camel.465427.n5.nabble.com/Adding-File-name-filter-for-RouteEndpointDefinition-tp4968230p4968230.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Adding File name filter for RouteEndpointDefinition
Hi See this page http://camel.apache.org/file2 The section about using GenericFileFilter To register a custom file filter in the registry, then you can use the SimpleRegistry with the CamelContext Map simpleRegistry = new SimpleRegistry(); camel = new DefaultCamelContext(simpleRegistry); Then you can just register your custom filter simpleRegistry.put(myFilter, myFilerObject); On Sun, Nov 6, 2011 at 11:12 AM, tkatva tuomas.ka...@gmail.com wrote: I have code where I dynamically try to add Endpoints and Endpoint Filters to CamelContext. But haven't been able to get FileFilter working on File- or FtpEndpoint's. For example I want to be able to filter only files with given parameters, for example I want to download files only with txt extension. Here's the code : public void testCamel() { camel = new DefaultCamelContext(); RouteDefinition routeDef = new RouteDefinition(); Endpoint from = camel.getEndpoint(file:C:\\FtpTestFolders\\FtpOut?delete=true); //Endpoint from2 = camel.getEndpoint(quartz://myGroup/myTimerName?cron=0+0/5+*+*+*+?); //routeDef.setHeader(Exchange.FILE_NAME, new SimpleExpression(${date:now:MMdd}.txt)); routeDef.setHeader(testi, new ConstantExpression(TAMA ON TESTI)); Endpoint to = camel.getEndpoint(file:C:\\FtpTestFolders\\FtpIn?fileName=filename1.txt); routeDef.from(from).filter().simple(${file:ext} == 'txt').to(to); try { camel.addRouteDefinition(routeDef); camel.start(); } catch (Exception exp) { System.out.println(EXCEPTION starting camel : + exp.toString()); } boolean wait = true; while (wait) { } } } This works in a way that it routes those files that is defined in the filter but it removes all files from the source endpoint. I read about GenericFileFilter but how can I add it programmatically to camel context ? I would like to be able to define per route programmatically which filter parameter I would like to use. Thank you. Your help would be greatly appreciated. Best Regards Tuomas -- View this message in context: http://camel.465427.n5.nabble.com/Adding-File-name-filter-for-RouteEndpointDefinition-tp4968230p4968230.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Adding File name filter for RouteEndpointDefinition
Also one question comes to mind... How can I add this GenericFileFilter to my endpoint ? Can I add this to my endpoint ? Can I add it programmatically ? And how can I do it ? Thank you very much... :) Best Regards Tuomas Katva -- View this message in context: http://camel.465427.n5.nabble.com/Adding-File-name-filter-for-RouteEndpointDefinition-tp4968230p4968314.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Adding File name filter for RouteEndpointDefinition
On Sun, Nov 6, 2011 at 11:49 AM, tkatva tuomas.ka...@gmail.com wrote: Thank you for your quick answer... Does the generic file filter allow me to download only those files that I have specified in the filter ? For example if I have Ftp-endpoint with numerous files and I wan't to download and remove on those files that end with txt. Is this possible with GenericFileFilter ? Yes. Just return true|false for the files you want to accept. And only the accepted files will be downloaded and removed etc. All non accepted files will be left untouched. There is already a option that accepts a reg exp pattern so you can just do. Notice its a reg exp pattern so it should be like: ftp:xxx?include=.*txt The ftp component inherit all options (well 99% of them) from the file so check this page http://camel.apache.org/file2 Thank you, you're help is indispensable Best Regars Tuomas Katva -- View this message in context: http://camel.465427.n5.nabble.com/Adding-File-name-filter-for-RouteEndpointDefinition-tp4968230p4968300.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Adding File name filter for RouteEndpointDefinition
Thank you! :) You're the best... This include solves all my problems. You saved my day. Keep up the good work. Best Regards Tuomas -- View this message in context: http://camel.465427.n5.nabble.com/Adding-File-name-filter-for-RouteEndpointDefinition-tp4968230p4968355.html Sent from the Camel - Users mailing list archive at Nabble.com.
Writing own Camel Components
Hello, I started today to write a new Camel Component for RabbitMQ to Consume and Produce Messages from the message broker. At the moment I not understand how to put in parameters. When I try to append the parameter hostname Exam: .to(rabbitmq:foo?hostname=localhost) I get the following exception: Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: rabbitmq://foo?hostname=localhost due to: null Cheers, Michael
Re: Writing own Camel Components
Instead of writing your own component have you tried using or improving the amqp component? http://camel.apache.org/amqp.html On Sun, Nov 6, 2011 at 4:07 PM, Michael Prieß mailingliste...@googlemail.com wrote: Hello, I started today to write a new Camel Component for RabbitMQ to Consume and Produce Messages from the message broker. At the moment I not understand how to put in parameters. When I try to append the parameter hostname Exam: .to(rabbitmq:foo?hostname=localhost) I get the following exception: Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: rabbitmq://foo?hostname=localhost due to: null Cheers, Michael
Re: Writing own Camel Components
Also, if you are intent on writing a custom component, did you either add your component to the CamelContext with the name of rabbitmq or use the auto discovery by creating a file in META-INF as described here http://camel.apache.org/writing-components.html ? On Sun, Nov 6, 2011 at 4:07 PM, Michael Prieß mailingliste...@googlemail.com wrote: Hello, I started today to write a new Camel Component for RabbitMQ to Consume and Produce Messages from the message broker. At the moment I not understand how to put in parameters. When I try to append the parameter hostname Exam: .to(rabbitmq:foo?hostname=localhost) I get the following exception: Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: rabbitmq://foo?hostname=localhost due to: null Cheers, Michael
Re: Writing own Camel Components
Hello, the reason why I started to build a own component for RabbitMQ is that the actual AMQP Component is based on the QPID Client Library which is not full compatible with RabbitMQ. For my component I used auto discovery and it all works well without parameters. But with the param I got this error that I described above. Regards, Michael 2011/11/6 Jason Whaley jasonwha...@gmail.com: Also, if you are intent on writing a custom component, did you either add your component to the CamelContext with the name of rabbitmq or use the auto discovery by creating a file in META-INF as described here http://camel.apache.org/writing-components.html ? On Sun, Nov 6, 2011 at 4:07 PM, Michael Prieß mailingliste...@googlemail.com wrote: Hello, I started today to write a new Camel Component for RabbitMQ to Consume and Produce Messages from the message broker. At the moment I not understand how to put in parameters. When I try to append the parameter hostname Exam: .to(rabbitmq:foo?hostname=localhost) I get the following exception: Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: rabbitmq://foo?hostname=localhost due to: null Cheers, Michael
Dynamic layout input to flatpack component
I'd like to use camel in a highly configurable application. As an example, one component I'd like to use is the Flatpack component. The layout (.pzmap.xml) information will be generated from user-entered information stored in a database or other data structure, and this lookup may vary depending on properties of the in message. AFAICT, the built-in flatpack component cannot do this. Is this kind of requirement better implemented outside of camel? Cheers, Raman
Re: Writing own Camel Components
Michael, did you take a look at this [1] too? Hadrian [1] https://github.com/lshift/camel-rabbitmq On 11/06/2011 05:43 PM, Michael Prieß wrote: Hello, the reason why I started to build a own component for RabbitMQ is that the actual AMQP Component is based on the QPID Client Library which is not full compatible with RabbitMQ. For my component I used auto discovery and it all works well without parameters. But with the param I got this error that I described above. Regards, Michael 2011/11/6 Jason Whaleyjasonwha...@gmail.com: Also, if you are intent on writing a custom component, did you either add your component to the CamelContext with the name of rabbitmq or use the auto discovery by creating a file in META-INF as described here http://camel.apache.org/writing-components.html ? On Sun, Nov 6, 2011 at 4:07 PM, Michael Prieß mailingliste...@googlemail.com wrote: Hello, I started today to write a new Camel Component for RabbitMQ to Consume and Produce Messages from the message broker. At the moment I not understand how to put in parameters. When I try to append the parameter hostname Exam: .to(rabbitmq:foo?hostname=localhost) I get the following exception: Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: rabbitmq://foo?hostname=localhost due to: null Cheers, Michael
Basic cxf-tomcat-example.html: need explaination. 1M Thanks.
In this example http://camel.apache.org/cxf-tomcat-example.html http://camel.apache.org/cxf-tomcat-example.html No problem with web.xml No problem with CamelRoute.java Not sure How thing tie together? camel-config.xml and http://localhost:8080/camel-example-cxf-tomcat-2.8.1/webservices/incident?wsdl how incident (incident?wsdl) come into the picture? (some thing is implicit that I can not see or read properly) (I can see the tie in the Apache CXF web service without using Camel) -- View this message in context: http://camel.465427.n5.nabble.com/Basic-cxf-tomcat-example-html-need-explaination-1M-Thanks-tp4969057p4969057.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Basic cxf-tomcat-example.html: need explaination. 1M Thanks.
Hi, for a CXF-only web service hosted on Tomcat (sans Camel), Note #2 here: http://www.jroller.com/gmazza/entry/web_service_tutorial#notes shows how the URL is constructed. With Camel, (A), (B), and (C) are the same, but for (D), one of the links that you gave (http://camel.apache.org/cxf-tomcat-example.html) has this text: All we have to do is to define an endpoint uri in the format cxf:/incident?serviceClass=org.apache.camel.example.cxf.incident.IncidentService This means Camel will expose the web service using the relative address /incident... So if you look in CamelRoute.java, that from(uri) statement is what causes /incident to be used as part of the URL string. ?wsdl is the JAX-WS default, the URL to access to obtain a WSDL from the web service provider. HTH, Glen On 11/06/2011 12:26 PM, H Paul wrote: In this example http://camel.apache.org/cxf-tomcat-example.html http://camel.apache.org/cxf-tomcat-example.html No problem with web.xml No problem with CamelRoute.java Not sure How thing tie together? camel-config.xml and http://localhost:8080/camel-example-cxf-tomcat-2.8.1/webservices/incident?wsdl how incident (incident?wsdl) come into the picture? (some thing is implicit that I can not see or read properly) (I can see the tie in the Apache CXF web service without using Camel) -- View this message in context: http://camel.465427.n5.nabble.com/Basic-cxf-tomcat-example-html-need-explaination-1M-Thanks-tp4969057p4969057.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Glen Mazza Talend - http://www.talend.com/apache Blog - http://www.jroller.com/gmazza/ Twitter - glenmazza
Re: Possible memory leak in org.apache.activemq.pool.PooledSession
Hi Claus, Here is the link to minimal Maven project we used to reproduce memory leak in PooledSession http://dl.dropbox.com/u/4387531/camel-memory-leak.zip Sergey -- View this message in context: http://camel.465427.n5.nabble.com/Possible-memory-leak-in-org-apache-activemq-pool-PooledSession-tp4964951p4970070.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Writing own Camel Components
Believe it or not, I started writing a RabbitMQ component on Friday as well ;) Small world. In defense of Michael, I can totally understand why one would want to build a component based on the RabbitMQ client libraries. I've been trying to work with the Qpid libraries talking to a RabbitMQ broker for a while now, and I agree that the two don't necessarily mesh given both the volatility of the AMQP spec as well as the different audiences each tries to reach. Qpid is fantastic for those who were working with JMS and need to migrate to AMQP - it offers very familiar semantics and makes moving from JMS a fairly straightforward affair. The actual AMQP Camel component is only a very few lines, mostly bridging the connection pool back to the JMS component. However, if you want to have more granular control over exchange types, routing keys and queuing discovery then there is a need to do away with the JMS archtypes and move directly into AMQP. As far as other RabbitMQ components there are currently three versions on GitHub: the original LShift prototype, an updated version from abashev and a version from me that hit a brick wall on. Both LShift and abashev's use an abandoned EIP library that has not even been ported to the most recent AMQP client spec, so its use is fairly limited. I attempted to remove this dependency but had significant issues in trying to keep with the code style and design patterns while not re-writing everything. There is enough coding re-work to be done in either branch that it makes more sense just to begin from scratch. The component I started on Friday is almost in working order, but I need to ensure I can release it with an Apache License v2. Once I get that figured out I'll make sure to circulate it for wider use and editing. Should the release under the Apache License be cleared, if Camel would like the component I'd be happy to donate it to the project or just toss it into GitHub for others to use. I've spoken to a few other local engineers who have been working with the AMQP component and they have expressed interest in helping out as well. As far as your original question, usually the best way to set properties specified as part of the parameter string is to call setProperties(endpoint, parameters) from inside your Endpoint class. That will automagically set properties on the target bean based on the properties from your URL string. Michael Prieß wrote: Hello, the reason why I started to build a own component for RabbitMQ is that the actual AMQP Component is based on the QPID Client Library which is not full compatible with RabbitMQ. For my component I used auto discovery and it all works well without parameters. But with the param I got this error that I described above. Regards, Michael 2011/11/6 Jason Whaley lt;jasonwhaley@gt;: Also, if you are intent on writing a custom component, did you either add your component to the CamelContext with the name of rabbitmq or use the auto discovery by creating a file in META-INF as described here http://camel.apache.org/writing-components.html ? On Sun, Nov 6, 2011 at 4:07 PM, Michael Prieß mailinglisteprm@ wrote: Hello, I started today to write a new Camel Component for RabbitMQ to Consume and Produce Messages from the message broker. At the moment I not understand how to put in parameters. When I try to append the parameter hostname Exam: .to(rabbitmq:foo?hostname=localhost) I get the following exception: Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: rabbitmq://foo?hostname=localhost due to: null Cheers, Michael -- View this message in context: http://camel.465427.n5.nabble.com/Writing-own-Camel-Components-tp4969523p4970048.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Basic cxf-tomcat-example.html: need explaination. 1M Thanks.
On 11/7/11 1:26 AM, H Paul wrote: In this example http://camel.apache.org/cxf-tomcat-example.html http://camel.apache.org/cxf-tomcat-example.html No problem with web.xml No problem with CamelRoute.java Not sure How thing tie together? camel-config.xml This file is just create a camel context which loads the CamelRoute. and http://localhost:8080/camel-example-cxf-tomcat-2.8.1/webservices/incident?wsdl As Glen said cxf:/incident?serviceClass=org.apache.camel.example.cxf.incident.IncidentService is the magic, you can also cxfEndpoint to define the CXF endpoint as you do with jaxws:endpoint in CXF. how incident (incident?wsdl) come into the picture? (some thing is implicit that I can not see or read properly) (I can see the tie in the Apache CXF web service without using Camel) Yes, it is exactly. -- View this message in context: http://camel.465427.n5.nabble.com/Basic-cxf-tomcat-example-html-need-explaination-1M-Thanks-tp4969057p4969057.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Willem -- FuseSource Web: http://www.fusesource.com Blog:http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang Weibo: willemjiang
Re: Writing own Camel Components
You should make sure your component has been registed in Camel's registry with the name same as the uri's prefix; for example: given a uri as aaa:bbb?para=..., you must make sure your component has registed with the name aaa; camel provide several mechanism to regist component, if you are using spring, the simplest way is define your component as a bean, and using the bean's name as uri's prefix; if you are using dsl, you can direct regist your component using camel's API, and using the registed name as uri's prefix; - Original Message - From: Michael Prieß mailingliste...@googlemail.com To: users users@camel.apache.org Sent: Monday, November 07, 2011 5:07 AM Subject: Writing own Camel Components Hello, I started today to write a new Camel Component for RabbitMQ to Consume and Produce Messages from the message broker. At the moment I not understand how to put in parameters. When I try to append the parameter hostname Exam: .to(rabbitmq:foo?hostname=localhost) I get the following exception: Caused by: org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: rabbitmq://foo?hostname=localhost due to: null Cheers, Michael
Re: Camel JBI Interaction
Hi, Found one solution. Use servicemix-camel-2011.01-installer.zip. It has Camel 2.6. To use Camel 2.8, the camel-core and camel-spring jars of 2.8 can be replaced in servicemix-camel-2011.01-installer.zip (and jbi.xml). Or build servicemix-camel locally with the required Camel dependencies locally. With Best Regards, Diwakar -- View this message in context: http://camel.465427.n5.nabble.com/Camel-JBI-Interaction-tp4857978p4969206.html Sent from the Camel - Users mailing list archive at Nabble.com.
Escaping parameters in route URI
Hello All, Iam trying to use amqp component of camel. When iam trying to define route using the below mentioned URI amqp:queue:*BURL:direct://lb-push//pingqueue?routingkey=abcd* But unfortunately camel complains that it cant set routingkey parameter on amqp component where as the routingkey parameter belongs to destinationName mentioned in the below route uri amqp:[queue:|topic:]*destinationName*[?options] So my question is,is there any way to escape the question mark here so that camel just considers it as destination name? Thanks -- View this message in context: http://camel.465427.n5.nabble.com/Escaping-parameters-in-route-URI-tp4969666p4969666.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Dynamic layout input to flatpack component
Hi Check this FAQ http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html Would it not be possible to specify the flatpack pzmap file in the uri and then use recipient list, to have dynamic endpoints? On Mon, Nov 7, 2011 at 12:20 AM, Raman Gupta rocketra...@gmail.com wrote: I'd like to use camel in a highly configurable application. As an example, one component I'd like to use is the Flatpack component. The layout (.pzmap.xml) information will be generated from user-entered information stored in a database or other data structure, and this lookup may vary depending on properties of the in message. AFAICT, the built-in flatpack component cannot do this. Is this kind of requirement better implemented outside of camel? Cheers, Raman -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/