Re: Agraggator to merge files
The code can be something like this. Where we + the bodies together and use a \n between them. But the code can be anything you like. Just set the result on the IN body on the oldExchange and return it. public Exchange aggregate(Exchange oldExchange, Exchange newExchange) { if (newExchange == null) { return oldExchange; } String oldTxt = oldExchange.getIn().getBody(String.class); String newTxt = newExchange.getIn().getBody(String.class); String body = oldTxt + \n + newTxt; // replace and return oldExchange oldExchange.getIn().setBody(body); return oldExchange; } - 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/ -- View this message in context: http://camel.465427.n5.nabble.com/Agraggator-to-merge-files-tp4358984p4364111.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: One exchange at a time
Hi! On Mon, May 2, 2011 at 7:44 AM, Claus Ibsen claus.ib...@gmail.com wrote: Hi What is this piece of software? Is that some external software that scan for files and process those (eg its not Camel). It could be pretty much anything that's scanning the destination directory and processing the files, deleting them afterwards. I dont suppose - exec is the camel-exec component? But that piece of software? I meant the external process is run using camel-exec. To (try) to be more clear using java dsl: from(ftp://ftp.somewhere.com/somepath ).to(file:///home/someone/somedir/).to(exec:/home/someone/script.sh); And what does it do after it has processed the file, is the file moved/deleted? Yes, it's moved or deleted br /linus On Sun, May 1, 2011 at 9:40 PM, Linus Brimstedt li...@brimstedt.se wrote: Hello I have a simple route like: ftp:// (poll) - file:// - exec: I.e, files are picked up from ftp, moved to a directory on a server and then some piece of software is run to process those files. My problem is that during the execution of the executable, if new files appear on ftp (within poll time), they will start to move to the directory. I wish that a new ftp transfer is not started until the executable has completely finished. How can i accomplish this? (if this concept is described in camel in action, feel free to refer to it. I have it but didnt plough through it all yet) thanks in advance! /Linus -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: One exchange at a time
Hi Linus, I think page 420 (and the ones after this) in Camel in action will face such a issue. You can stop a route on completion and start it again, if your script has been finished. Best regards - Claus On 02.05.2011 09:36, Linus Brimstedt wrote: Hi! On Mon, May 2, 2011 at 7:44 AM, Claus Ibsenclaus.ib...@gmail.com wrote: Hi What is this piece of software? Is that some external software that scan for files and process those (eg its not Camel). It could be pretty much anything that's scanning the destination directory and processing the files, deleting them afterwards. I dont suppose - exec is the camel-exec component? But that piece of software? I meant the external process is run using camel-exec. To (try) to be more clear using java dsl: from(ftp://ftp.somewhere.com/somepath ).to(file:///home/someone/somedir/).to(exec:/home/someone/script.sh); And what does it do after it has processed the file, is the file moved/deleted? Yes, it's moved or deleted br /linus On Sun, May 1, 2011 at 9:40 PM, Linus Brimstedtli...@brimstedt.se wrote: Hello I have a simple route like: ftp:// (poll) - file:// - exec: I.e, files are picked up from ftp, moved to a directory on a server and then some piece of software is run to process those files. My problem is that during the execution of the executable, if new files appear on ftp (within poll time), they will start to move to the directory. I wish that a new ftp transfer is not started until the executable has completely finished. How can i accomplish this? (if this concept is described in camel in action, feel free to refer to it. I have it but didnt plough through it all yet) thanks in advance! /Linus -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: tcp monitor?
Hi there, if your using windows, Microsoft Network Monitor is quit good, since it groupes all traffic by process and protocol. http://www.microsoft.com/downloads/en/details.aspx?FamilyID=983b941d-06cb-4658-b7f6-3088333d062f Regards. 2011/4/29 Donald Whytock dwhyt...@gmail.com Checked out Wireshark...looks sophisticated, but can't monitor localhost. Java.net tcpmon works with localhost. It doesn't interlace the dialog packets, but it does the job. Thanks all... Don On Fri, Apr 29, 2011 at 4:04 PM, Łukasz Budnik lukasz.bud...@gmail.com wrote: Hi Donald, And what about java.net tcpmon? http://java.net/projects/tcpmon/sources/svn/show/trunk/www?rev=69 Works like a charm for me. cheers, Łukasz On 29 April 2011 20:54, Donald Whytock dwhyt...@gmail.com wrote: Hi all... Can someone recommend a decent package for tcp activity monitoring? I'm looking to observe the dialog between Camel Mail/Javamail and a POP3 server. Apache TCPMon seems to be too SOAP/Axis oriented. On a side note, should there perhaps be a Resources page for this, localhost-able apps for testing, that sort of thing? Don -- - javier arias. MYKOOTS TECH Avinguda de la Torre Blanca 57 E-08173 Sant Cugat (Barcelona) Spain T. +34 935 543 046 M. +34 625 332 942 www.mykoots.com Google map locationhttp://maps.google.com/maps?f=qsource=s_qhl=cageocode=q=mykootssll=41.467219,2.091688sspn=0.102005,0.264187ie=UTF8hq=mykootshnear=t=hz=13iwloc=Acid=846231075592545344 Este mensaje y cualquier anexo van dirigidos exclusivamente a su destinatario y puede contener información CONFIDENCIAL sometida al secreto profesional. Si no es el destinatario final de este mensaje, le rogamos que se abstenga de leerlo, retenerlo o distribuirlo, así como de hacer uso alguno de los datos de carácter personal que pudieran constar. Rogamos nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción. Queda notificado que su uso, distribución, impresión, copia y difusión por cualquier medio esta tipificada como delito en el articulo 197 s.s. y 278 del vigente Código Penal. Le informamos que los datos personales que puedan constar en esta comunicación están incorporados en un fichero propiedad de MYKOOTS TECH, S.L. con la finalidad de gestionar la relación que nos vincula. Si desea ejercitar los derechos de acceso, rectificación, cancelación y oposición puede dirigirse por escrito a MYKOOTS TECH, S.L. Avenida de Torre Blanca 57, 08173 Sant Cugat, Barcelona This message and any attachment are intended exclusively for its addressee and may contain information that is CONFIDENTIAL and protected by a professional privilege. If you are not the intended recipient, please notify us immediately via e-mail and delete it. You are notified that any usage, distribution, printing, copy or disclosure of this e-mail is strictly prohibited by law. The personal data transcribed, contained and embedded in this communication is incorporated in a file owned by MYKOOTS TECH, S.L with the purpose to manage the relationship that binds us. In order to exercise the rigths of access, rectification, cancellation and opposition, please address to MYKOOTS TECH, S.L. Avenida de Torre Blanca 57, 08173 Sant Cugat, Barcelona
camel-ftp and file size check
Hello, regarding camel-ftp component (I am using ftps), is there any way to get file size before consuming the file? The problem is, that I have to load the whole file into memory and process it. Loading big files into memory would cause out of memory exception, so I want to limit file size up to N megabytes. If file is bigger, just log the error message. -- View this message in context: http://camel.465427.n5.nabble.com/camel-ftp-and-file-size-check-tp4364251p4364251.html Sent from the Camel - Users mailing list archive at Nabble.com.
custom interceptor - wrapProcessorInInterceptors - potential bug.
Hi all, I am implementing a traceability solution on camel. We need a fine grained solution providing a lot of detail, so I am implementing my own custom interceptor. What I want to do is trace each step in the routes and keep the 'parent-child' relation between different exchanges (eg. different exchanges inside the same route when in a split, etc). Also I want to print the customId assigned to each step, so the steps are printed in user-friendly way. I discovered what I think is a bug. I am not sure 100% it is a bug but this is the behaviour I had expected... I am using camel 2.2.0 inside servicemix 3.3.2, but I think that this behaviour is also found in latest camel version. In routes with a split step, when my wrapProcessorInInterceptors method is called, the ProcessorDefinition? paremeter is referencing the Split definition instead of steps inside it. For example, for the route: from(direct:a).routeId(route:a) .split(xpath(//a/b)).id(task:split.products) .log(*** splited ::: body : ${body} ).id(task:handle.that) (*) .setHeader(insplit,constant(in-split)) (*) .end() .log(* aftersplit ::: body : ${body}).id(task:after.split); for steps inside the split (*) the ProcessorDefinition is referencing the splitdefinition, while i think it should point to the log and setHeader steps. It can be easily fixed, in class::: org.apache.camel.processor.DefaultChannel in the method initChannel, changing target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), outputDefinition, target, next); by this: target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), traceDef, target, next); Is this behaviour ok? is it well fixed? This is my first 'contribution' so any advice and help will be more than well received. Thank you and best regards. Javier Arias.
Re: camel-ftp and file size check
Hi, I think you can use org.apache.camel.component.file.GenericFileFilter for this (I've not tested, if this works with FTP, but it should). See also the docu of the file component: http://camel.apache.org/file2.html Best regrads - Claus On 02.05.2011 11:20, tnk wrote: Hello, regarding camel-ftp component (I am using ftps), is there any way to get file size before consuming the file? The problem is, that I have to load the whole file into memory and process it. Loading big files into memory would cause out of memory exception, so I want to limit file size up to N megabytes. If file is bigger, just log the error message. -- View this message in context: http://camel.465427.n5.nabble.com/camel-ftp-and-file-size-check-tp4364251p4364251.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: One exchange at a time
thanks, Ill have a look there :-) br /Linus On Mon, May 2, 2011 at 10:10 AM, Claus Straube claus.stra...@catify.comwrote: Hi Linus, I think page 420 (and the ones after this) in Camel in action will face such a issue. You can stop a route on completion and start it again, if your script has been finished. Best regards - Claus On 02.05.2011 09:36, Linus Brimstedt wrote: Hi! On Mon, May 2, 2011 at 7:44 AM, Claus Ibsenclaus.ib...@gmail.com wrote: Hi What is this piece of software? Is that some external software that scan for files and process those (eg its not Camel). It could be pretty much anything that's scanning the destination directory and processing the files, deleting them afterwards. I dont suppose - exec is the camel-exec component? But that piece of software? I meant the external process is run using camel-exec. To (try) to be more clear using java dsl: from(ftp://ftp.somewhere.com/somepath ).to(file:///home/someone/somedir/).to(exec:/home/someone/script.sh); And what does it do after it has processed the file, is the file moved/deleted? Yes, it's moved or deleted br /linus On Sun, May 1, 2011 at 9:40 PM, Linus Brimstedtli...@brimstedt.se wrote: Hello I have a simple route like: ftp:// (poll) - file:// - exec: I.e, files are picked up from ftp, moved to a directory on a server and then some piece of software is run to process those files. My problem is that during the execution of the executable, if new files appear on ftp (within poll time), they will start to move to the directory. I wish that a new ftp transfer is not started until the executable has completely finished. How can i accomplish this? (if this concept is described in camel in action, feel free to refer to it. I have it but didnt plough through it all yet) thanks in advance! /Linus -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: custom interceptor - wrapProcessorInInterceptors - potential bug.
done, FYI : issue 3928 https://issues.apache.org/jira/browse/CAMEL-3928 one question... is this released in older versions like 2.2.0? or have I to use my own patch? thank you. javier arias. 2011/5/2 Claus Ibsen claus.ib...@gmail.com Hi Well spotted. Cane you create a JIRA ticket? On Mon, May 2, 2011 at 11:23 AM, Javier Arias Losada javier.ari...@gmail.com wrote: Hi all, I am implementing a traceability solution on camel. We need a fine grained solution providing a lot of detail, so I am implementing my own custom interceptor. What I want to do is trace each step in the routes and keep the 'parent-child' relation between different exchanges (eg. different exchanges inside the same route when in a split, etc). Also I want to print the customId assigned to each step, so the steps are printed in user-friendly way. I discovered what I think is a bug. I am not sure 100% it is a bug but this is the behaviour I had expected... I am using camel 2.2.0 inside servicemix 3.3.2, but I think that this behaviour is also found in latest camel version. In routes with a split step, when my wrapProcessorInInterceptors method is called, the ProcessorDefinition? paremeter is referencing the Split definition instead of steps inside it. For example, for the route: from(direct:a).routeId(route:a) .split(xpath(//a/b)).id(task:split.products) .log(*** splited ::: body : ${body} ).id(task:handle.that) (*) .setHeader(insplit,constant(in-split)) (*) .end() .log(* aftersplit ::: body : ${body}).id(task:after.split); for steps inside the split (*) the ProcessorDefinition is referencing the splitdefinition, while i think it should point to the log and setHeader steps. It can be easily fixed, in class::: org.apache.camel.processor.DefaultChannel in the method initChannel, changing target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), outputDefinition, target, next); by this: target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), traceDef, target, next); Is this behaviour ok? is it well fixed? This is my first 'contribution' so any advice and help will be more than well received. Thank you and best regards. Javier Arias. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: custom interceptor - wrapProcessorInInterceptors - potential bug.
On Mon, May 2, 2011 at 2:59 PM, Javier Arias Losada javier.ari...@gmail.com wrote: done, FYI : issue 3928 https://issues.apache.org/jira/browse/CAMEL-3928 one question... is this released in older versions like 2.2.0? or have I to use my own patch? Yep you need to patch your own 2.2.0 versions as we dont do patch releases at Apache for such old releases. thank you. javier arias. 2011/5/2 Claus Ibsen claus.ib...@gmail.com Hi Well spotted. Cane you create a JIRA ticket? On Mon, May 2, 2011 at 11:23 AM, Javier Arias Losada javier.ari...@gmail.com wrote: Hi all, I am implementing a traceability solution on camel. We need a fine grained solution providing a lot of detail, so I am implementing my own custom interceptor. What I want to do is trace each step in the routes and keep the 'parent-child' relation between different exchanges (eg. different exchanges inside the same route when in a split, etc). Also I want to print the customId assigned to each step, so the steps are printed in user-friendly way. I discovered what I think is a bug. I am not sure 100% it is a bug but this is the behaviour I had expected... I am using camel 2.2.0 inside servicemix 3.3.2, but I think that this behaviour is also found in latest camel version. In routes with a split step, when my wrapProcessorInInterceptors method is called, the ProcessorDefinition? paremeter is referencing the Split definition instead of steps inside it. For example, for the route: from(direct:a).routeId(route:a) .split(xpath(//a/b)).id(task:split.products) .log(*** splited ::: body : ${body} ).id(task:handle.that) (*) .setHeader(insplit,constant(in-split)) (*) .end() .log(* aftersplit ::: body : ${body}).id(task:after.split); for steps inside the split (*) the ProcessorDefinition is referencing the splitdefinition, while i think it should point to the log and setHeader steps. It can be easily fixed, in class::: org.apache.camel.processor.DefaultChannel in the method initChannel, changing target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), outputDefinition, target, next); by this: target = strategy.wrapProcessorInInterceptors(routeContext.getCamelContext(), traceDef, target, next); Is this behaviour ok? is it well fixed? This is my first 'contribution' so any advice and help will be more than well received. Thank you and best regards. Javier Arias. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ 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 CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: camel-ftp and file size check
it works with ftp as well, thanks! -- View this message in context: http://camel.465427.n5.nabble.com/camel-ftp-and-file-size-check-tp4364251p4364877.html Sent from the Camel - Users mailing list archive at Nabble.com.
Aggregator Pattern - GroupExchanges
Hello All, Does the GroupExchanges attribute look at the correlation expression and completion size? Or does it only look at the batch options. I have a route like this: camel:route from uri=direct:aggregateQuery/ aggregate groupExchanges=true correlationExpression simpleheader.requestGUID/simple /correlationExpression completionSize headernumberOfEndpointsRequested/header /completionSize to uri=bean:responseAggregator?method=aggregateGroupMessages/ /aggregate /camel:route However, the correlation expression and completion size seem to be ignored. I replace groupExchanges with a reference to a strategy and everything works fine. Am I misreading what the pattern can do? In the example above the bean method 'aggregateGroupmessages' is never called. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Aggregator-Pattern-GroupExchanges-tp4364886p4364886.html Sent from the Camel - Users mailing list archive at Nabble.com.
auto-loading Groovy
Is there a mechanism to auto-load, or auto-update a groovy script for a Camel route at runtime? I assume this is possible via a custom Processor, but did not want to go ahead and build this if such functionality already exists. Thanks, Mark
Re: Aggregator Pattern - GroupExchanges
Hi You need to enable eagerCheckCompletion=true on aggregate We should probably add a validation for this so people dont mis-configure when using groupedExchanges=true. On Mon, May 2, 2011 at 4:51 PM, ychawla premiergenerat...@yahoo.com wrote: Hello All, Does the GroupExchanges attribute look at the correlation expression and completion size? Or does it only look at the batch options. I have a route like this: camel:route from uri=direct:aggregateQuery/ aggregate groupExchanges=true correlationExpression simpleheader.requestGUID/simple /correlationExpression completionSize headernumberOfEndpointsRequested/header /completionSize to uri=bean:responseAggregator?method=aggregateGroupMessages/ /aggregate /camel:route However, the correlation expression and completion size seem to be ignored. I replace groupExchanges with a reference to a strategy and everything works fine. Am I misreading what the pattern can do? In the example above the bean method 'aggregateGroupmessages' is never called. Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Aggregator-Pattern-GroupExchanges-tp4364886p4364886.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Blueprint and XSLT
I am building a camel route using camel-blueprint inside karaf. My route contains an xslt transfromation, but it seems that the Xslt component can't find my xslt document, which is inside the bundle that contains the routes. The problem is that I get a FileNotFoundException java.io.FileNotFoundException: class path resource [net/iocanel/xslt/mint-mo-xslt.xsl] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158) at org.apache.camel.component.xslt.XsltComponent.loadResource(XsltComponent.java:156) Note: That my bundle does not import the package which contains the xslt. -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer *
Re: Blueprint and XSLT
Hi Ioannis, did you try using Bundle-Classpath statement in MANIFEST. Something like Bundle-Classpath: ., META-INF/my/xslt Regards JB On 05/02/2011 07:28 PM, Ioannis Canellos wrote: I am building a camel route using camel-blueprint inside karaf. My route contains an xslt transfromation, but it seems that the Xslt component can't find my xslt document, which is inside the bundle that contains the routes. The problem is that I get a FileNotFoundException java.io.FileNotFoundException: class path resource [net/iocanel/xslt/mint-mo-xslt.xsl] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158) at org.apache.camel.component.xslt.XsltComponent.loadResource(XsltComponent.java:156) Note: That my bundle does not import the package which contains the xslt.
Re: Blueprint and XSLT
Halo Jean Baptiste, No, I didn't try such statements! I think that it wouldn't help because the class loader which tries to load the resource is the boot class loader and not the bundle classloader. On Mon, May 2, 2011 at 8:43 PM, Jean-Baptiste Onofré j...@nanthrax.netwrote: Hi Ioannis, did you try using Bundle-Classpath statement in MANIFEST. Something like Bundle-Classpath: ., META-INF/my/xslt Regards JB On 05/02/2011 07:28 PM, Ioannis Canellos wrote: I am building a camel route using camel-blueprint inside karaf. My route contains an xslt transfromation, but it seems that the Xslt component can't find my xslt document, which is inside the bundle that contains the routes. The problem is that I get a FileNotFoundException java.io.FileNotFoundException: class path resource [net/iocanel/xslt/mint-mo-xslt.xsl] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158) at org.apache.camel.component.xslt.XsltComponent.loadResource(XsltComponent.java:156) Note: That my bundle does not import the package which contains the xslt. -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer *
Re: WS-Notification
Hi Mark, No, it doesn't. However, there is a JBI component in Servicemix that supports WS-Notification. Cheers, Ashwin... - - Ashwin Karpe Apache Camel Committer Sr Principal Consultant FUSESource (a Progress Software Corporation subsidiary) http://fusesource.com Blog: http://opensourceknowledge.blogspot.com CamelOne 2011: http://fusesource.com/camel2011 - -- View this message in context: http://camel.465427.n5.nabble.com/WS-Notification-tp4358744p4365363.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: One exchange at a time
Linus, you might also take a look at the camel-ftp unit tests...in particular http://svn.apache.org/viewvc/camel/trunk/components/camel-ftp/src/test/java/org/apache/camel/component/file/remote/FtpConsumerMaxMessagesPerPollTest.java?view=markup FtpConsumerMaxMessagesPerPollTest , which uses the maxMessagesPerPoll attribute to limit the polling. - Ben O'Day IT Consultant -http://benoday.blogspot.com -- View this message in context: http://camel.465427.n5.nabble.com/One-exchange-at-a-time-tp4363389p4365681.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Blueprint and XSLT
I had the same problem. Gave up on osgi (once more) Wrote about here. http://fusesource.com/forums/thread.jspa?messageID=10210#10210 My xslt was part of my bundle and placed in resources/com/company/packagename. Sent from my iPhone On 02/05/2011, at 19.53, Ioannis Canellos ioca...@gmail.com wrote: Halo Jean Baptiste, No, I didn't try such statements! I think that it wouldn't help because the class loader which tries to load the resource is the boot class loader and not the bundle classloader. On Mon, May 2, 2011 at 8:43 PM, Jean-Baptiste Onofré j...@nanthrax.netwrote: Hi Ioannis, did you try using Bundle-Classpath statement in MANIFEST. Something like Bundle-Classpath: ., META-INF/my/xslt Regards JB On 05/02/2011 07:28 PM, Ioannis Canellos wrote: I am building a camel route using camel-blueprint inside karaf. My route contains an xslt transfromation, but it seems that the Xslt component can't find my xslt document, which is inside the bundle that contains the routes. The problem is that I get a FileNotFoundException java.io.FileNotFoundException: class path resource [net/iocanel/xslt/mint-mo-xslt.xsl] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158) at org.apache.camel.component.xslt.XsltComponent.loadResource(XsltComponent.java:156) Note: That my bundle does not import the package which contains the xslt. -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer *
Re: Multiple remote connection to the same host but different users
After further analysis, it appears to me as a bug in apache camel. The bug remains in ProducerCache.doGetProducer() where a producer is instantiated or retrieved from the cache. At the time of instantiating producer Basically ProducerCache caches the Producers. However when it retrieves the producer from the cache it ignores the fact that the producer may have stale credential. In other words following endpoints will potentially use the same producer: https://host/ssl-gateway?authMethod=BasicauthUsername=user1authPassword=pwd1 https://host/ssl-gateway?authMethod=BasicauthUsername=user2authPassword=pwd2 I have patched the ProducerCache to fix this problem locally. Here is the fix I have put. This gets executed when the producer is retrieved from the cache. protected synchronized Producer doGetProducer(Endpoint endpoint, boolean pooled) { String key = endpoint.getEndpointUri(); Producer answer = producers.get(key); if (pooled answer == null) { // try acquire from connection pool answer = pool.acquire(endpoint); } if (answer == null) { // create a new producer try { answer = endpoint.createProducer(); // must then start service so producer is ready to be used ServiceHelper.startService(answer); } catch (Exception e) { throw new FailedToCreateProducerException(endpoint, e); } // add producer to cache or pool if applicable if (pooled answer instanceof ServicePoolAware) { if (LOG.isDebugEnabled()) { LOG.debug(Adding to producer service pool with key: + endpoint + for producer: + answer); } answer = pool.addAndAcquire(endpoint, answer); } else if (answer.isSingleton()) { if (LOG.isDebugEnabled()) { LOG.debug(Adding to producer cache with key: + endpoint + for producer: + answer); } producers.put(key, answer); } } else { // PATCH BEGIN if (endpoint instanceof HttpEndpoint answer instanceof HttpProducer){ if (((HttpEndpoint)endpoint).getHttpClientConfigurer() != null){ ((HttpEndpoint)endpoint).getHttpClientConfigurer().configureHttpClient(((HttpProducer)answer).getHttpClient()); LOG.debug(Patched ProducerCache : + Refreshing the authentication credential for the cached HTTP producer); } } } // PATCH END return answer; } I am not happy about the patch due to the coupling of HttpEndpoint and HttpProducer classes with the ProducerCache. But I could not get it to work otherwise. I tried putting the fix in HttpEndpoint but it did not work consistently. Claus/Ashwin, should this be treated as a bug? Can this be addressed in the future version of the camel. I am using version 2.4.0. However, I checked the code from the latest version and it seems that the problem exists. I am sure that there is a better place other than ProducerCache where the fix can be addressed. Thanks -- View this message in context: http://camel.465427.n5.nabble.com/Multiple-remote-connection-to-the-same-host-but-different-users-tp4309456p4366212.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Blueprint and XSLT
Hi The xslt component is part of camel-spring and uses the spring resource abstraction. Hence why it works when using spring-dm. With blueprint its another story. So there may be something failing to have it load a resource on the classpath. Obviously it would be great if the community stepped up and helped with https://issues.apache.org/jira/browse/CAMEL-3272 To provide more blueprint unit tests. Essentially we need to 2x tests with osgi - spring-dm - blueprint So its in fact a massive task to do. And we do have a fair amount of tests already. I suggest to create a JIRA for the xslt issue so we can try to address that for Camel 2.8. On Mon, May 2, 2011 at 7:53 PM, Ioannis Canellos ioca...@gmail.com wrote: Halo Jean Baptiste, No, I didn't try such statements! I think that it wouldn't help because the class loader which tries to load the resource is the boot class loader and not the bundle classloader. On Mon, May 2, 2011 at 8:43 PM, Jean-Baptiste Onofré j...@nanthrax.netwrote: Hi Ioannis, did you try using Bundle-Classpath statement in MANIFEST. Something like Bundle-Classpath: ., META-INF/my/xslt Regards JB On 05/02/2011 07:28 PM, Ioannis Canellos wrote: I am building a camel route using camel-blueprint inside karaf. My route contains an xslt transfromation, but it seems that the Xslt component can't find my xslt document, which is inside the bundle that contains the routes. The problem is that I get a FileNotFoundException java.io.FileNotFoundException: class path resource [net/iocanel/xslt/mint-mo-xslt.xsl] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158) at org.apache.camel.component.xslt.XsltComponent.loadResource(XsltComponent.java:156) Note: That my bundle does not import the package which contains the xslt. -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer * -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/
Re: Blueprint and XSLT
Thanks for the response. I create a JIRA https://issues.apache.org/jira/browse/CAMEL-3934. Claus, can you please point me to the right place, in order to read more about the spring resource abstraction? On Tue, May 3, 2011 at 8:23 AM, Claus Ibsen claus.ib...@gmail.com wrote: Hi The xslt component is part of camel-spring and uses the spring resource abstraction. Hence why it works when using spring-dm. With blueprint its another story. So there may be something failing to have it load a resource on the classpath. Obviously it would be great if the community stepped up and helped with https://issues.apache.org/jira/browse/CAMEL-3272 To provide more blueprint unit tests. Essentially we need to 2x tests with osgi - spring-dm - blueprint So its in fact a massive task to do. And we do have a fair amount of tests already. I suggest to create a JIRA for the xslt issue so we can try to address that for Camel 2.8. On Mon, May 2, 2011 at 7:53 PM, Ioannis Canellos ioca...@gmail.com wrote: Halo Jean Baptiste, No, I didn't try such statements! I think that it wouldn't help because the class loader which tries to load the resource is the boot class loader and not the bundle classloader. On Mon, May 2, 2011 at 8:43 PM, Jean-Baptiste Onofré j...@nanthrax.net wrote: Hi Ioannis, did you try using Bundle-Classpath statement in MANIFEST. Something like Bundle-Classpath: ., META-INF/my/xslt Regards JB On 05/02/2011 07:28 PM, Ioannis Canellos wrote: I am building a camel route using camel-blueprint inside karaf. My route contains an xslt transfromation, but it seems that the Xslt component can't find my xslt document, which is inside the bundle that contains the routes. The problem is that I get a FileNotFoundException java.io.FileNotFoundException: class path resource [net/iocanel/xslt/mint-mo-xslt.xsl] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158) at org.apache.camel.component.xslt.XsltComponent.loadResource(XsltComponent.java:156) Note: That my bundle does not import the package which contains the xslt. -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer * -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer *
Re: Blueprint and XSLT
On Tue, May 3, 2011 at 7:44 AM, Ioannis Canellos ioca...@gmail.com wrote: Thanks for the response. I create a JIRA https://issues.apache.org/jira/browse/CAMEL-3934. Claus, can you please point me to the right place, in order to read more about the spring resource abstraction? Its this resource import org.springframework.core.io.Resource; Yeah sure see https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/ResourceBasedEndpoint.java And https://svn.apache.org/repos/asf/camel/trunk/components/camel-spring/src/main/java/org/apache/camel/component/xslt/XsltComponent.java On Tue, May 3, 2011 at 8:23 AM, Claus Ibsen claus.ib...@gmail.com wrote: Hi The xslt component is part of camel-spring and uses the spring resource abstraction. Hence why it works when using spring-dm. With blueprint its another story. So there may be something failing to have it load a resource on the classpath. Obviously it would be great if the community stepped up and helped with https://issues.apache.org/jira/browse/CAMEL-3272 To provide more blueprint unit tests. Essentially we need to 2x tests with osgi - spring-dm - blueprint So its in fact a massive task to do. And we do have a fair amount of tests already. I suggest to create a JIRA for the xslt issue so we can try to address that for Camel 2.8. On Mon, May 2, 2011 at 7:53 PM, Ioannis Canellos ioca...@gmail.com wrote: Halo Jean Baptiste, No, I didn't try such statements! I think that it wouldn't help because the class loader which tries to load the resource is the boot class loader and not the bundle classloader. On Mon, May 2, 2011 at 8:43 PM, Jean-Baptiste Onofré j...@nanthrax.net wrote: Hi Ioannis, did you try using Bundle-Classpath statement in MANIFEST. Something like Bundle-Classpath: ., META-INF/my/xslt Regards JB On 05/02/2011 07:28 PM, Ioannis Canellos wrote: I am building a camel route using camel-blueprint inside karaf. My route contains an xslt transfromation, but it seems that the Xslt component can't find my xslt document, which is inside the bundle that contains the routes. The problem is that I get a FileNotFoundException java.io.FileNotFoundException: class path resource [net/iocanel/xslt/mint-mo-xslt.xsl] cannot be opened because it does not exist at org.springframework.core.io.ClassPathResource.getInputStream(ClassPathResource.java:158) at org.apache.camel.component.xslt.XsltComponent.loadResource(XsltComponent.java:156) Note: That my bundle does not import the package which contains the xslt. -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer * -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/ -- *Ioannis Canellos* * http://iocanel.blogspot.com Apache Karaf http://karaf.apache.org/ Committer PMC Apache ServiceMix http://servicemix.apache.org/ Committer * -- Claus Ibsen - FuseSource Email: cib...@fusesource.com Web: http://fusesource.com CamelOne 2011: http://fusesource.com/camelone2011/ Twitter: davsclaus Blog: http://davsclaus.blogspot.com/ Author of Camel in Action: http://www.manning.com/ibsen/