Re: Retrieving MailMessage bodies as DataHandler objects
willem.jiang wrote: Camel Message has getAttachements() method which can help you get the DataHandlers. Thanks Willem - I know about the attachments. My case is where I'm dealing with a single part message and its not text content i.e. its text/calendar. -- View this message in context: http://old.nabble.com/Retrieving-MailMessage-bodies-as-DataHandler-objects-tp27142905p27158300.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Retrieving MailMessage bodies as DataHandler objects
Claus Ibsen-2 wrote: You can get access to the underlying javax.mail.Message... Thanks Claus. I'm now trying out the following and just waiting for another message to come through: // See if our exchange body contains the calendar object. javax.mail.Message mailMessage = exchange.getIn(MailMessage.class) .getMessage(); if (logger.isDebugEnabled()) { logger.debug(Message received: + mailMessage); } try { DataHandler bodyDataHandler = mailMessage.getDataHandler(); if (bodyDataHandler != null) { addCalendarDataToCalendars(calendars, bodyDataHandler); } } catch (MessagingException e) { logger.error(e); } -- View this message in context: http://old.nabble.com/Retrieving-MailMessage-bodies-as-DataHandler-objects-tp27142905p27158347.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Disabling Tracer for a specific route
On Thu, Jan 14, 2010 at 10:13 AM, wmoussel wmous...@gmail.com wrote: Hi, I'm trying to find a way to disable tracing for a specific route (i.e. not for the whole context). For instance I have a file poller that fires every 2 seconds and I'd like not to see the trace log. If there's no way I think i'll file a Jira. I was thinking maybe something like: from(file:/myfolder).setTracing(false).to(bean:myBean); or from(file:/myfolder).setProperty(Exchange.TRACE_ENABLED, constant(false)).to(bean:myBean); You can already do this in 2.1 from(direct:a).to(mock:a); from(direct:b).noTracing().to(mock:b); from(direct:c).tracing().to(mock:c); Thanks in advance -- View this message in context: http://old.nabble.com/Disabling-Tracer-for-a-specific-route-tp27158341p27158341.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: pojo example fails to build with ant
Claus Ibsen wrote: On Wed, Jan 13, 2010 at 7:17 PM, NP-Hard rmunag...@ironhawk.com wrote: Thanks for the response. That got me past the first issue and now I get: Cannot find class: org.apache.xalan.xsltc.trax.DOM2SAX I don't see an obvious jar that has xalan in the camel distribution; do I need to download it separately and add it to the classpath in common_build.xml ? Do you see a WARN or some failure for that class. AFAIR its an optional .jar. Hi, I just checked the code , the WARN message comes from XmlConverter, and it will try to find other way to do the transformation. So I think we can remove this WARN message. Willem
Re: recipientList retryUntil not working?
I've tried both things you suggested but it is still not working, the retry happens in default manner. I've opened a ticket in JIRA: https://issues.apache.org/activemq/browse/CAMEL-2360 Claus Ibsen-2 wrote: Hi Can you try moving the onException on up? And if still a problem then try using onException as context scoped, eg outside the from Just to see if that resolves anything. I am a tad busy with a couple of other issues, but let me know how goes. And if still a problem then create a JIRA so we can get it resolved for 2.2. -- View this message in context: http://old.nabble.com/recipientList-retryUntil-not-working--tp27145846p27159028.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: FTP assume directory do not have dot
Claus Ibsen-2 wrote: On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf smcd...@hotmail.com wrote: I have the following error: Caused by: java.lang.IllegalArgumentException: Only directory is supported. Endpoint must be configured with a valid directory: ftp.test at org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68) at org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31) at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60) at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83) at org.apache.camel.impl.RouteService.doStart(RouteService.java:123) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906) ... 1 more By looking at the source code I saw the following : // we assume its a file if the name has a dot in it (eg foo.txt) if (configuration.getDirectory().contains(.)) { throw new IllegalArgumentException(Only directory is supported. Endpoint must be configured with a valid directory: + configuration.getDirectory()); } I remove that code and my code is working!! :-) I think the above code should not assume that. What do you think ? Its really a bad habit having a dot in a directory name. On windows will that not often be considered a file?. And since its a remote path we cannot on startup determine if its a path or file. The check was made in the transition from 1.x to 2.x where in 1.x you could define a starting file or directory. In 2.x you must specify a directory only. We could relax the check but then people may still enter a filename and think Camel will pickup that file. [SIMON] Windows directory can contains a dot... a good example is in your eclipse installation... example: Directory name=org.eclipse.emf.teneo.jpox_1.0.1.v200902271808 Also I think that check is useless because you can still enter something without a dot and it is in fact a file... so the endpoint should verify that after the connection. Simon (using : camel 2.1.0) Simon -- View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27159998.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: FTP assume directory do not have dot
Yeah good call Do you mind creating a ticket in JIRA about this? http://issues.apache.org/activemq/browse/CAMEL On Thu, Jan 14, 2010 at 12:42 PM, sjmcduf smcd...@hotmail.com wrote: Claus Ibsen-2 wrote: On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf smcd...@hotmail.com wrote: I have the following error: Caused by: java.lang.IllegalArgumentException: Only directory is supported. Endpoint must be configured with a valid directory: ftp.test at org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68) at org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31) at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60) at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83) at org.apache.camel.impl.RouteService.doStart(RouteService.java:123) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906) ... 1 more By looking at the source code I saw the following : // we assume its a file if the name has a dot in it (eg foo.txt) if (configuration.getDirectory().contains(.)) { throw new IllegalArgumentException(Only directory is supported. Endpoint must be configured with a valid directory: + configuration.getDirectory()); } I remove that code and my code is working!! :-) I think the above code should not assume that. What do you think ? Its really a bad habit having a dot in a directory name. On windows will that not often be considered a file?. And since its a remote path we cannot on startup determine if its a path or file. The check was made in the transition from 1.x to 2.x where in 1.x you could define a starting file or directory. In 2.x you must specify a directory only. We could relax the check but then people may still enter a filename and think Camel will pickup that file. [SIMON] Windows directory can contains a dot... a good example is in your eclipse installation... example: Directory name=org.eclipse.emf.teneo.jpox_1.0.1.v200902271808 Also I think that check is useless because you can still enter something without a dot and it is in fact a file... so the endpoint should verify that after the connection. Simon (using : camel 2.1.0) Simon -- View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27159998.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: FTP assume directory do not have dot
http://issues.apache.org/activemq/browse/CAMEL-2362 Thank you again Simon Claus Ibsen-2 wrote: Yeah good call Do you mind creating a ticket in JIRA about this? http://issues.apache.org/activemq/browse/CAMEL On Thu, Jan 14, 2010 at 12:42 PM, sjmcduf smcd...@hotmail.com wrote: Claus Ibsen-2 wrote: On Thu, Jan 14, 2010 at 12:25 AM, sjmcduf smcd...@hotmail.com wrote: I have the following error: Caused by: java.lang.IllegalArgumentException: Only directory is supported. Endpoint must be configured with a valid directory: ftp.test at org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:68) at org.apache.camel.component.file.remote.RemoteFileEndpoint.createConsumer(RemoteFileEndpoint.java:31) at org.apache.camel.impl.EventDrivenConsumerRoute.addServices(EventDrivenConsumerRoute.java:60) at org.apache.camel.impl.DefaultRoute.onStartingServices(DefaultRoute.java:83) at org.apache.camel.impl.RouteService.doStart(RouteService.java:123) at org.apache.camel.impl.ServiceSupport.start(ServiceSupport.java:55) at org.apache.camel.impl.DefaultCamelContext.start(DefaultCamelContext.java:906) ... 1 more By looking at the source code I saw the following : // we assume its a file if the name has a dot in it (eg foo.txt) if (configuration.getDirectory().contains(.)) { throw new IllegalArgumentException(Only directory is supported. Endpoint must be configured with a valid directory: + configuration.getDirectory()); } I remove that code and my code is working!! :-) I think the above code should not assume that. What do you think ? Its really a bad habit having a dot in a directory name. On windows will that not often be considered a file?. And since its a remote path we cannot on startup determine if its a path or file. The check was made in the transition from 1.x to 2.x where in 1.x you could define a starting file or directory. In 2.x you must specify a directory only. We could relax the check but then people may still enter a filename and think Camel will pickup that file. [SIMON] Windows directory can contains a dot... a good example is in your eclipse installation... example: Directory name=org.eclipse.emf.teneo.jpox_1.0.1.v200902271808 Also I think that check is useless because you can still enter something without a dot and it is in fact a file... so the endpoint should verify that after the connection. Simon (using : camel 2.1.0) Simon -- View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27153817.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27159998.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/FTP-assume-directory-do-not-have-dot-tp27153817p27160157.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Store data be used in other steps in an exchange
I found out by myself. I simply put the uri in a header and simply pass the header to the recipient list. Johan Haleby wrote: Hi, I have a use-case where I must extract a endpoint uri from an object, marshal the object to an unknown format and then send the result to the extracted uri. Is there a built-in way to do this or do I have to manually persist the extract endpoint and retrieve a dynamic router or something? Here's some pseudo code describing what I'm looking for: from(somewhere).extractURIFromConsumedObject(). marshal(encodeToUnknownFormat).to(uriThatWasExtractedFromTheConsumedObject); Thanks, /Johan -- View this message in context: http://old.nabble.com/Store-data-be-used-in-other-steps-in-an-exchange-tp27159537p27160731.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: A bug of InOut pattern?
Your processor should check the MEP, and don't set the out message if the Exchange's MEP is InOnly. If there is a out message, the pipeline will try to copy the out message to next processor exchange's in message, otherwise it will copy the in message to next processor exchange's in message. Willem ext2 wrote: Hi: The camel 2.1's pipeline patter's MEP is InOnly default. But the result of following route is different, if I using inOnly() processor in route vs using default; I tried it using a simple sample: send a message to a direct endpoint, which body is number=1, a route receive the message and increase the message's body twice by a processor, then send to a mock endpoint; The increase number process's code is: Class IncreaseProcessor{ void process(MessageExchange me) { Integer result= Me.getIn().getBody() + 1; Me.getOut().setBody(result); } } 1): following rout using inOnly() processor , and mock endpoint's return ME's in.body=3, out=Null from(direct:inOnlyUsingProcessor).inOnly().process(outProcessor).process(o utProcessor).to(mock:result); 2) following route using default inOnly, and mock's return ME's in.body=3, out.body=2. from(direct:inOnlyDefault).process(outProcessor).process(outProcessor).to( mock:result); So why the result has a out message and it's body=2, it should be same as the first route(out=null);
Timer fails to resolve parameters
Camel fails to load the timer component in the following route camel:route errorHandlerRef=transactionErrorHandler camel:from uri=timer:dm?period=2000/ camel:to uri=bean:dmScheduler?method=getNewTransactions/ /camel:route Camel is configured as a war file which is being loaded into the JBoss Application Server. The following error is thrown while attempting to load the Camel Context 08:18:26,339 ERROR Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: timer://dm?period=2000 due to: Could not find a suitable setter for property: period as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: long with value 2000 -- View this message in context: http://old.nabble.com/Timer-fails-to-resolve-parameters-tp27161260p27161260.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Timer fails to resolve parameters
On Thu, Jan 14, 2010 at 2:28 PM, pmmerritt phillip.merr...@ngc.com wrote: Camel fails to load the timer component in the following route camel:route errorHandlerRef=transactionErrorHandler camel:from uri=timer:dm?period=2000/ camel:to uri=bean:dmScheduler?method=getNewTransactions/ /camel:route Camel is configured as a war file which is being loaded into the JBoss Application Server. The following error is thrown while attempting to load the Camel Context 08:18:26,339 ERROR Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener org.apache.camel.ResolveEndpointFailedException: Failed to resolve endpoint: timer://dm?period=2000 due to: Could not find a suitable setter for property: period as there isn't a setter method with same type: java.lang.String nor type conversion possible: No type converter available to convert from type: java.lang.String to the required type: long with value 2000 Hi JBoss has a classloading issue which causes Camel not being able to pickup type converters from the classpath. You need to use a special JBoss class loader with Camel to resolve that. There are some links here to some people who did that http://camel.apache.org/articles.html Basically what would be desirable is to create a camel-jboss component and ship that with Camel. However I do not know if there is any licensing implications. -- View this message in context: http://old.nabble.com/Timer-fails-to-resolve-parameters-tp27161260p27161260.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Camel 2.1.0 camel-example-spring-jms does not work
I've found a partial solution: the java runtime didn't see the internet: I'm behind a proxy and my setup (env var http_proxy is not used by jvm), so: mvn exec:java -PCamelServer \ -Dhttp.proxyHost=127.0.0.1 \ -Dhttp.proxyPort=5865 solve the problem. (maybe the examples README could be updated for this scenario?) It remains however a question: why the xsd schema located in activemq-core.jar is not loaded by the system? This in needed if you run in a intranet, like a typical enterprise application. The place to see how to do this could be (sorry but my camel evaluation have to be stopped for a while): http://xerces.apache.org/xerces2-j/faq-xcatalogs.html I hope this can be of help to someone ... Attilio willem.jiang wrote: Attilio Donà wrote: Claus, I've tried the 2.2-SNAPSHOT (svn co https://svn.apache.org/repos/asf/camel/trunk camel) and the problem persist: I've also problems with the mvn install (2 test fails) and finally also skipping the tests I got a lot of WARNING and an ERROR: [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.commons.logging.* [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.cxf.* [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.mina.* [ ... These warning messages are for the bundle has some not use import package. As we have a common default import packages list for each module. It should be OK. [WARNING] Entry: apache-camel-2.2-SNAPSHOT/examples/camel-example-etl/src/main/resources/META-INF/services/org/apache/camel/ longer than 100 characters. [WARNING] Entry: apache-camel-2.2-SNAPSHOT/examples/camel-example-spring/src/main/java/org/apache/camel/example/spring/ longer than 100 characters. ... It's the Maven assemble warning, will not cause any issue. [WARNING] POM for 'org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:pom:1.0:compile' is invalid. Its dependencies (if any) will NOT be available to the current build. [WARNING] Cannot include project artifact: org.apache.camel:apache-camel:pom:2.2-SNAPSHOT; it doesn't have an associated file or directory. [WARNING] The following patterns were never triggered in this artifact inclusion filter: o 'org.springframework:spring-test' [INFO] Building zip: /home/adona/emf/camel/apache-camel/target/apache-camel-2.2-SNAPSHOT.zip [INFO] [assembly:single {execution: unix-src}] [INFO] Reading assembly descriptor: src/main/descriptors/unix-src.xml [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Failed to create assembly: Error creating assembly archive src: Failed to retrieve numeric file attributes using: '/bin/sh -c ls -1laR /home/adona/emf/camel/apache-camel/..' no idea. Instead if I change to apache-camel: cd apache-camel mvn install the apache-camel build is successfull. If now I run: cd examples/camel-example-spring-jms/ mvn -e exec:java -PCamelServer + Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] [INFO] Building Camel :: Example :: Spring :: JMS [INFO]task-segment: [exec:java] [INFO] [INFO] Preparing exec:java [INFO] No goals needed for project - skipping [INFO] [exec:java {execution: default-cli}] [pache.camel.spring.Main.main()] MainSupportINFO Apache Camel 2.2-SNAPSHOT starting [pache.camel.spring.Main.main()] MainSupportINFO Apache Camel 2.2-SNAPSHOT stopping [INFO] [ERROR] BUILD ERROR [INFO] [INFO] An exception occured while executing the Java class. null I can't reproduce in my box. Here is my environment Using Java version: 1.5.0 Apache Maven 2.2.0 (r788681; 2009-06-26 21:04:01+0800) Java version: 1.5.0_22 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Default locale: en_US, platform encoding: MacRoman OS name: mac os x version: 10.6.2 arch: i386 Family: unix cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'broker:broker'. [INFO] [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: An exception occured while executing the Java class. null at
Using the splitter based on POJO class type
I would like a route where I receive a message (rawframe), process it and split it into multiple new message (different types; Frame, Packet, Parameter), and thereafter route these to different endpoints. Something like; route from uri=activemq:topic:rawframe / to uri=bean:marshaller / choice when xpath$class.type = 'frame'/xpath to uri=activemq:topic:Frame/ /when when xpath$class.type = 'packet'/xpath to uri=activemq:topic:Packet/ /when otherwise xpath$class.type = 'parameter'/xpath to uri=activemq:topic:Parameter/ /otherwise /choice /route My questions are; - Can a processor in a route split one input message into multiple messages like this? - How can I route the output messages from my processor based on the class type? In the example I wrote '$class.type' as pseudo code. Thanks, Villemos. -- View this message in context: http://old.nabble.com/Using-the-splitter-based-on-POJO-class-type-tp27162674p27162674.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel 2.1.0 camel-example-spring-jms does not work
Hi, I just checked the activemq-core.jar 's META-INF/spring.schema file, it doesn't have an entry for http\://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd So you need the internet connection for running the test. I will fix it on activemq tomorrow. I just did a quick fix for this issue[1], and tested the example by stopping my computer's network. Please check out the latest code to go on your testing :) [1]http://svn.apache.org/viewvc?rev=899227view=rev Willem Attilio Donà wrote: I've found a partial solution: the java runtime didn't see the internet: I'm behind a proxy and my setup (env var http_proxy is not used by jvm), so: mvn exec:java -PCamelServer \ -Dhttp.proxyHost=127.0.0.1 \ -Dhttp.proxyPort=5865 solve the problem. (maybe the examples README could be updated for this scenario?) It remains however a question: why the xsd schema located in activemq-core.jar is not loaded by the system? This in needed if you run in a intranet, like a typical enterprise application. The place to see how to do this could be (sorry but my camel evaluation have to be stopped for a while): http://xerces.apache.org/xerces2-j/faq-xcatalogs.html I hope this can be of help to someone ... Attilio willem.jiang wrote: Attilio Donà wrote: Claus, I've tried the 2.2-SNAPSHOT (svn co https://svn.apache.org/repos/asf/camel/trunk camel) and the problem persist: I've also problems with the mvn install (2 test fails) and finally also skipping the tests I got a lot of WARNING and an ERROR: [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.commons.logging.* [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.cxf.* [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.mina.* [ ... These warning messages are for the bundle has some not use import package. As we have a common default import packages list for each module. It should be OK. [WARNING] Entry: apache-camel-2.2-SNAPSHOT/examples/camel-example-etl/src/main/resources/META-INF/services/org/apache/camel/ longer than 100 characters. [WARNING] Entry: apache-camel-2.2-SNAPSHOT/examples/camel-example-spring/src/main/java/org/apache/camel/example/spring/ longer than 100 characters. ... It's the Maven assemble warning, will not cause any issue. [WARNING] POM for 'org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:pom:1.0:compile' is invalid. Its dependencies (if any) will NOT be available to the current build. [WARNING] Cannot include project artifact: org.apache.camel:apache-camel:pom:2.2-SNAPSHOT; it doesn't have an associated file or directory. [WARNING] The following patterns were never triggered in this artifact inclusion filter: o 'org.springframework:spring-test' [INFO] Building zip: /home/adona/emf/camel/apache-camel/target/apache-camel-2.2-SNAPSHOT.zip [INFO] [assembly:single {execution: unix-src}] [INFO] Reading assembly descriptor: src/main/descriptors/unix-src.xml [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Failed to create assembly: Error creating assembly archive src: Failed to retrieve numeric file attributes using: '/bin/sh -c ls -1laR /home/adona/emf/camel/apache-camel/..' no idea. Instead if I change to apache-camel: cd apache-camel mvn install the apache-camel build is successfull. If now I run: cd examples/camel-example-spring-jms/ mvn -e exec:java -PCamelServer + Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] [INFO] Building Camel :: Example :: Spring :: JMS [INFO]task-segment: [exec:java] [INFO] [INFO] Preparing exec:java [INFO] No goals needed for project - skipping [INFO] [exec:java {execution: default-cli}] [pache.camel.spring.Main.main()] MainSupportINFO Apache Camel 2.2-SNAPSHOT starting [pache.camel.spring.Main.main()] MainSupportINFO Apache Camel 2.2-SNAPSHOT stopping [INFO] [ERROR] BUILD ERROR [INFO] [INFO] An exception occured while executing the Java class. null I can't reproduce in my box. Here is my environment Using Java version: 1.5.0 Apache Maven 2.2.0 (r788681; 2009-06-26 21:04:01+0800) Java version: 1.5.0_22 Java home: /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home Default locale: en_US, platform encoding: MacRoman OS name: mac os x version: 10.6.2 arch: i386 Family: unix
Re: Using the splitter based on POJO class type
Hi On Thu, Jan 14, 2010 at 4:03 PM, Drone42 gert.ville...@logica.com wrote: I would like a route where I receive a message (rawframe), process it and split it into multiple new message (different types; Frame, Packet, Parameter), and thereafter route these to different endpoints. Something like; route from uri=activemq:topic:rawframe / to uri=bean:marshaller / choice when xpath$class.type = 'frame'/xpath to uri=activemq:topic:Frame/ /when when xpath$class.type = 'packet'/xpath to uri=activemq:topic:Packet/ /when otherwise xpath$class.type = 'parameter'/xpath to uri=activemq:topic:Parameter/ /otherwise /choice /route My questions are; - Can a processor in a route split one input message into multiple messages like this? Check out using a POJO for splitter at http://camel.apache.org/splitter.html - How can I route the output messages from my processor based on the class type? In the example I wrote '$class.type' as pseudo code. See about xpath here http://camel.apache.org/xpath I assume class type is something in the XML document classtypefoo/type/class etc. Thanks, Villemos. -- View this message in context: http://old.nabble.com/Using-the-splitter-based-on-POJO-class-type-tp27162674p27162674.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: Camel and JMS Client Ack Mode?
Been playing around and did find that when using the jmsComponentClientAcknowledge method and the process method throws an Exception that the JMS Message is indeed left on the JMS Queue. In the case where jmsComponentAutoAcknowledge is used the JMS Message is removed from the JMS Queue even with an Exception being thrown. Here is the sample Processor I used: public class ProcessMessageForceError implements Processor{ @Override public void process(Exchange exchange) throws Exception { Message m = exchange.getIn(); log.info(Testing Error: (body): + m.getBody()); throw new Exception(Forcing Error to see what happens); } } So is there no way in Camel to leave the JMS Message on the JMS Queue unless the JMS Message acknowledge method called or do we need to force an Exception to get this behavior. Thanks, Mike -- View this message in context: http://old.nabble.com/Camel-and-JMS-Client-Ack-Mode--tp27152146p27163731.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Using the splitter based on POJO class type
Thanks for the very useful pointers. One questions; In the documentation of the splitter I only see how to build the route with a customer splitter using the fluent builder. Can I also configure this using spring XML, i.e. provide my splitter bean in the XML configuration of the route? And is the syntax described anywhere? Villemos. Claus Ibsen-2 wrote: Hi On Thu, Jan 14, 2010 at 4:03 PM, Drone42 gert.ville...@logica.com wrote: I would like a route where I receive a message (rawframe), process it and split it into multiple new message (different types; Frame, Packet, Parameter), and thereafter route these to different endpoints. Something like; route from uri=activemq:topic:rawframe / to uri=bean:marshaller / choice when xpath$class.type = 'frame'/xpath to uri=activemq:topic:Frame/ /when when xpath$class.type = 'packet'/xpath to uri=activemq:topic:Packet/ /when otherwise xpath$class.type = 'parameter'/xpath to uri=activemq:topic:Parameter/ /otherwise /choice /route My questions are; - Can a processor in a route split one input message into multiple messages like this? Check out using a POJO for splitter at http://camel.apache.org/splitter.html - How can I route the output messages from my processor based on the class type? In the example I wrote '$class.type' as pseudo code. See about xpath here http://camel.apache.org/xpath I assume class type is something in the XML document classtypefoo/type/class etc. Thanks, Villemos. -- View this message in context: http://old.nabble.com/Using-the-splitter-based-on-POJO-class-type-tp27162674p27162674.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/Using-the-splitter-based-on-POJO-class-type-tp27162674p27164293.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cache: Using Objects for cache
Hi, The version of ehCache used is 1.6.2. This is however modifiable to a later or earlier version. Cheers, Ashwin... tide08 wrote: Looks like Ashwin got on to this before I could submit mine. BTW..what version of ehCache does it use? It is not very clear from pom (and osgi is new to me) Thanks! tide08 wrote: Thanks! I will reply back when patch is ready. Claus Ibsen-2 wrote: Hi I created a ticket for it https://issues.apache.org/activemq/browse/CAMEL-2343 On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen claus.ib...@gmail.com wrote: On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang willem.ji...@gmail.com wrote: I think we can support the InputStream and Serializable object at the same time :) If the Message body is Serializable, we can skip the InputStream part, if it's not, we can try to turn it into an InputStream. Any thought? Yeah my thought as well about the Serializable BTW, any kind of contribution is welcome, so please feel free to submit the patch with a JIRA[1]. [1] http://issues.apache.org/activemq/browse/CAMEL Willem tide08 wrote: I am using camel 2.1.0 cache component, and I am confused how I can use custom objects with cache? It seems to me that for every object I would want to use, I will have to register TypeConverter for those classes? Is that assumption correct? I think it is due to following code in CacheProducer.java, which tries to convert payload into InputStream? InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, body); // Read InputStream into a byte[] buffer byte[] buffer = new byte[is.available()]; int n = is.available(); for (int j = 0; j n; j++) { buffer[j] = (byte)is.read(); } Looking at EHCache API, it can support any object as long as it is serializable, so camel-cache component should not try to convert payload into InputStream. Or was there any specific reason to do so? I quickly modified Producer and it seems to work fine, please let me know and I would be happy to provide the patch. Thanks! -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus - --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27164457.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cache: Using Objects for cache
Hi, The version of ehCache used by camel-cache is 1.6.2. This can however be modified to an earlier or later version. Cheers, Ashwin... tide08 wrote: Looks like Ashwin got on to this before I could submit mine. BTW..what version of ehCache does it use? It is not very clear from pom (and osgi is new to me) Thanks! tide08 wrote: Thanks! I will reply back when patch is ready. Claus Ibsen-2 wrote: Hi I created a ticket for it https://issues.apache.org/activemq/browse/CAMEL-2343 On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen claus.ib...@gmail.com wrote: On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang willem.ji...@gmail.com wrote: I think we can support the InputStream and Serializable object at the same time :) If the Message body is Serializable, we can skip the InputStream part, if it's not, we can try to turn it into an InputStream. Any thought? Yeah my thought as well about the Serializable BTW, any kind of contribution is welcome, so please feel free to submit the patch with a JIRA[1]. [1] http://issues.apache.org/activemq/browse/CAMEL Willem tide08 wrote: I am using camel 2.1.0 cache component, and I am confused how I can use custom objects with cache? It seems to me that for every object I would want to use, I will have to register TypeConverter for those classes? Is that assumption correct? I think it is due to following code in CacheProducer.java, which tries to convert payload into InputStream? InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, body); // Read InputStream into a byte[] buffer byte[] buffer = new byte[is.available()]; int n = is.available(); for (int j = 0; j n; j++) { buffer[j] = (byte)is.read(); } Looking at EHCache API, it can support any object as long as it is serializable, so camel-cache component should not try to convert payload into InputStream. Or was there any specific reason to do so? I quickly modified Producer and it seems to work fine, please let me know and I would be happy to provide the patch. Thanks! -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus - --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27164509.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel 2.1.0 camel-example-spring-jms does not work
Thanks Willem, it works! Attilio willem.jiang wrote: Hi, I just checked the activemq-core.jar 's META-INF/spring.schema file, it doesn't have an entry for http\://activemq.apache.org/schema/core/activemq-core-5.3.0.xsd So you need the internet connection for running the test. I will fix it on activemq tomorrow. I just did a quick fix for this issue[1], and tested the example by stopping my computer's network. Please check out the latest code to go on your testing :) [1]http://svn.apache.org/viewvc?rev=899227view=rev Willem Attilio Donà wrote: I've found a partial solution: the java runtime didn't see the internet: I'm behind a proxy and my setup (env var http_proxy is not used by jvm), so: mvn exec:java -PCamelServer \ -Dhttp.proxyHost=127.0.0.1 \ -Dhttp.proxyPort=5865 solve the problem. (maybe the examples README could be updated for this scenario?) It remains however a question: why the xsd schema located in activemq-core.jar is not loaded by the system? This in needed if you run in a intranet, like a typical enterprise application. The place to see how to do this could be (sorry but my camel evaluation have to be stopped for a while): http://xerces.apache.org/xerces2-j/faq-xcatalogs.html I hope this can be of help to someone ... Attilio willem.jiang wrote: Attilio Donà wrote: Claus, I've tried the 2.2-SNAPSHOT (svn co https://svn.apache.org/repos/asf/camel/trunk camel) and the problem persist: I've also problems with the mvn install (2 test fails) and finally also skipping the tests I got a lot of WARNING and an ERROR: [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.commons.logging.* [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.cxf.* [WARNING] Warning building bundle org.apache.camel:camel-example-tracer:bundle:2.2-SNAPSHOT : Did not find matching referal for org.apache.mina.* [ ... These warning messages are for the bundle has some not use import package. As we have a common default import packages list for each module. It should be OK. [WARNING] Entry: apache-camel-2.2-SNAPSHOT/examples/camel-example-etl/src/main/resources/META-INF/services/org/apache/camel/ longer than 100 characters. [WARNING] Entry: apache-camel-2.2-SNAPSHOT/examples/camel-example-spring/src/main/java/org/apache/camel/example/spring/ longer than 100 characters. ... It's the Maven assemble warning, will not cause any issue. [WARNING] POM for 'org.iso_relax.verifier.jaxp.validation:isorelax-jaxp-bridge:pom:1.0:compile' is invalid. Its dependencies (if any) will NOT be available to the current build. [WARNING] Cannot include project artifact: org.apache.camel:apache-camel:pom:2.2-SNAPSHOT; it doesn't have an associated file or directory. [WARNING] The following patterns were never triggered in this artifact inclusion filter: o 'org.springframework:spring-test' [INFO] Building zip: /home/adona/emf/camel/apache-camel/target/apache-camel-2.2-SNAPSHOT.zip [INFO] [assembly:single {execution: unix-src}] [INFO] Reading assembly descriptor: src/main/descriptors/unix-src.xml [INFO] [ERROR] BUILD ERROR [INFO] [INFO] Failed to create assembly: Error creating assembly archive src: Failed to retrieve numeric file attributes using: '/bin/sh -c ls -1laR /home/adona/emf/camel/apache-camel/..' no idea. Instead if I change to apache-camel: cd apache-camel mvn install the apache-camel build is successfull. If now I run: cd examples/camel-example-spring-jms/ mvn -e exec:java -PCamelServer + Error stacktraces are turned on. [INFO] Scanning for projects... [INFO] [INFO] Building Camel :: Example :: Spring :: JMS [INFO]task-segment: [exec:java] [INFO] [INFO] Preparing exec:java [INFO] No goals needed for project - skipping [INFO] [exec:java {execution: default-cli}] [pache.camel.spring.Main.main()] MainSupportINFO Apache Camel 2.2-SNAPSHOT starting [pache.camel.spring.Main.main()] MainSupportINFO Apache Camel 2.2-SNAPSHOT stopping [INFO] [ERROR] BUILD ERROR [INFO] [INFO] An exception occured while executing the Java class. null I can't reproduce in my box. Here is my environment Using Java version: 1.5.0 Apache Maven 2.2.0 (r788681; 2009-06-26 21:04:01+0800) Java version: 1.5.0_22 Java home:
Tight Integration with CEP (Complex Event Processing)
Integration with CEP (Complex Event Processing) - relatively seamlessly, not in an awkward afterthought manner - is more and more important in any middleware stack ... So what can Camel do about this CEP integration for us ? -- View this message in context: http://old.nabble.com/Tight-Integration-with-CEP-%28Complex-Event-Processing%29-tp27165344p27165344.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: camel-cache: Using Objects for cache
Hi Claus, I fixed the sample cache creation issue and have checked in a patch CAMEL-2363. Cheers, Ashwin... Claus Ibsen-2 wrote: On Wed, Jan 13, 2010 at 7:19 PM, tide08 sachin2...@yahoo.com wrote: Thanks Claus! ArtifactID says springsource is it some customized version of ehCache we are using? Reason I am asking is that I have conflict with hibernate and I need to exclude ehCache dependency from either one of these. Its the OSGi problem that it often cannot use maven jars out of the box. So SpringSource creates their own .jar that works in their OSGi server. IMHO that is a big pain with OSGi as you need to keep up to date with releases. Many projects don't release their .jars as OSGi compliant bundles. It should be possible to use a never version and then let the camel feature for camel-cache use that Spring OSGi compliant .jar. Just that they are API compatible. Also, I had another suggestion for cache component: - Clean up ehCache.xml to remove sample cache descriptions as these are redundant, specially the one's which use distributed cache. It requires one of the port to be open and does not work out of the box. Can you pin point the problem. Claus Ibsen-2 wrote: On Wed, Jan 13, 2010 at 12:32 AM, tide08 sachin2...@yahoo.com wrote: Looks like Ashwin got on to this before I could submit mine. BTW..what version of ehCache does it use? It is not very clear from pom (and osgi is new to me) Check the parent/pm.xml which have versions listed. Otherwise do a mvn dependency:list in the component to see which versions maven report. [INFO] net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile Thanks! tide08 wrote: Thanks! I will reply back when patch is ready. Claus Ibsen-2 wrote: Hi I created a ticket for it https://issues.apache.org/activemq/browse/CAMEL-2343 On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen claus.ib...@gmail.com wrote: On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang willem.ji...@gmail.com wrote: I think we can support the InputStream and Serializable object at the same time :) If the Message body is Serializable, we can skip the InputStream part, if it's not, we can try to turn it into an InputStream. Any thought? Yeah my thought as well about the Serializable BTW, any kind of contribution is welcome, so please feel free to submit the patch with a JIRA[1]. [1] http://issues.apache.org/activemq/browse/CAMEL Willem tide08 wrote: I am using camel 2.1.0 cache component, and I am confused how I can use custom objects with cache? It seems to me that for every object I would want to use, I will have to register TypeConverter for those classes? Is that assumption correct? I think it is due to following code in CacheProducer.java, which tries to convert payload into InputStream? InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, body); // Read InputStream into a byte[] buffer byte[] buffer = new byte[is.available()]; int n = is.available(); for (int j = 0; j n; j++) { buffer[j] = (byte)is.read(); } Looking at EHCache API, it can support any object as long as it is serializable, so camel-cache component should not try to convert payload into InputStream. Or was there any specific reason to do so? I quickly modified Producer and it seems to work fine, please let me know and I would be happy to provide the patch. Thanks! -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27148797.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus - --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730
Re: camel-cache: Using Objects for cache
Hi, The other request regarding exposing cache statistics is a little more involved. I have created a Jira entry for it and will try and add this feature in due course. Cheers, Ashwin... tide08 wrote: Thanks Claus! ArtifactID says springsource is it some customized version of ehCache we are using? Reason I am asking is that I have conflict with hibernate and I need to exclude ehCache dependency from either one of these. Also, I had another suggestion for cache component: - Clean up ehCache.xml to remove sample cache descriptions as these are redundant, specially the one's which use distributed cache. It requires one of the port to be open and does not work out of the box. - Exposing cache statistics thru jmx Claus Ibsen-2 wrote: On Wed, Jan 13, 2010 at 12:32 AM, tide08 sachin2...@yahoo.com wrote: Looks like Ashwin got on to this before I could submit mine. BTW..what version of ehCache does it use? It is not very clear from pom (and osgi is new to me) Check the parent/pm.xml which have versions listed. Otherwise do a mvn dependency:list in the component to see which versions maven report. [INFO] net.sourceforge.ehcache:com.springsource.net.sf.ehcache:jar:1.6.2:compile Thanks! tide08 wrote: Thanks! I will reply back when patch is ready. Claus Ibsen-2 wrote: Hi I created a ticket for it https://issues.apache.org/activemq/browse/CAMEL-2343 On Wed, Jan 6, 2010 at 6:12 AM, Claus Ibsen claus.ib...@gmail.com wrote: On Wed, Jan 6, 2010 at 3:44 AM, Willem Jiang willem.ji...@gmail.com wrote: I think we can support the InputStream and Serializable object at the same time :) If the Message body is Serializable, we can skip the InputStream part, if it's not, we can try to turn it into an InputStream. Any thought? Yeah my thought as well about the Serializable BTW, any kind of contribution is welcome, so please feel free to submit the patch with a JIRA[1]. [1] http://issues.apache.org/activemq/browse/CAMEL Willem tide08 wrote: I am using camel 2.1.0 cache component, and I am confused how I can use custom objects with cache? It seems to me that for every object I would want to use, I will have to register TypeConverter for those classes? Is that assumption correct? I think it is due to following code in CacheProducer.java, which tries to convert payload into InputStream? InputStream is = exchange.getContext().getTypeConverter().convertTo(InputStream.class, body); // Read InputStream into a byte[] buffer byte[] buffer = new byte[is.available()]; int n = is.available(); for (int j = 0; j n; j++) { buffer[j] = (byte)is.read(); } Looking at EHCache API, it can support any object as long as it is serializable, so camel-cache component should not try to convert payload into InputStream. Or was there any specific reason to do so? I quickly modified Producer and it seems to work fine, please let me know and I would be happy to provide the patch. Thanks! -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus -- View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27136815.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus - --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://old.nabble.com/camel-cache%3A-Using-Objects-for-cache-tp27026756p27166556.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Tight Integration with CEP (Complex Event Processing)
Hi, Can you please provide further clarity on this subject. It is not entirely clear as to what you are looking for... Can you be more specific...? Thanks, Ashwin... verlsnake wrote: Integration with CEP (Complex Event Processing) - relatively seamlessly, not in an awkward afterthought manner - is more and more important in any middleware stack ... So what can Camel do about this CEP integration for us ? - --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://old.nabble.com/Tight-Integration-with-CEP-%28Complex-Event-Processing%29-tp27165344p27166608.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Store data be used in other steps in an exchange
Hi Johan, You can do this in the following way from(somewhere) .process(new Processor() { public void process(Exchange exchange) throws Exception { String payload = exchange.getIn().getBody(String.class); // get URI from payload body and set it in header (optional if such a header exists) exchange.getIn.setHeader(targetURI,...) exchange.getIn().setBody(Changed body); } }) .marshal(...) // Not sure what marshalling you need here .process(new Processor() { public void process(Exchange exchange) throws Exception { String payload = exchange.getIn().getBody(String.class); String targetURI = exchange.getIn().getHeader(targetURI); ProducerTemplate producer = new ProducerTemplate(...); Exchange result = producer.send(targetURI , exchange); ... } }). Cheers, Ashwin... Johan Haleby wrote: I found out by myself. I simply put the uri in a header and simply pass the header to the recipient list. Johan Haleby wrote: Hi, I have a use-case where I must extract a endpoint uri from an object, marshal the object to an unknown format and then send the result to the extracted uri. Is there a built-in way to do this or do I have to manually persist the extract endpoint and retrieve a dynamic router or something? Here's some pseudo code describing what I'm looking for: from(somewhere).extractURIFromConsumedObject(). marshal(encodeToUnknownFormat).to(uriThatWasExtractedFromTheConsumedObject); Thanks, /Johan - --- Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence Progress Software Corporation 14 Oak Park Drive Bedford, MA 01730 --- +1-972-304-9084 (Office) +1-972-971-1700 (Mobile) Blog: http://opensourceknowledge.blogspot.com/ -- View this message in context: http://old.nabble.com/Store-data-be-used-in-other-steps-in-an-exchange-tp27159537p27166838.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Request message accessibility/manipulation
Hi, You can use Wiretaps and an aggregator to do what you're suggesting. At each step that you want an intermediate result to be available, wiretap it off to an aggregator and set the batch size of the aggregator accordingly. from(direct:consumerEndpoint).wireTap(direct:aggregator).to(direct:requestToSomeEndpointTransformer).to( direct:someEndpoint).to(direct:aggregator); from(direct:aggregator).aggregate().header(id).batchSize(2).groupExchanges().to(mock:result); One thing to note is that groupExchanges() will gather up all the aggregated exchanges and store them in a property in the exchange. You get at them via ListExchange grouped = e.getProperty(Exchange.GROUPED_EXCHANGE, List.class); You'll need to write a custom processor (in place of the mock) to combine/transform them to your liking as before responding. You can find a bunch of info about aggregators here http://camel.apache.org/aggregator.html ste. On Thu, Jan 14, 2010 at 12:12 AM, lekkie lekkie.ay...@gmail.com wrote: Hi guys, Just a quick one. I have this scenario where I 'd like to manipulate a request and some reponse from an endpoint. The flow below describe what I am trying to achieve: osgi:camelContext xmlns=http://camel.apache.org/schema/spring; trace=true route from uri=nmr:consumerEndpoint/ to uri=xslt:requestToSomeEndpoint.xsl/ to uri=nmr:someEndpoint/ to uri=xslt:requestToAnotherEndpoint.xsl/ to uri=nmr:anotherEndpoint/ /route /camelcontext I'd like the transformation (requestToAnotherEndpoint.xsl) to be able to access/manipulate the original request message from nmr:consumerEndpoint and the response from nmr:someEndpoint in order to product its output. Is this scenario possible? -- View this message in context: http://old.nabble.com/Request-message-accessibility-manipulation-tp27157259p27157259.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re:A bug of InOut pattern?
Yes you are right. But the real confusing thing is: the two routes I tested have same semantic means, but the result is different. While I am try to find which caused the difference, I checked the source code of camel, and find a lot of camel-processor obey the following rule( I thinks it's camel's default rule for MEP), but the pipe-line processor violate it (not same as the other processors): The rule is : 1)Processor will remember the input message-exchange 2)while the processor get the final result message-exchange, it will combine the result message-exchange with the remembered input message-exchange. At this time, MEP will affect how to combine the two message-exchange 3) the combined result will act as the final result of processor; But the pipe-line processor doesn't remember the input message-exchange, but remember the result of first processor in the pipe-line as the message-exchange to combine; So it cause the two routes has different result; Willem Jiang wrote: Your processor should check the MEP, and don't set the out message if the Exchange's MEP is InOnly. If there is a out message, the pipeline will try to copy the out message to next processor exchange's in message, otherwise it will copy the in message to next processor exchange's in message. Willem ext2 wrote: Hi: The camel 2.1's pipeline patter's MEP is InOnly default. But the result of following route is different, if I using inOnly() processor in route vs using default; I tried it using a simple sample: send a message to a direct endpoint, which body is number=1, a route receive the message and increase the message's body twice by a processor, then send to a mock endpoint; The increase number process's code is: Class IncreaseProcessor{ void process(MessageExchange me) { Integer result= Me.getIn().getBody() + 1; Me.getOut().setBody(result); } } 1): following rout using inOnly() processor , and mock endpoint's return ME's in.body=3, out=Null from(direct:inOnlyUsingProcessor).inOnly().process(outProcessor).process(o utProcessor).to(mock:result); 2) following route using default inOnly, and mock's return ME's in.body=3, out.body=2. from(direct:inOnlyDefault).process(outProcessor).process(outProcessor).to( mock:result); So why the result has a out message and it's body=2, it should be same as the first route(out=null);
Re: A bug of InOut pattern?
Hi, I think you processor should check the MEP for the exchange. As it broke the rule of MEP. Can you change the code like this, and run the test again? Class IncreaseProcessor{ void process(Exchange me) { Integer result= me.getIn().getBody() + 1; if (me.getPattern().isOutCapable()) { me.getOut().setBody(result); } else { me.getIn().setBody(result); } } } ext2 wrote: Yes you are right. But the real confusing thing is: the two routes I tested have same semantic means, but the result is different. While I am try to find which caused the difference, I checked the source code of camel, and find a lot of camel-processor obey the following rule( I thinks it's camel's default rule for MEP), but the pipe-line processor violate it (not same as the other processors): The rule is : 1)Processor will remember the input message-exchange 2)while the processor get the final result message-exchange, it will combine the result message-exchange with the remembered input message-exchange. At this time, MEP will affect how to combine the two message-exchange 3) the combined result will act as the final result of processor; But the pipe-line processor doesn't remember the input message-exchange, but remember the result of first processor in the pipe-line as the message-exchange to combine; So it cause the two routes has different result; Willem Jiang wrote: Your processor should check the MEP, and don't set the out message if the Exchange's MEP is InOnly. If there is a out message, the pipeline will try to copy the out message to next processor exchange's in message, otherwise it will copy the in message to next processor exchange's in message. Willem ext2 wrote: Hi: The camel 2.1's pipeline patter's MEP is InOnly default. But the result of following route is different, if I using inOnly() processor in route vs using default; I tried it using a simple sample: send a message to a direct endpoint, which body is number=1, a route receive the message and increase the message's body twice by a processor, then send to a mock endpoint; The increase number process's code is: Class IncreaseProcessor{ void process(MessageExchange me) { Integer result= Me.getIn().getBody() + 1; Me.getOut().setBody(result); } } 1): following rout using inOnly() processor , and mock endpoint's return ME's in.body=3, out=Null from(direct:inOnlyUsingProcessor).inOnly().process(outProcessor).process(o utProcessor).to(mock:result); 2) following route using default inOnly, and mock's return ME's in.body=3, out.body=2. from(direct:inOnlyDefault).process(outProcessor).process(outProcessor).to( mock:result); So why the result has a out message and it's body=2, it should be same as the first route(out=null);
Re: Intercept a processor?
Hi I posted a blog entry about the new feature in 2.2 http://davsclaus.blogspot.com/2010/01/apache-camel-22-improved-test-kit.html On Wed, Jan 13, 2010 at 8:14 PM, Johan Haleby johan.hal...@gmail.com wrote: That looks really neat and would as far as I can see really help. It would be simple for me to wrap this in a test base class exposing something like awaitCompletion(direct:foo). Would be desirable/possible to have something similar to modify or extend an already defined route? Something like: RouteModificationBuilder builder = new RouteModificationBuilder(camelContext); builder.from(direct:foo).append(new Processor(..)).apply(); Or can you do this already? Thanks, /Johan Claus Ibsen-2 wrote: Hi I think CAMEL-2357 is what you are looking for https://issues.apache.org/activemq/browse/CAMEL-2357 If you could take a look and maybe if you got some ideas or how you would like the API to be to support your use-case. There are some code snippets of my prototype in there. On Wed, Jan 13, 2010 at 9:11 AM, Johan Haleby johan.hal...@gmail.com wrote: Hi, Thank you very much your suggestion with event notifiers worked! But I hope the changes in 2.2 can make it even better since now the ExchangeCompletedEvent is sent several times (once per from in the route definition) and thus it's hard to know the count in the latch when you're not sure to which endpoint the users sends the first message. Would you recommend using a snapshot of version 2.2 right now? (We'd also like to use Spring 3 in our project). /Johan Johan Haleby wrote: Hi, Thanks for your quick response. Sorry for not mentioning it in the previous mail but I'm using Camel 2.1 just as you suspected. Unfortunately the first solution you posted (using async send and latches) won't work out of the box for me because the producer template is wrapped in an anti-corruption layer and the test should use this anti-corruption layer to send the message. I'll look into your suggestion by subscribing to the ExchangeDoneEvent. Is there anywhere I can find some documentation or example of how to do this? Or was it this that you went through in chapter 6 in the book? I look forward to the changes you mention in version 2.2, seems really useful and looks to fit very well with what I'm trying to do here. Is there an expected date when 2.2 may be available? Regards, /Johan The first option won't work Claus Ibsen-2 wrote: On Tue, Jan 12, 2010 at 5:56 PM, Johan Haleby johan.hal...@gmail.com wrote: Hi, I'm configuring routes using the Java DSL and it works very well. However during testing I'd like to somehow hook into the end of an already defined route to add notification support. The reason is that in my test I'm creating a message and pass it to a queue using Camel and this message is handled by a processor. After this processor has finished executing I'd like to receive some sort of notification but only during testing. The reason is that I'd like my test to wait until the processor has finished executing in my test case so that I can verify the result of the processor. For example: public void test() { 1. send a message to queue // just as you would in production 2. wait for the processor to finish // this is where I'd like to get a notification that the processor has finished so that it's ok to continue to the next step 3. verify result } The route may look something like: from(jms:queue:myqueue).process(new MyProcessor()); // A simplification of the production route Is there a preferred way of doing this in Camel without changing the code making up the production route? Or is there a better way to achieve it? Chapter 6 in the book go over this issue and how to address that: http://www.manning.com/ibsen/ (will be updated in next MEAP due this month) However we made it easier to do nice and easy from an unit test in 2.2 which I assume is not the version of Camel you are using. In 2.2 you can advice and route by adding additional cross cutting concerns such as onCompletion, interceptors etc. which you would then be able to use to know when its done. In Camel 2.1 you got the EventNotification which you actually can use for that to get notified when an Exchange is done as it emits a ExchangeDoneEvent. I am currently improving that for 2.2 to let you filter out of the box the notifier so you only receive interesting events. But that should not hold you back from using that in 2.1. We may improve this situation even more to make it easy as it can get for testing production routes with test methods. So kinda inject mocks at end of routes etc. so you can use that to verify behavior etc. /Johan -- View this message in context: http://old.nabble.com/Intercept-a-processor--tp27130672p27130672.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in
Re: Intercept a processor?
Thanks! It would be great to have some filtering functionality as well. I've added an example as a comment on the blog. Regards, /Johan Claus Ibsen-2 wrote: Hi I posted a blog entry about the new feature in 2.2 http://davsclaus.blogspot.com/2010/01/apache-camel-22-improved-test-kit.html On Wed, Jan 13, 2010 at 8:14 PM, Johan Haleby johan.hal...@gmail.com wrote: That looks really neat and would as far as I can see really help. It would be simple for me to wrap this in a test base class exposing something like awaitCompletion(direct:foo). Would be desirable/possible to have something similar to modify or extend an already defined route? Something like: RouteModificationBuilder builder = new RouteModificationBuilder(camelContext); builder.from(direct:foo).append(new Processor(..)).apply(); Or can you do this already? Thanks, /Johan Claus Ibsen-2 wrote: Hi I think CAMEL-2357 is what you are looking for https://issues.apache.org/activemq/browse/CAMEL-2357 If you could take a look and maybe if you got some ideas or how you would like the API to be to support your use-case. There are some code snippets of my prototype in there. On Wed, Jan 13, 2010 at 9:11 AM, Johan Haleby johan.hal...@gmail.com wrote: Hi, Thank you very much your suggestion with event notifiers worked! But I hope the changes in 2.2 can make it even better since now the ExchangeCompletedEvent is sent several times (once per from in the route definition) and thus it's hard to know the count in the latch when you're not sure to which endpoint the users sends the first message. Would you recommend using a snapshot of version 2.2 right now? (We'd also like to use Spring 3 in our project). /Johan Johan Haleby wrote: Hi, Thanks for your quick response. Sorry for not mentioning it in the previous mail but I'm using Camel 2.1 just as you suspected. Unfortunately the first solution you posted (using async send and latches) won't work out of the box for me because the producer template is wrapped in an anti-corruption layer and the test should use this anti-corruption layer to send the message. I'll look into your suggestion by subscribing to the ExchangeDoneEvent. Is there anywhere I can find some documentation or example of how to do this? Or was it this that you went through in chapter 6 in the book? I look forward to the changes you mention in version 2.2, seems really useful and looks to fit very well with what I'm trying to do here. Is there an expected date when 2.2 may be available? Regards, /Johan The first option won't work Claus Ibsen-2 wrote: On Tue, Jan 12, 2010 at 5:56 PM, Johan Haleby johan.hal...@gmail.com wrote: Hi, I'm configuring routes using the Java DSL and it works very well. However during testing I'd like to somehow hook into the end of an already defined route to add notification support. The reason is that in my test I'm creating a message and pass it to a queue using Camel and this message is handled by a processor. After this processor has finished executing I'd like to receive some sort of notification but only during testing. The reason is that I'd like my test to wait until the processor has finished executing in my test case so that I can verify the result of the processor. For example: public void test() { 1. send a message to queue // just as you would in production 2. wait for the processor to finish // this is where I'd like to get a notification that the processor has finished so that it's ok to continue to the next step 3. verify result } The route may look something like: from(jms:queue:myqueue).process(new MyProcessor()); // A simplification of the production route Is there a preferred way of doing this in Camel without changing the code making up the production route? Or is there a better way to achieve it? Chapter 6 in the book go over this issue and how to address that: http://www.manning.com/ibsen/ (will be updated in next MEAP due this month) However we made it easier to do nice and easy from an unit test in 2.2 which I assume is not the version of Camel you are using. In 2.2 you can advice and route by adding additional cross cutting concerns such as onCompletion, interceptors etc. which you would then be able to use to know when its done. In Camel 2.1 you got the EventNotification which you actually can use for that to get notified when an Exchange is done as it emits a ExchangeDoneEvent. I am currently improving that for 2.2 to let you filter out of the box the notifier so you only receive interesting events. But that should not hold you back from using that in 2.1. We may improve this situation even more to make it easy as it can get for testing production routes with test methods. So kinda inject mocks at end of routes etc. so you can use that to verify behavior etc. /Johan -- View this message in context:
Re: Tight Integration with CEP (Complex Event Processing)
On Thu, Jan 14, 2010 at 6:50 PM, verlsnake k...@kaitischler.de wrote: Integration with CEP (Complex Event Processing) - relatively seamlessly, not in an awkward afterthought manner - is more and more important in any middleware stack ... So what can Camel do about this CEP integration for us ? Have you looked at the camel-esper component? http://camel.apache.org/esper.html -- View this message in context: http://old.nabble.com/Tight-Integration-with-CEP-%28Complex-Event-Processing%29-tp27165344p27165344.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus
Re: How to pass headers from Camel to JBI and back
On Tue, Jan 12, 2010 at 10:38 PM, Sebastian Gomez sage...@gmail.com wrote: Hi everyone, I've upgraded from Camel 1.6 to 2.1 and I've run into the issue of losing Camel headers when calling a JBI endpoint. I think the way to go is to declare a FilterHeaderStrategy. I've seen some examples, but I don't know how to integrate it into my camel routes. First of all I've got to declare my CamelContext in an XML file (all examples I've seen are creating the camel context programatically). How do I declare the FilterHeaderStrategy there? Just as a simple bean? Secondly, when I call the JBI endpoint, I should append #myFilterStrategy to the URI. Will this map the name of myFilterStrategy to the id of the bean declared in the context? I've tried this, but it doesn't work, so I guess it will be a bit more complicated than I thought. Hope someone can help me out here. Thanks in advance. Sebastian Gomez. Did you upgrade SMX in the same time? I believe SMX and Camel is separated a bit more than before. The JbiExchange did not fare well when it was routed in Camel as the JBI spec. does not like concurrent access to it and whatnot. It just complicated things much more. So the servicemix-camel component now calls Camel and does a copy/restore kinda approaches to load and offload the data from/to Camel. Gert V. from the SMX teams knows much more about this and the reasons etc. -- Claus Ibsen Apache Camel Committer Author of Camel in Action: http://www.manning.com/ibsen/ Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/ Twitter: http://twitter.com/davsclaus