Re: XML parse error
Hi, I'm using servicemix 3.3 with camel 2.2. I included in maven pom.xml the saxon 9.1.0.8 dependencies. The camel service unit now contains the lib\saxon-9.1.0.8.jar. But I get the same error message during deployment. But I have in servicemix/lib the xalan-2.7.0.jar which seems to be a XSLT 1.0 processor. Could be happen that servicemix is using xalan instead of saxon currently included in camel service unit??? Thanks, On Thu, Jan 6, 2011 at 9:25 PM, Mark Ford m...@massfords.com wrote: Are you using XSLT 2.0? If so, you should verify that you have an XSLT 2.0 capable library in your classpath. Perhaps when you're using the endpoint within JBI there is a 2.0 capable API in the classpath. If you're using Maven, then add the following: dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version /dependency dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version classifierdom/classifier /dependency If not, then download a recent version of saxon and try it. On Thu, Jan 6, 2011 at 7:39 AM, Kovacs Zsolt zsolt.m.kov...@gmail.com wrote: Hi, I have a camel endpoint .to(xslt:xslt/transformer.xsl) and in the transformer.xml file I try to use xsl:variable name=now select=current-dateTime()/ but deployment failed and get the Error creating XSLT template. This is most likely be caused by a XML parse error. Please verify your XSLT file configured. message. I guess the problem is probably caused by the parser used by Camel because when I using as jbi endpoint there are no issues. Can I change the Camel XML parser ? Thanks, Zsolt
Re: XML parse error
Camel just create the transform template with below code. return (TransformerFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ javax.xml.transform.TransformerFactory, /* The fallback implementation class name, XSLTC */ com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl); And the service lib class can be find from the su. Can you try to remove the xalan-2.7.0.jar from the lib, or you need to regenerate a new servicemix-camel component[1] which includes the saxon. [1]http://camel.apache.org/how-to-use-extra-camel-componets-in-servicemix-camel.html On 1/7/11 4:08 PM, Kovacs Zsolt wrote: Hi, I'm using servicemix 3.3 with camel 2.2. I included in maven pom.xml the saxon 9.1.0.8 dependencies. The camel service unit now contains the lib\saxon-9.1.0.8.jar. But I get the same error message during deployment. But I have in servicemix/lib the xalan-2.7.0.jar which seems to be a XSLT 1.0 processor. Could be happen that servicemix is using xalan instead of saxon currently included in camel service unit??? Thanks, On Thu, Jan 6, 2011 at 9:25 PM, Mark Fordm...@massfords.com wrote: Are you using XSLT 2.0? If so, you should verify that you have an XSLT 2.0 capable library in your classpath. Perhaps when you're using the endpoint within JBI there is a 2.0 capable API in the classpath. If you're using Maven, then add the following: dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version /dependency dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version classifierdom/classifier /dependency If not, then download a recent version of saxon and try it. On Thu, Jan 6, 2011 at 7:39 AM, Kovacs Zsoltzsolt.m.kov...@gmail.com wrote: Hi, I have a camel endpoint .to(xslt:xslt/transformer.xsl) and in the transformer.xml file I try to use xsl:variable name=now select=current-dateTime()/ but deployment failed and get the Error creating XSLT template. This is most likely be caused by a XML parse error. Please verify your XSLT file configured. message. I guess the problem is probably caused by the parser used by Camel because when I using as jbi endpoint there are no issues. Can I change the Camel XML parser ? Thanks, Zsolt -- Willem -- FuseSource Web: http://www.fusesource.com Blog:http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang
Alert by mail onException...but only one mail
Hello, first of all, best wishes for 2011 and long life to Camel ! My question is : I have a route which consumes a text file (from(file:...)) containing some lines (with \n as separator) Suppose I have a problem when I'm processing a line in my route and it remains 1000 lines to process, how can I onException (see below) send only one alert mail and not 1000 mails with the same exception ? onException(MyProcessException.class).to(smtpTechnicalSupport); Thanks for solution JM -- View this message in context: http://camel.465427.n5.nabble.com/Alert-by-mail-onException-but-only-one-mail-tp3331622p3331622.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: XML parse error
OK, I removed xalan from servicemix/lib and copied saxon there (to servicemix/lib), and it's working fine so I can used XSLT 2.0 functions (current-dateTime() in my case). Thanks!!! On Fri, Jan 7, 2011 at 10:49 AM, Willem Jiang willem.ji...@gmail.com wrote: Camel just create the transform template with below code. return (TransformerFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ javax.xml.transform.TransformerFactory, /* The fallback implementation class name, XSLTC */ com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl); And the service lib class can be find from the su. Can you try to remove the xalan-2.7.0.jar from the lib, or you need to regenerate a new servicemix-camel component[1] which includes the saxon. [1]http://camel.apache.org/how-to-use-extra-camel-componets-in-servicemix-camel.html On 1/7/11 4:08 PM, Kovacs Zsolt wrote: Hi, I'm using servicemix 3.3 with camel 2.2. I included in maven pom.xml the saxon 9.1.0.8 dependencies. The camel service unit now contains the lib\saxon-9.1.0.8.jar. But I get the same error message during deployment. But I have in servicemix/lib the xalan-2.7.0.jar which seems to be a XSLT 1.0 processor. Could be happen that servicemix is using xalan instead of saxon currently included in camel service unit??? Thanks, On Thu, Jan 6, 2011 at 9:25 PM, Mark Fordm...@massfords.com wrote: Are you using XSLT 2.0? If so, you should verify that you have an XSLT 2.0 capable library in your classpath. Perhaps when you're using the endpoint within JBI there is a 2.0 capable API in the classpath. If you're using Maven, then add the following: dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version /dependency dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version classifierdom/classifier /dependency If not, then download a recent version of saxon and try it. On Thu, Jan 6, 2011 at 7:39 AM, Kovacs Zsoltzsolt.m.kov...@gmail.com wrote: Hi, I have a camel endpoint .to(xslt:xslt/transformer.xsl) and in the transformer.xml file I try to use xsl:variable name=now select=current-dateTime()/ but deployment failed and get the Error creating XSLT template. This is most likely be caused by a XML parse error. Please verify your XSLT file configured. message. I guess the problem is probably caused by the parser used by Camel because when I using as jbi endpoint there are no issues. Can I change the Camel XML parser ? Thanks, Zsolt -- Willem -- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang
Consuming messages based on a predicate
Hi, I am building a Camel route which consumes from a JMS queue, does JSON to XML conversion and then calls a web service to send requests to a third party. This third party only wants to receive the messages during their opening hours. This made me immediately think to use the Quartz component to consume during certain hours. However their opening hours change frequently, and we have a database table which stores the current schedule. There is a nice service with a method isOpen() which can determine whether they are open currently. If I take the message off the queue and then check the predicate it could be looping the messages around for hours or days at a time until they are open. Is there a nice way to create a route to do this? Thanks, Martin
Integrating camel with activiti
Hi, Activiti (http://activiti.org) is a 'superdelux process engine for Java' (quote from http://forums.activiti.org/ ;)), which uses BPMN 2.0 and comes with Apache Licence. It has some nice management webapps, and can be run either embedded in java application or e.g. in OSGi environment. I wrote simple camel component which enables enables integration with activiti. You can invoke camel route from process: serviceTask id=serviceTask activiti:delegateExpression=${camel}/ (bpmn 2.0 fragment) from(activiti:camelProcess:serviceTask) .to(log:pl.touk) .setBody().property(var1) .to(file:///tmp/activiti/serviceTask); (camelProcess is name of bpmn process, var1 is variable in process) You can also signal process from camel route: receiveTask id=receive name=Wait State/ (bpmn 2.0 fragment) from( file:///tmp/activiti/receive) .convertBodyTo(String.class) .setProperty(PROCESS_KEY_PROPERTY).xpath(//@key) .to(activiti:camelProcess:receive); (PROCESS_KEY_PROPERTY is business process identifier, camelProcess is bpmn process name) https://github.com/mproch/camel-activiti - here is the code https://github.com/mproch/activitiCamelKarafSample - here is sample, and here http://forums.activiti.org/en/viewtopic.php?f=4t=630 is description for activiti forum (it starts with some 'why is camel great framework ;)). I'm not sure where does this project really belong to - activiti or camel (assuming of course that any community would accept this contribution ;)), however activiti is being developing more rapidly now (1 month release cycle) so guess it makes more sense to put it in activiti. I'd be grateful for any comments/remarks br, maciek prochniak
Re: Consuming messages based on a predicate
On Fri, Jan 7, 2011 at 12:20 PM, Martin Gilday martin.li...@imap.cc wrote: Hi, I am building a Camel route which consumes from a JMS queue, does JSON to XML conversion and then calls a web service to send requests to a third party. This third party only wants to receive the messages during their opening hours. This made me immediately think to use the Quartz component to consume during certain hours. However their opening hours change frequently, and we have a database table which stores the current schedule. There is a nice service with a method isOpen() which can determine whether they are open currently. If I take the message off the queue and then check the predicate it could be looping the messages around for hours or days at a time until they are open. Is there a nice way to create a route to do this? Something similar to http://camel.apache.org/scheduledroutepolicy.html But instead just implement your own scheduling logic. For example have a background thread invoke once a minute or something and determine if its open. And then suspend/resume the route accordingly. Thanks, Martin -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Integrating camel with activiti
Hi Maceik Great work you have done. I can see this is also being discussed that the Activiti forum http://forums.activiti.org/en/viewtopic.php?f=4t=630 From a first impression I would assume the component is best suited for home at Activiti. There is a rapid release schedule and I would assume most of the features and work on the component is more Activiti related than Camel. After all Camel is just the glue. So maybe we should push for it to be donated and included at Activiti, if they would accept it? If not then it can certainly be included out of the box at Apache Camel. As we love contributions and involvement from the community. http://camel.apache.org/contributing.html For example for the next Camel 2.6 release we got like 8-10 new artifacts, and only the 2 osgi related was created by a Camel committer (Guillaume Nodet). So that's a strong sign the community is kick ass and we love their contributions to Apache Camel. On Fri, Jan 7, 2011 at 12:26 PM, Maciek Próchniak m...@touk.pl wrote: Hi, Activiti (http://activiti.org) is a 'superdelux process engine for Java' (quote from http://forums.activiti.org/ ;)), which uses BPMN 2.0 and comes with Apache Licence. It has some nice management webapps, and can be run either embedded in java application or e.g. in OSGi environment. I wrote simple camel component which enables enables integration with activiti. You can invoke camel route from process: serviceTask id=serviceTask activiti:delegateExpression=${camel}/ (bpmn 2.0 fragment) from(activiti:camelProcess:serviceTask) .to(log:pl.touk) .setBody().property(var1) .to(file:///tmp/activiti/serviceTask); (camelProcess is name of bpmn process, var1 is variable in process) You can also signal process from camel route: receiveTask id=receive name=Wait State/ (bpmn 2.0 fragment) from( file:///tmp/activiti/receive) .convertBodyTo(String.class) .setProperty(PROCESS_KEY_PROPERTY).xpath(//@key) .to(activiti:camelProcess:receive); (PROCESS_KEY_PROPERTY is business process identifier, camelProcess is bpmn process name) https://github.com/mproch/camel-activiti - here is the code https://github.com/mproch/activitiCamelKarafSample - here is sample, and here http://forums.activiti.org/en/viewtopic.php?f=4t=630 is description for activiti forum (it starts with some 'why is camel great framework ;)). I'm not sure where does this project really belong to - activiti or camel (assuming of course that any community would accept this contribution ;)), however activiti is being developing more rapidly now (1 month release cycle) so guess it makes more sense to put it in activiti. I'd be grateful for any comments/remarks br, maciek prochniak -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: XML parse error
Still there is a problem. If I remove xalan from servicemix/lib directory other older service assemblies (SA) are failing. java.lang.NullPointerException at net.sf.saxon.event.ReceivingContentHandler.getNameCode(ReceivingContentHandler.java:391) at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:314) at org.apache.servicemix.soap.util.stax.StaxSource.parse(StaxSource.java:115) I don't know the cause of this exceptions. Seems that I need xalan as processor for other legacy SA. If I'm packaging saxon with my camel service unit (including in maven pom.xml as dependency), and xalan is located in lib directory then servicemix still is using xalan as processor. It's possible to tell servicemix that I want to use saxon as XSLT processor if it's packaged into SA and xalan (from lib directory) otherwise? Thanks, On Fri, Jan 7, 2011 at 12:16 PM, Kovacs Zsolt zsolt.m.kov...@gmail.com wrote: OK, I removed xalan from servicemix/lib and copied saxon there (to servicemix/lib), and it's working fine so I can used XSLT 2.0 functions (current-dateTime() in my case). Thanks!!! On Fri, Jan 7, 2011 at 10:49 AM, Willem Jiang willem.ji...@gmail.com wrote: Camel just create the transform template with below code. return (TransformerFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ javax.xml.transform.TransformerFactory, /* The fallback implementation class name, XSLTC */ com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl); And the service lib class can be find from the su. Can you try to remove the xalan-2.7.0.jar from the lib, or you need to regenerate a new servicemix-camel component[1] which includes the saxon. [1]http://camel.apache.org/how-to-use-extra-camel-componets-in-servicemix-camel.html On 1/7/11 4:08 PM, Kovacs Zsolt wrote: Hi, I'm using servicemix 3.3 with camel 2.2. I included in maven pom.xml the saxon 9.1.0.8 dependencies. The camel service unit now contains the lib\saxon-9.1.0.8.jar. But I get the same error message during deployment. But I have in servicemix/lib the xalan-2.7.0.jar which seems to be a XSLT 1.0 processor. Could be happen that servicemix is using xalan instead of saxon currently included in camel service unit??? Thanks, On Thu, Jan 6, 2011 at 9:25 PM, Mark Fordm...@massfords.com wrote: Are you using XSLT 2.0? If so, you should verify that you have an XSLT 2.0 capable library in your classpath. Perhaps when you're using the endpoint within JBI there is a 2.0 capable API in the classpath. If you're using Maven, then add the following: dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version /dependency dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version classifierdom/classifier /dependency If not, then download a recent version of saxon and try it. On Thu, Jan 6, 2011 at 7:39 AM, Kovacs Zsoltzsolt.m.kov...@gmail.com wrote: Hi, I have a camel endpoint .to(xslt:xslt/transformer.xsl) and in the transformer.xml file I try to use xsl:variable name=now select=current-dateTime()/ but deployment failed and get the Error creating XSLT template. This is most likely be caused by a XML parse error. Please verify your XSLT file configured. message. I guess the problem is probably caused by the parser used by Camel because when I using as jbi endpoint there are no issues. Can I change the Camel XML parser ? Thanks, Zsolt -- Willem -- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang
Re: Consuming messages based on a predicate
Thanks, Claus. We are still on Camel 2.3 at the moment with this project. Are there any alternatives? Martin. - Original message - From: Claus Ibsen claus.ib...@gmail.com To: users@camel.apache.org Date: Fri, 7 Jan 2011 12:46:48 +0100 Subject: Re: Consuming messages based on a predicate On Fri, Jan 7, 2011 at 12:20 PM, Martin Gilday martin.li...@imap.cc wrote: Hi, I am building a Camel route which consumes from a JMS queue, does JSON to XML conversion and then calls a web service to send requests to a third party. This third party only wants to receive the messages during their opening hours. This made me immediately think to use the Quartz component to consume during certain hours. However their opening hours change frequently, and we have a database table which stores the current schedule. There is a nice service with a method isOpen() which can determine whether they are open currently. If I take the message off the queue and then check the predicate it could be looping the messages around for hours or days at a time until they are open. Is there a nice way to create a route to do this? Something similar to http://camel.apache.org/scheduledroutepolicy.html But instead just implement your own scheduling logic. For example have a background thread invoke once a minute or something and determine if its open. And then suspend/resume the route accordingly. Thanks, Martin -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Consuming messages based on a predicate
On Fri, Jan 7, 2011 at 1:42 PM, Martin Gilday martin.li...@imap.cc wrote: Thanks, Claus. We are still on Camel 2.3 at the moment with this project. Are there any alternatives? If RoutePolicy SPI is part of Camel 2.3, then its all you need. Just implement it with that open/close logic and assign it to the route. Martin. - Original message - From: Claus Ibsen claus.ib...@gmail.com To: users@camel.apache.org Date: Fri, 7 Jan 2011 12:46:48 +0100 Subject: Re: Consuming messages based on a predicate On Fri, Jan 7, 2011 at 12:20 PM, Martin Gilday martin.li...@imap.cc wrote: Hi, I am building a Camel route which consumes from a JMS queue, does JSON to XML conversion and then calls a web service to send requests to a third party. This third party only wants to receive the messages during their opening hours. This made me immediately think to use the Quartz component to consume during certain hours. However their opening hours change frequently, and we have a database table which stores the current schedule. There is a nice service with a method isOpen() which can determine whether they are open currently. If I take the message off the queue and then check the predicate it could be looping the messages around for hours or days at a time until they are open. Is there a nice way to create a route to do this? Something similar to http://camel.apache.org/scheduledroutepolicy.html But instead just implement your own scheduling logic. For example have a background thread invoke once a minute or something and determine if its open. And then suspend/resume the route accordingly. Thanks, Martin -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Consuming Files using Timer/Quartz
Thanks Christian. It worked well with Consumer and Producer Templates. -- View this message in context: http://camel.465427.n5.nabble.com/Consuming-Files-using-Timer-Quartz-tp3320330p3331784.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Integrating camel with activiti
hi Claus, On Fri, 2011-01-07 at 13:14 +0100, Claus Ibsen wrote: Hi Maceik Great work you have done. I can see this is also being discussed that the Activiti forum http://forums.activiti.org/en/viewtopic.php?f=4t=630 From a first impression I would assume the component is best suited for home at Activiti. There is a rapid release schedule and I would assume most of the features and work on the component is more Activiti related than Camel. After all Camel is just the glue. So maybe we should push for it to be donated and included at Activiti, if they would accept it? I agree, activiti seems to be better place. If not then it can certainly be included out of the box at Apache Camel. As we love contributions and involvement from the community. http://camel.apache.org/contributing.html For example for the next Camel 2.6 release we got like 8-10 new artifacts, and only the 2 osgi related was created by a Camel committer (Guillaume Nodet). So that's a strong sign the community is kick ass and we love their contributions to Apache Camel. Yes, from OS projects I'm looking at, Camel seems to be by far most contribution-friendly one - really great attitude :) maciek On Fri, Jan 7, 2011 at 12:26 PM, Maciek Próchniak m...@touk.pl wrote: Hi, Activiti (http://activiti.org) is a 'superdelux process engine for Java' (quote from http://forums.activiti.org/ ;)), which uses BPMN 2.0 and comes with Apache Licence. It has some nice management webapps, and can be run either embedded in java application or e.g. in OSGi environment. I wrote simple camel component which enables enables integration with activiti. You can invoke camel route from process: serviceTask id=serviceTask activiti:delegateExpression=${camel}/ (bpmn 2.0 fragment) from(activiti:camelProcess:serviceTask) .to(log:pl.touk) .setBody().property(var1) .to(file:///tmp/activiti/serviceTask); (camelProcess is name of bpmn process, var1 is variable in process) You can also signal process from camel route: receiveTask id=receive name=Wait State/ (bpmn 2.0 fragment) from( file:///tmp/activiti/receive) .convertBodyTo(String.class) .setProperty(PROCESS_KEY_PROPERTY).xpath(//@key) .to(activiti:camelProcess:receive); (PROCESS_KEY_PROPERTY is business process identifier, camelProcess is bpmn process name) https://github.com/mproch/camel-activiti - here is the code https://github.com/mproch/activitiCamelKarafSample - here is sample, and here http://forums.activiti.org/en/viewtopic.php?f=4t=630 is description for activiti forum (it starts with some 'why is camel great framework ;)). I'm not sure where does this project really belong to - activiti or camel (assuming of course that any community would accept this contribution ;)), however activiti is being developing more rapidly now (1 month release cycle) so guess it makes more sense to put it in activiti. I'd be grateful for any comments/remarks br, maciek prochniak
Re: Integrating camel with activiti
Thanks Maciek for the component. It's very interesting. I will take a look asap. Regards JB On 01/07/2011 12:26 PM, Maciek Próchniak wrote: Hi, Activiti (http://activiti.org) is a 'superdelux process engine for Java' (quote from http://forums.activiti.org/ ;)), which uses BPMN 2.0 and comes with Apache Licence. It has some nice management webapps, and can be run either embedded in java application or e.g. in OSGi environment. I wrote simple camel component which enables enables integration with activiti. You can invoke camel route from process: serviceTask id=serviceTask activiti:delegateExpression=${camel}/ (bpmn 2.0 fragment) from(activiti:camelProcess:serviceTask) .to(log:pl.touk) .setBody().property(var1) .to(file:///tmp/activiti/serviceTask); (camelProcess is name of bpmn process, var1 is variable in process) You can also signal process from camel route: receiveTask id=receive name=Wait State/ (bpmn 2.0 fragment) from( file:///tmp/activiti/receive) .convertBodyTo(String.class) .setProperty(PROCESS_KEY_PROPERTY).xpath(//@key) .to(activiti:camelProcess:receive); (PROCESS_KEY_PROPERTY is business process identifier, camelProcess is bpmn process name) https://github.com/mproch/camel-activiti - here is the code https://github.com/mproch/activitiCamelKarafSample - here is sample, and here http://forums.activiti.org/en/viewtopic.php?f=4t=630 is description for activiti forum (it starts with some 'why is camel great framework ;)). I'm not sure where does this project really belong to - activiti or camel (assuming of course that any community would accept this contribution ;)), however activiti is being developing more rapidly now (1 month release cycle) so guess it makes more sense to put it in activiti. I'd be grateful for any comments/remarks br, maciek prochniak
Re: Alert by mail onException...but only one mail
Hi You can use onCompletion on the route. http://camel.apache.org/oncompletion.html Then that will be invoked once the route is complete (eg after the splitter is done) The caused exception is stored as a property on the Exchange if you want to grab it. On Fri, Jan 7, 2011 at 11:06 AM, jmh jeanmarc.her...@nrb.be wrote: Hello, first of all, best wishes for 2011 and long life to Camel ! My question is : I have a route which consumes a text file (from(file:...)) containing some lines (with \n as separator) Suppose I have a problem when I'm processing a line in my route and it remains 1000 lines to process, how can I onException (see below) send only one alert mail and not 1000 mails with the same exception ? onException(MyProcessException.class).to(smtpTechnicalSupport); Thanks for solution JM -- View this message in context: http://camel.465427.n5.nabble.com/Alert-by-mail-onException-but-only-one-mail-tp3331622p3331622.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 Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: XML parse error
please use transformerFactoryClass option for xslt component like this from(xxx) .to(xslt:com/acme/mytransform.xsl?transformerFactoryClass=net.sf.saxon.TransformerFactoryImpl) ... Willem On 1/7/11 8:17 PM, Kovacs Zsolt wrote: Still there is a problem. If I remove xalan from servicemix/lib directory other older service assemblies (SA) are failing. java.lang.NullPointerException at net.sf.saxon.event.ReceivingContentHandler.getNameCode(ReceivingContentHandler.java:391) at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:314) at org.apache.servicemix.soap.util.stax.StaxSource.parse(StaxSource.java:115) I don't know the cause of this exceptions. Seems that I need xalan as processor for other legacy SA. If I'm packaging saxon with my camel service unit (including in maven pom.xml as dependency), and xalan is located in lib directory then servicemix still is using xalan as processor. It's possible to tell servicemix that I want to use saxon as XSLT processor if it's packaged into SA and xalan (from lib directory) otherwise? Thanks, On Fri, Jan 7, 2011 at 12:16 PM, Kovacs Zsoltzsolt.m.kov...@gmail.com wrote: OK, I removed xalan from servicemix/lib and copied saxon there (to servicemix/lib), and it's working fine so I can used XSLT 2.0 functions (current-dateTime() in my case). Thanks!!! On Fri, Jan 7, 2011 at 10:49 AM, Willem Jiangwillem.ji...@gmail.com wrote: Camel just create the transform template with below code. return (TransformerFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ javax.xml.transform.TransformerFactory, /* The fallback implementation class name, XSLTC */ com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl); And the service lib class can be find from the su. Can you try to remove the xalan-2.7.0.jar from the lib, or you need to regenerate a new servicemix-camel component[1] which includes the saxon. [1]http://camel.apache.org/how-to-use-extra-camel-componets-in-servicemix-camel.html On 1/7/11 4:08 PM, Kovacs Zsolt wrote: Hi, I'm using servicemix 3.3 with camel 2.2. I included in maven pom.xml the saxon 9.1.0.8 dependencies. The camel service unit now contains the lib\saxon-9.1.0.8.jar. But I get the same error message during deployment. But I have in servicemix/lib the xalan-2.7.0.jar which seems to be a XSLT 1.0 processor. Could be happen that servicemix is using xalan instead of saxon currently included in camel service unit??? Thanks, On Thu, Jan 6, 2011 at 9:25 PM, Mark Fordm...@massfords.comwrote: Are you using XSLT 2.0? If so, you should verify that you have an XSLT 2.0 capable library in your classpath. Perhaps when you're using the endpoint within JBI there is a 2.0 capable API in the classpath. If you're using Maven, then add the following: dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version /dependency dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version classifierdom/classifier /dependency If not, then download a recent version of saxon and try it. On Thu, Jan 6, 2011 at 7:39 AM, Kovacs Zsoltzsolt.m.kov...@gmail.com wrote: Hi, I have a camel endpoint .to(xslt:xslt/transformer.xsl) and in the transformer.xml file I try to use xsl:variable name=now select=current-dateTime()/ but deployment failed and get the Error creating XSLT template. This is most likely be caused by a XML parse error. Please verify your XSLT file configured. message. I guess the problem is probably caused by the parser used by Camel because when I using as jbi endpoint there are no issues. Can I change the Camel XML parser ? Thanks, Zsolt -- Willem -- FuseSource Web: http://www.fusesource.com Blog:http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang -- Willem -- FuseSource Web: http://www.fusesource.com Blog:http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang
Re: XML parse error
Another option is to tweak the classloader setting for your service unit: http://servicemix.apache.org/classloaders.html You can enable self-first delegation and then hide the xalan packages so they don't load. This will allow you to use the version of saxon for the camel component and any other XSLT transformations you're doing. On Fri, Jan 7, 2011 at 8:45 AM, Willem Jiang willem.ji...@gmail.com wrote: please use transformerFactoryClass option for xslt component like this from(xxx) .to(xslt:com/acme/mytransform.xsl?transformerFactoryClass=net.sf.saxon.TransformerFactoryImpl) ... Willem On 1/7/11 8:17 PM, Kovacs Zsolt wrote: Still there is a problem. If I remove xalan from servicemix/lib directory other older service assemblies (SA) are failing. java.lang.NullPointerException at net.sf.saxon.event.ReceivingContentHandler.getNameCode(ReceivingContentHandler.java:391) at net.sf.saxon.event.ReceivingContentHandler.startElement(ReceivingContentHandler.java:314) at org.apache.servicemix.soap.util.stax.StaxSource.parse(StaxSource.java:115) I don't know the cause of this exceptions. Seems that I need xalan as processor for other legacy SA. If I'm packaging saxon with my camel service unit (including in maven pom.xml as dependency), and xalan is located in lib directory then servicemix still is using xalan as processor. It's possible to tell servicemix that I want to use saxon as XSLT processor if it's packaged into SA and xalan (from lib directory) otherwise? Thanks, On Fri, Jan 7, 2011 at 12:16 PM, Kovacs Zsoltzsolt.m.kov...@gmail.com wrote: OK, I removed xalan from servicemix/lib and copied saxon there (to servicemix/lib), and it's working fine so I can used XSLT 2.0 functions (current-dateTime() in my case). Thanks!!! On Fri, Jan 7, 2011 at 10:49 AM, Willem Jiangwillem.ji...@gmail.com wrote: Camel just create the transform template with below code. return (TransformerFactory) FactoryFinder.find( /* The default property name according to the JAXP spec */ javax.xml.transform.TransformerFactory, /* The fallback implementation class name, XSLTC */ com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl); And the service lib class can be find from the su. Can you try to remove the xalan-2.7.0.jar from the lib, or you need to regenerate a new servicemix-camel component[1] which includes the saxon. [1]http://camel.apache.org/how-to-use-extra-camel-componets-in-servicemix-camel.html On 1/7/11 4:08 PM, Kovacs Zsolt wrote: Hi, I'm using servicemix 3.3 with camel 2.2. I included in maven pom.xml the saxon 9.1.0.8 dependencies. The camel service unit now contains the lib\saxon-9.1.0.8.jar. But I get the same error message during deployment. But I have in servicemix/lib the xalan-2.7.0.jar which seems to be a XSLT 1.0 processor. Could be happen that servicemix is using xalan instead of saxon currently included in camel service unit??? Thanks, On Thu, Jan 6, 2011 at 9:25 PM, Mark Fordm...@massfords.com wrote: Are you using XSLT 2.0? If so, you should verify that you have an XSLT 2.0 capable library in your classpath. Perhaps when you're using the endpoint within JBI there is a 2.0 capable API in the classpath. If you're using Maven, then add the following: dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version /dependency dependency groupIdnet.sourceforge.saxon/groupId artifactIdsaxon/artifactId version9.1.0.8/version classifierdom/classifier /dependency If not, then download a recent version of saxon and try it. On Thu, Jan 6, 2011 at 7:39 AM, Kovacs Zsoltzsolt.m.kov...@gmail.com wrote: Hi, I have a camel endpoint .to(xslt:xslt/transformer.xsl) and in the transformer.xml file I try to use xsl:variable name=now select=current-dateTime()/ but deployment failed and get the Error creating XSLT template. This is most likely be caused by a XML parse error. Please verify your XSLT file configured. message. I guess the problem is probably caused by the parser used by Camel because when I using as jbi endpoint there are no issues. Can I change the Camel XML parser ? Thanks, Zsolt -- Willem -- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang -- Willem -- FuseSource Web: http://www.fusesource.com Blog: http://willemjiang.blogspot.com (English) http://jnn.javaeye.com (Chinese) Twitter: willemjiang
Re: Can't subscribe to the Mailing list!!!
Hi Sign up here instead http://camel.apache.org/mailing-lists.html -- View this message in context: http://camel.465427.n5.nabble.com/Can-t-subscribe-to-the-Mailing-list-tp3331852p3331869.html Sent from the Camel - Users mailing list archive at Nabble.com.
Processor sending new message
I have a processor that is handling messages and doing some metrics on the messages. If a certain threshold is hit I would like to send a new message to a queue that subscribers can receive. Is this possible? So for example, you have a processor that receives messages. After every 100 messages, the processor sends a new message to a subscriber stating that 100 messages have been received. Thanks, Mark
Re: Processor sending new message
Sure.. You could use the ProducerTemplate.send(...) for that. Bye, Norman 2011/1/7 Mark Webb elihusma...@gmail.com: I have a processor that is handling messages and doing some metrics on the messages. If a certain threshold is hit I would like to send a new message to a queue that subscribers can receive. Is this possible? So for example, you have a processor that receives messages. After every 100 messages, the processor sends a new message to a subscriber stating that 100 messages have been received. Thanks, Mark
Freeing objects returned by type converter
Hello all, I have recently started using camel and it's fantastic. Thanks for all your hard work, committers. One issue I came across is whether I should free or close objects returned by a type converter. For example, I have a class that reads some binary data from an InputStream so I wrote a custom Processor that does this: InputStream productStream = exchange.getIn().getBody(InputStream.class); It appears that I need to call close() on productStream or else my file consumer was leaving open handles to the source files. Is this always the case? If the body was already an InputStream, would calling close() be harmful? Am I doing something wrong? I couldn't find anything in the documentation regarding this--type converters were always used to convert to Strings in examples. Thanks in advance, David -- Wise men _still_ seek Him.
Re: Freeing objects returned by type converter
On 7 January 2011 14:51, David Tombs cyan.s...@gmail.com wrote: Hello all, I have recently started using camel and it's fantastic. Thanks for all your hard work, committers. Thanks! One issue I came across is whether I should free or close objects returned by a type converter. For example, I have a class that reads some binary data from an InputStream so I wrote a custom Processor that does this: InputStream productStream = exchange.getIn().getBody(InputStream.class); It appears that I need to call close() on productStream or else my file consumer was leaving open handles to the source files. Is this always the case? If the body was already an InputStream, would calling close() be harmful? Am I doing something wrong? I couldn't find anything in the documentation regarding this--type converters were always used to convert to Strings in examples. Once you've created the stream, its up to you to close it. So you might want to create a little helper class to make sure you always call close on it. I guess we could add a little helper class to Camel to make it a bit easier to use streams and ensure they get closed. -- -- James --- FuseSource Email: ja...@fusesource.com Web: http://fusesource.com Twitter: jstrachan Blog: http://macstrac.blogspot.com/ Open Source Integration
Re: Freeing objects returned by type converter
On 1/7/11, James Strachan ja...@fusesource.com wrote: On 7 January 2011 14:51, David Tombs cyan.s...@gmail.com wrote: Hello all, I have recently started using camel and it's fantastic. Thanks for all your hard work, committers. Thanks! One issue I came across is whether I should free or close objects returned by a type converter. For example, I have a class that reads some binary data from an InputStream so I wrote a custom Processor that does this: InputStream productStream = exchange.getIn().getBody(InputStream.class); It appears that I need to call close() on productStream or else my file consumer was leaving open handles to the source files. Is this always the case? If the body was already an InputStream, would calling close() be harmful? Am I doing something wrong? I couldn't find anything in the documentation regarding this--type converters were always used to convert to Strings in examples. Once you've created the stream, its up to you to close it. So you might want to create a little helper class to make sure you always call close on it. I guess we could add a little helper class to Camel to make it a bit easier to use streams and ensure they get closed. -- -- James Thanks for the quick reply, James. One remaining question: how does this work if the body was already an InputStream? Would a type converter even be used in that case? Would the IS I get back be a clone of the real IS or something like that? David -- Wise men _still_ seek Him.
Re: Freeing objects returned by type converter
On 7 January 2011 14:55, James Strachan ja...@fusesource.com wrote: On 7 January 2011 14:51, David Tombs cyan.s...@gmail.com wrote: One issue I came across is whether I should free or close objects returned by a type converter. For example, I have a class that reads some binary data from an InputStream so I wrote a custom Processor that does this: InputStream productStream = exchange.getIn().getBody(InputStream.class); It appears that I need to call close() on productStream or else my file consumer was leaving open handles to the source files. Is this always the case? If the body was already an InputStream, would calling close() be harmful? Am I doing something wrong? I couldn't find anything in the documentation regarding this--type converters were always used to convert to Strings in examples. Once you've created the stream, its up to you to close it. So you might want to create a little helper class to make sure you always call close on it. I guess we could add a little helper class to Camel to make it a bit easier to use streams and ensure they get closed. Here's a little sample helper class doing the try/catch stuff for you... https://gist.github.com/769594 I wonder if we should add something like this into Camel? -- -- James --- FuseSource Email: ja...@fusesource.com Web: http://fusesource.com Twitter: jstrachan Blog: http://macstrac.blogspot.com/ Open Source Integration
Re: Freeing objects returned by type converter
On Fri, Jan 7, 2011 at 4:14 PM, David Tombs cyan.s...@gmail.com wrote: On 1/7/11, James Strachan ja...@fusesource.com wrote: On 7 January 2011 14:51, David Tombs cyan.s...@gmail.com wrote: Hello all, I have recently started using camel and it's fantastic. Thanks for all your hard work, committers. Thanks! One issue I came across is whether I should free or close objects returned by a type converter. For example, I have a class that reads some binary data from an InputStream so I wrote a custom Processor that does this: InputStream productStream = exchange.getIn().getBody(InputStream.class); It appears that I need to call close() on productStream or else my file consumer was leaving open handles to the source files. Is this always the case? If the body was already an InputStream, would calling close() be harmful? Am I doing something wrong? I couldn't find anything in the documentation regarding this--type converters were always used to convert to Strings in examples. Once you've created the stream, its up to you to close it. So you might want to create a little helper class to make sure you always call close on it. I guess we could add a little helper class to Camel to make it a bit easier to use streams and ensure they get closed. -- -- James Thanks for the quick reply, James. One remaining question: how does this work if the body was already an InputStream? Would a type converter even be used in that case? Would the IS I get back be a clone of the real IS or something like that? If the body is already the type you want to convert to, then its returned as is. David -- Wise men _still_ seek Him. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Sending serialized object instead of BeanInvocation through pojo producing
Hi all, I would like to send an object to a jms queue using camel. While I know I can do: @EndpointInject(uri=jms:foo.bar) ProducerTemplate producer; producer.sendBody(book); The problem with the above code is that I have camel in the business logic. So I would like to use an interface like: public interface BookListener { void onBook(Book book); } @Produce(jms:foo.bar) BookListener bookListener; bookListener.onBook(book); When I do this I send a BeanInvocation to the jms queue. Is it possible to only send the jaxb serialized object ? Thanks Christian -- http://www.liquid-reality.de
Re: Freeing objects returned by type converter
On Fri, Jan 7, 2011 at 10:39 AM, Claus Ibsen claus.ib...@gmail.com wrote: On Fri, Jan 7, 2011 at 4:14 PM, David Tombs cyan.s...@gmail.com wrote: On 1/7/11, James Strachan ja...@fusesource.com wrote: On 7 January 2011 14:51, David Tombs cyan.s...@gmail.com wrote: Hello all, I have recently started using camel and it's fantastic. Thanks for all your hard work, committers. Thanks! One issue I came across is whether I should free or close objects returned by a type converter. For example, I have a class that reads some binary data from an InputStream so I wrote a custom Processor that does this: InputStream productStream = exchange.getIn().getBody(InputStream.class); It appears that I need to call close() on productStream or else my file consumer was leaving open handles to the source files. Is this always the case? If the body was already an InputStream, would calling close() be harmful? Am I doing something wrong? I couldn't find anything in the documentation regarding this--type converters were always used to convert to Strings in examples. Once you've created the stream, its up to you to close it. So you might want to create a little helper class to make sure you always call close on it. I guess we could add a little helper class to Camel to make it a bit easier to use streams and ensure they get closed. -- -- James Thanks for the quick reply, James. One remaining question: how does this work if the body was already an InputStream? Would a type converter even be used in that case? Would the IS I get back be a clone of the real IS or something like that? If the body is already the type you want to convert to, then its returned as is. Then is closing it is harmful. I just tested converting the body to an InputStream before sending it to my Processor as below: from uri=file:messages/radarIn?delete=trueamp;exclude=.*.tmpamp;readLock=none / convertBodyTo type=java.io.InputStream / !-- Add dynamic routing properties -- process ref=radarPropertyAdder / to uri=jms:topic:HPWC.IN?testConnectionOnStartup=true / The producer endpoint then kept throwing NullPointerExceptions. So what's the general solution here? Does one have to figure out what type the body will be then bake that assumption into the code? A more reasonable alternative would be to have getBody() always return an object that the user owns, but that would require cloning objects like InputStream that don't support clone(). I suppose a workaround for now could be: if (productStream != exchange.getIn().getBody()) { productStream.close(); } That should avoid the harmful close, right? Thanks again, David
Camel-http and multiple Set-Cookie headers
Hi, I'm using Camel to integrate service A to service B using camel-http. Service B is just an external web server that needs to set some cookies once in a while. However, if multiple Set-Cookie headers are present in B's responses, I'm only able to read one of them on A. The reason for this is that org.apache.camel.Message seems to only have methods for handling headers that can exist only once. So, have I completely misunderstood something here or is this just some kind of a limitation of camel-http module? Best, Lauri -- View this message in context: http://camel.465427.n5.nabble.com/Camel-http-and-multiple-Set-Cookie-headers-tp3332393p3332393.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Integrating camel with activiti
Nice work Maciek! I thought about writing such a component myself. Activiti and Camel seem to make a good match in many scenarios. -- View this message in context: http://camel.465427.n5.nabble.com/Integrating-camel-with-activiti-tp3331707p3332485.html Sent from the Camel - Users mailing list archive at Nabble.com.