Re: File component : file don't move
I found a strange decision of the problem. There are string messages in my files, and i can append 'convertBodyTo type=java.lang.String/' after from uri=file.. In this case the route work. and in-files move to backup directory. Evgeny pevgen wrote: Hello. sometimes, but not each time, I got Exceptions : org.apache.camel.component.file.filecompon...@37165f] ERROR org.apache.camel.component.file.FileConsumer - Can not rename file from: C:\Temp\amqtest\in\1.txt to: C:\Temp\amqtest\in\.camel\1.txt java.io.IOException: Can not rename file from: C:\Temp\amqtest\in\1.txt to: C:\Temp\amqtest\in\.camel\1.txt at org.apache.camel.component.file.strategy.RenameFileProcessStrategy.commit(RenameFileProcessStrategy.java:69) and the file 'C:\Temp\amqtest\in\1.txt' didn't move from the directory, and a file '1.txt.camelLock' didn't delete from the directory, too. i try to use the route : route errorHandlerRef=deadLetterErrorHandlerInfinity from uri=file://C:\Temp\amqtest\in/ to ref=activemq:queue:myq1/ /route and i use 'JmsTransactionManager'. I say about this, because when i don't use the 'JmsTransactionManager', it seems that i haven't got this error. any suggests ? Thanks. Evgeny -- View this message in context: http://www.nabble.com/File-component-%3A-file-don%27t-move-tp21980942s22882p21993317.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel as an OSGi service on a JOnAS 5.1.0-M3 Application Server
Hello all, it is time for me to inform the Camel users that i did some work on Camel/OSGi/JOnAS. The goal was to provide a Camel OSGi service on the JOnAS 5 Application Server. I first noticed that Camel provides bundles of its modules (thanks all for this). However, an issue remains when we use Camel on OSGi. In the camel-core, when Camel try to find the converters (and more generally, when Camel try to deal with bundles), it needs to get the list of bundles on the OSGi gateway. this is done this way : class : org.apache.camel.util.ResolverUtil ... org.osgi.framework.Bundle bundle = (org.osgi.framework.Bundle) mth.invoke(loader); org.osgi.framework.Bundle[] bundles = bundle.getBundleContext().getBundles(); ... where mth is a Method object and loader a ClassLoader. This is not a common way to access the bundle list (so the bundleContext), as the classloader doesn't own such a method by default. It must be done the way it is in your case because of the websphere integration, but in a common environment, Camel needs to access this list through the BundleContext, which is known when the bundle is deployed on the gateway. Then i did some overload of the core to correctly get the bundles' list, as it is impossible for Camel to know that we are in an OSGi environment if the getBundle method is not available on a classloader. Once this was done, it was quite simple to provide a Camel service on an OSGi gateway using iPOJO (http://felix.apache.org/site/ipojo-concepts-overview.html). Be aware that my work was done for integration on a JOnAS Application Server (it is the reason of the classes' names), but it can perfectly work on a standalone OSGi gateway without JOnAS (JOnAS 5 uses Felix by default). You can checkout the sources here svn://svn.forge.objectweb.org/svnroot/jonas/sandbox/camel-jonas5. Feel free to make comments, and if you're in need for such a service in Camel, i will be glad to include my work in the project, either as an example, or all other ways you would like to. Two examples are also provided in my project, one deeling with JMS (using the JORAM implementation) and an other one using CXF. I still need to set up some tests to validate my work in a unitary test way. BTW, i use from the version 1.5.0 of Camel. Feel free to comment this e-mail, and react on the subject. Also don't hesitate to directly contact me. Regards, Guillaume PS : I'm using the Registry component made by S. Ali Tokmen, who made Camel work on a JOnAS 4.10.3 version. This component allow to define logical names to access endpoints when we define the camel routes. Those names are binded to the real technical name. -- Guillaume Renault - BULL Service BULL - Architect of an Open World Email : guillaume.rena...@bull.net Tel : +334 76 29 71 09 Office : B1-295 Web : http://jasmine.ow2.org web : http://jonas.ow2.org (\ _ /) (='.'=) ()-()
Re: Starting camel from my own class - Camel stops when main method stops
This looks like its down to daemon threads (I can never remember whether daemon on or off stops the JVM from terminating :). The easiest way to fix it might be having a loop in your main asking the user to enter 'quit' to terminate the application or something. Either that or just wait forever via an infinite loop... Object lock = new Object(); while (true) { synchronized { try { lock.wait(); } catch (Exception e) { } } } 2009/2/13 selezovikj semir.elezo...@gmail.com: I want to start Camel from my own class called Startup because I want to start other services as well. In the Startup class I do the following: // org.apache.camel.spring.Main Main camelMain = new Main(); camelMain.setApplicationContextUri(../config/jms-routing.xml); try { camelMain.start(); } catch (Exception e) { logger.error(Error starting camel, e); System.exit(-1); } Once the main method exits camel is stopped as well: 2009-02-13 10:40:03,509 [ main] TransportConnector INFO Connector tcp Started 2009-02-13 10:40:03,510 [ main] BrokerService INFO ActiveMQ JMS Message Broker (localhost, ID:semir.2e-systems.com-58933-1234518003268-0:0) started 2009-02-13 10:40:08,824 [ ActiveMQ ShutdownHook] BrokerService INFO ActiveMQ Message Broker (localhost, ID:semir.2e-systems.com-58933-1234518003268-0:0) is shutting down 2009-02-13 10:40:09,512 [ ActiveMQ ShutdownHook] TransportConnector INFO Connector tcp Stopped 2009-02-13 10:40:09,578 [ ActiveMQ ShutdownHook] BrokerService INFO ActiveMQ JMS Message Broker (localhost, ID:semir.2e-systems.com-58933-1234518003268-0:0) stopped If I put a thread sleep before the main method exits for 20 seconds ... then Camel is up on 61617 for around 20 seconds. Am I doing something wrong ? Can anybody help ? -- View this message in context: http://www.nabble.com/Starting-camel-from-my-own-class---Camel-stops-when-main-method-stops-tp21993387s22882p21993387.html Sent from the Camel - Users mailing list archive at Nabble.com. -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/
Re: Testing using Camel Test or Spring Testing or Guice
Camel-test isn't appearing in the 2.0 snapshots. Nolan willem.jiang wrote: Hi Since Camel-2.0 is not released yet, you can dowload the snapshot from here [1]. Please add this repository into your pom.xml, and set the camel version to be 2.0-SNAPSHOT. repositories repository idapache.snapshot/id nameApache Software Foundation Snapshot Repository/name urlhttp://people.apache.org/repo/m2-snapshot-repository/url snapshots enabledtrue/enabled /snapshots releases enabledfalse/enabled /releases /repository ... /repositories [1]the http://people.apache.org/repo/m2-snapshot-repository Willem Drone42 wrote: Thanks for the guide. However maven cant find camel-test in the repository. Browsing the content of the repository I can find camel-itest. Is this the same? Or where do I find camel-test? James.Strachan wrote: We've been through a few iterations of testing during the lifetime of the Camel project; we started with ContextTestSupport which was quite handy; Mock endpoints camel along, then the Camel binding and injection annotations came... http://activemq.apache.org/camel/bean-integration.html together with Spring Test came along along with which made testing much simpler and more powerful http://activemq.apache.org/camel/spring-testing.html then came Guice support not requiring any XML http://activemq.apache.org/camel/guice.html and finally support for Spring Java Config to allow folks to use Spring without any XML http://cwiki.apache.org/CAMEL/spring-java-config.html However not everyone uses Spring or Guice for Dependency Injection; sometimes folks use straight Java code. So then Camel Test has recently come along as an option... http://cwiki.apache.org/CAMEL/camel-test.html This might now all seem confusing! So I've tried to create a testing page describing how they are all now pretty similar; whether using Camel Test, Spring Testing with XML or Java Config or Guice... http://cwiki.apache.org/CAMEL/testing.html Any feedback/thoughts welcome! -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/ -- View this message in context: http://www.nabble.com/Testing-using-Camel-Test-or-Spring-Testing-or-Guice-tp20811429s22882p22006389.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Testing using Camel Test or Spring Testing or Guice
Let me clarify - I chose a poor message to respond to. It's not appearing in the standalone snapshot downloads (not related to the maven repository). nojonojo wrote: Camel-test isn't appearing in the 2.0 snapshots. Nolan willem.jiang wrote: Hi Since Camel-2.0 is not released yet, you can dowload the snapshot from here [1]. Please add this repository into your pom.xml, and set the camel version to be 2.0-SNAPSHOT. repositories repository idapache.snapshot/id nameApache Software Foundation Snapshot Repository/name urlhttp://people.apache.org/repo/m2-snapshot-repository/url snapshots enabledtrue/enabled /snapshots releases enabledfalse/enabled /releases /repository ... /repositories [1]the http://people.apache.org/repo/m2-snapshot-repository Willem Drone42 wrote: Thanks for the guide. However maven cant find camel-test in the repository. Browsing the content of the repository I can find camel-itest. Is this the same? Or where do I find camel-test? James.Strachan wrote: We've been through a few iterations of testing during the lifetime of the Camel project; we started with ContextTestSupport which was quite handy; Mock endpoints camel along, then the Camel binding and injection annotations came... http://activemq.apache.org/camel/bean-integration.html together with Spring Test came along along with which made testing much simpler and more powerful http://activemq.apache.org/camel/spring-testing.html then came Guice support not requiring any XML http://activemq.apache.org/camel/guice.html and finally support for Spring Java Config to allow folks to use Spring without any XML http://cwiki.apache.org/CAMEL/spring-java-config.html However not everyone uses Spring or Guice for Dependency Injection; sometimes folks use straight Java code. So then Camel Test has recently come along as an option... http://cwiki.apache.org/CAMEL/camel-test.html This might now all seem confusing! So I've tried to create a testing page describing how they are all now pretty similar; whether using Camel Test, Spring Testing with XML or Java Config or Guice... http://cwiki.apache.org/CAMEL/testing.html Any feedback/thoughts welcome! -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/ -- View this message in context: http://www.nabble.com/Testing-using-Camel-Test-or-Spring-Testing-or-Guice-tp20811429s22882p22006406.html Sent from the Camel - Users mailing list archive at Nabble.com.
Null response calling route
Hi, I'm using camel 2.0 snapshot and trying to get a response back from the first condition in the following choice(): from(JMS_JIS) .choice() .when().xpath(/jis:ListSupportedFeaturesRequest, cisNamespace) .unmarshal(camelJaxbDataFormat) .setHeader(responsetype, constant(new ListFeaturesResponseType())) .to(ExchangePattern.InOut, filter:cisListSupportedFeaturesFilterChain) .when().xpath(/jis:ContentQueryRequest, cisNamespace) .unmarshal(camelJaxbDataFormat) .setHeader(responsetype, constant(new ContentQueryResponseType())) .to(ExchangePattern.InOut, filter:cisContentQueryRequestFilterChain) .otherwise() .unmarshal(camelJaxbDataFormat) .setHeader(responsetype, constant(new ServiceCheckResponseType())) .to(ExchangePattern.InOut, filter:serviceCheckFilterChain) .end(); The filter component is one I created. I can see that the result object is being set at the end of my FilterProcessor, but the response returned from: Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS, ExchangePattern.InOut, xmlRequestBody); is null. xmlRequestBody is just an XML string. As far as I can tell, everything is working fine except for getting back the result object. Interestingly, if I change the sendBody(...) call to: Object response = producerTemplate.sendBody(CamelRoutes.JMS_JIS, xmlRequestBody); I get the original XML returned as the response object. I'm not sure what that indicates, but it's not what I need to have happen. There is nothing in the logs to indicate an error in from the JMS or JAXB components. I've been beating my head against this for a few hours and I don't know what else I could try. Any help is very much appreciated. Thanks for your time. Regards, Nick
Re: Starting camel from my own class - Camel stops when main method stops
Hi You can use ctrl + break or ctrl + \ on unix to dump the thread list when you app hangs. You can then identify what happens We fixed an issue with the Main app not being able to stop properly, that is fixed in Camel 1.6.0, with a thread waiting for a countdown latch. So try out the 1.6.0 when its released On Fri, Feb 13, 2009 at 5:47 PM, James Strachan james.strac...@gmail.com wrote: This looks like its down to daemon threads (I can never remember whether daemon on or off stops the JVM from terminating :). The easiest way to fix it might be having a loop in your main asking the user to enter 'quit' to terminate the application or something. Either that or just wait forever via an infinite loop... Object lock = new Object(); while (true) { synchronized { try { lock.wait(); } catch (Exception e) { } } } 2009/2/13 selezovikj semir.elezo...@gmail.com: I want to start Camel from my own class called Startup because I want to start other services as well. In the Startup class I do the following: // org.apache.camel.spring.Main Main camelMain = new Main(); camelMain.setApplicationContextUri(../config/jms-routing.xml); try { camelMain.start(); } catch (Exception e) { logger.error(Error starting camel, e); System.exit(-1); } Once the main method exits camel is stopped as well: 2009-02-13 10:40:03,509 [ main] TransportConnector INFO Connector tcp Started 2009-02-13 10:40:03,510 [ main] BrokerService INFO ActiveMQ JMS Message Broker (localhost, ID:semir.2e-systems.com-58933-1234518003268-0:0) started 2009-02-13 10:40:08,824 [ ActiveMQ ShutdownHook] BrokerService INFO ActiveMQ Message Broker (localhost, ID:semir.2e-systems.com-58933-1234518003268-0:0) is shutting down 2009-02-13 10:40:09,512 [ ActiveMQ ShutdownHook] TransportConnector INFO Connector tcp Stopped 2009-02-13 10:40:09,578 [ ActiveMQ ShutdownHook] BrokerService INFO ActiveMQ JMS Message Broker (localhost, ID:semir.2e-systems.com-58933-1234518003268-0:0) stopped If I put a thread sleep before the main method exits for 20 seconds ... then Camel is up on 61617 for around 20 seconds. Am I doing something wrong ? Can anybody help ? -- View this message in context: http://www.nabble.com/Starting-camel-from-my-own-class---Camel-stops-when-main-method-stops-tp21993387s22882p21993387.html Sent from the Camel - Users mailing list archive at Nabble.com. -- James --- http://macstrac.blogspot.com/ Open Source Integration http://fusesource.com/ -- Claus Ibsen Apache Camel Committer Open Source Integration: http://fusesource.com Blog: http://davsclaus.blogspot.com/