Custom Properties Placeholder Implementations?
Greetings, I am currently using java DSL and have been investigating Fuse and Fabric8 as possible alternatives. Currently I have a route that does something like the following: final String cron = this.config.automationCasesDBMonitorCron().replaceAll( , +); final String quartzURI = quartz://case_automation/processAutomationCasesFromDB?cron= + cron; fromStandard(quartzURI) .routeId(ROUTE_ID_ETL_MONITOR_TIMER) // timer trigger .transacted(TxnHelper.KEY_TXNPOLICY_REQUIRED) // make the route transacted .to(InOnly, endpointAMQ(this.config.queueETLCheckEvent())); // put an event to be consumed As you can see, I fetch the names of queues and cron trigger configs from a configuration object. The actual config class goes to a database to get the configuration but that is not relevant to the question. The question is how can I implement something like this inside the spring DSL (which I am admittedly unfamiliar with). Currently I am trying to cross code my routes and for this one I have the following: camelContext xmlns=http://camel.apache.org/schema/spring; route id=ETLMonitorTimer from uri=quartz://case_automation/processAutomationCasesFromDB?cron=/ transacted ref=REQUIRED/ to uri=activemq:queue:/ /route /camelContext As you can see I don't have the cron trigger or the destination queue that I get normally from the config file so I am at a bit of a loss as to how to accomplish this. I was thinking with a property placeholder i could do something like this: bean id=configBean class=com.foo.ConfigMgr/ camelContext xmlns=http://camel.apache.org/schema/spring; propertyPlaceholder ref=configBean/ route id=ETLMonitorTimer from uri=quartz://case_automation/processAutomationCasesFromDB?cron={{etl_monitor_cron}}/ transacted ref=REQUIRED/ to uri=activemq:queue:{{event_queue}}/ /route /camelContext But I may be way off base on how to do that. I confess I have always thought the Spring XML DSL to be much less flexible and powerful than the Java DSL but I am open to being proven wrong. :) So any help here? Thanks a bunch. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 http://www.linkedin.com/pub/robert-simmons/40/852/a39*
Re: Aggregate Error
Thats a little piecemeal friend. Hard to tell what is going on from what you posted. Can you try again with the actual XML route code? *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 http://www.linkedin.com/pub/robert-simmons/40/852/a39* On Tue, Apr 22, 2014 at 4:44 AM, Jaishankar jayashankar@wipro.comwrote: This is the source code: person/firstName/text() ${in.header.breadcrumbId} lt;convertBodyTo type=java.lang.String/gt; corrId The error which I'm getting is Error during type conversion from type: java.lang.String to the required type: java.lang.Integer with value due java.lang.NumberFormatException: For input string: In route 2 target folder there are 2 files called msg1, msg2 with some name.Please help to resolve this error. -- View this message in context: http://camel.465427.n5.nabble.com/Aggregate-Error-tp5750428.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HA of Camel
This isn't so much of a camel question but an ActiveMQ and platform question. Camel doesn't implement things like clustering and failover. That is outside the scope of the camel framework. Something like asking a Coffee table what it does to facilitate keeping water out of the basement. Typically you would resolve those questions outside and then deploy camel on the solutions. As for the solutions, there are many. Application servers clustered with camel running as WAR files. Clustered activemq with camel routes in the lib path. Fabric8 and Fuse or just vanilla Karaf and service mix. Choose your platform and tech stack. Then deploy camel on it. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 http://www.linkedin.com/pub/robert-simmons/40/852/a39* On Tue, Apr 22, 2014 at 1:10 AM, vinod vinod.geo...@tecnotree.com wrote: Hi All, Please help me on the below scenarios: What are the possible ways to scale up camel as active-active mode with Active-MQ clustered(Maser Slave). ( I have 2 camel boxes with failover active mq(master-slave configuration). I tried with 2 active-active camel boxes and single acive-mq, works fine(once messages pushed in to the queue, any one of the camel can take it and process and the called camel will respond to the client at the end of processing). but this is not happening while I am using failover to connect activeMQ. If you have any proposal please share -- View this message in context: http://camel.465427.n5.nabble.com/HA-of-Camel-tp5750419.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Out of Memory For huge Json Response
Holy moses! A 1 gig JSON doc? Isn't that a criminal offense somewhere? Seriously though, you are hitting a JVM issue more than a camel one. I would see if I could brew up something to shatter the document and have it streamed in and read it piecemeal. You need something like SAX but for JSON. My thinking takes me towards using the Jackson JSON parser in a stream mode. I googled jackson stream large document and got some promising hits. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 http://www.linkedin.com/pub/robert-simmons/40/852/a39* On Sun, Apr 20, 2014 at 8:49 PM, Willem Jiang willem.ji...@gmail.comwrote: Can I have a look at your camel route? camel-http is using the stream by default and it can spool big streams to files. I guess there could be something wrong after you get the response from the RSET service, So I need to know more detail about your camel route. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On April 18, 2014 at 11:02:51 PM, Karthik.Pothuru ( karthik.poth...@target.com) wrote: Dear Team, We are facing Out of memory issue when receiving a huge json response (around 1 GB ) when hitting a REST webservice with in Target Enterprise. We are currently using camel Http component . Due to huge file, the entire data gets loaded into HEAP and the process is failing due to that. Our requirement is to read this response and store it into a file which will later be parsed for further data processing. Due to this issue, we are unable to go the next step of parsing. The same code works fine when small volume of data is received through the API. (at present we remember processing a response size of 150 MB and it was successful). Kindly need your input how to read response with lesser memory foot print. Thanks Karthik Pothuru Mob: +91 91766 97533
Re: HA of Camel
You can also do some clustering at Camel level http://www.ofbizian.com/2014/01/masterslave-failover-for-camel-routes.html Regards, On 23 April 2014 07:58, kraythe . kray...@gmail.com wrote: This isn't so much of a camel question but an ActiveMQ and platform question. Camel doesn't implement things like clustering and failover. That is outside the scope of the camel framework. Something like asking a Coffee table what it does to facilitate keeping water out of the basement. Typically you would resolve those questions outside and then deploy camel on the solutions. As for the solutions, there are many. Application servers clustered with camel running as WAR files. Clustered activemq with camel routes in the lib path. Fabric8 and Fuse or just vanilla Karaf and service mix. Choose your platform and tech stack. Then deploy camel on it. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 http://www.linkedin.com/pub/robert-simmons/40/852/a39* On Tue, Apr 22, 2014 at 1:10 AM, vinod vinod.geo...@tecnotree.com wrote: Hi All, Please help me on the below scenarios: What are the possible ways to scale up camel as active-active mode with Active-MQ clustered(Maser Slave). ( I have 2 camel boxes with failover active mq(master-slave configuration). I tried with 2 active-active camel boxes and single acive-mq, works fine(once messages pushed in to the queue, any one of the camel can take it and process and the called camel will respond to the client at the end of processing). but this is not happening while I am using failover to connect activeMQ. If you have any proposal please share -- View this message in context: http://camel.465427.n5.nabble.com/HA-of-Camel-tp5750419.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Bilgin Ibryam Apache Camel Apache OFBiz committer Blog: ofbizian.com Twitter: @bibryam https://twitter.com/bibryam Author of Instant Apache Camel Message Routing http://www.amazon.com/dp/1783283475
Re: Custom Properties Placeholder Implementations?
Hi Yeah for spring xml I would look into either using the spring's bridge property placeholder, and then implement your database lookup as if it was a pure spring problem, and how to integrate that with spring's property placeholder magic. An alternative is the Camel way and implement a custom org.apache.camel.component.properties.PropertiesResolver and have it extend the default resolver, if you need the regular ones as well, eg to load .properties files from classpath/file etc. And then define a bean id=properties class=org.apache.camel.component.properties.PropertiesComponent and configure it to use your custom resolver class. Though I would like to make that even easier so you would just define your custom bean for the resolver, and have Camel's properties component auto lookup and use yours as well out of the box. Like we can do for: https://camel.apache.org/advanced-configuration-of-camelcontext-using-spring.html And we have a few JIRA tickets already logged to improve the Camel's properties component. On Wed, Apr 23, 2014 at 8:51 AM, kraythe . kray...@gmail.com wrote: Greetings, I am currently using java DSL and have been investigating Fuse and Fabric8 as possible alternatives. Currently I have a route that does something like the following: final String cron = this.config.automationCasesDBMonitorCron().replaceAll( , +); final String quartzURI = quartz://case_automation/processAutomationCasesFromDB?cron= + cron; fromStandard(quartzURI) .routeId(ROUTE_ID_ETL_MONITOR_TIMER) // timer trigger .transacted(TxnHelper.KEY_TXNPOLICY_REQUIRED) // make the route transacted .to(InOnly, endpointAMQ(this.config.queueETLCheckEvent())); // put an event to be consumed As you can see, I fetch the names of queues and cron trigger configs from a configuration object. The actual config class goes to a database to get the configuration but that is not relevant to the question. The question is how can I implement something like this inside the spring DSL (which I am admittedly unfamiliar with). Currently I am trying to cross code my routes and for this one I have the following: camelContext xmlns=http://camel.apache.org/schema/spring; route id=ETLMonitorTimer from uri=quartz://case_automation/processAutomationCasesFromDB?cron=/ transacted ref=REQUIRED/ to uri=activemq:queue:/ /route /camelContext As you can see I don't have the cron trigger or the destination queue that I get normally from the config file so I am at a bit of a loss as to how to accomplish this. I was thinking with a property placeholder i could do something like this: bean id=configBean class=com.foo.ConfigMgr/ camelContext xmlns=http://camel.apache.org/schema/spring; propertyPlaceholder ref=configBean/ route id=ETLMonitorTimer from uri=quartz://case_automation/processAutomationCasesFromDB?cron={{etl_monitor_cron}}/ transacted ref=REQUIRED/ to uri=activemq:queue:{{event_queue}}/ /route /camelContext But I may be way off base on how to do that. I confess I have always thought the Spring XML DSL to be much less flexible and powerful than the Java DSL but I am open to being proven wrong. :) So any help here? Thanks a bunch. *Robert Simmons Jr. MSc. - Lead Java Architect @ EA* *Author of: Hardcore Java (2003) and Maintainable Java (2012)* *LinkedIn: **http://www.linkedin.com/pub/robert-simmons/40/852/a39 http://www.linkedin.com/pub/robert-simmons/40/852/a39* -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: Aggregate Error
sorucecode.txt http://camel.465427.n5.nabble.com/file/n5750462/sorucecode.txt I have attached the source code. Please reply me. The error message Stacktrace --- org.apache.camel.TypeConversionException: Error during type conversion from type: java.lang.String to the required type: java.lang.Integer with value due java.lang.NumberFormatException: For input string: -- View this message in context: http://camel.465427.n5.nabble.com/Aggregate-Error-tp5750428p5750462.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Split XML with xmlTokenizer and add root element?
On Fri, Apr 18, 2014 at 9:11 AM, cgiera christoph.gi...@mic-cust.com wrote: Hi all, should we create a camel jira issue for this? Yeah fell free to log a JIRA ticket. And as always contributions is welcome http://camel.apache.org/contributing kind regards, Christoph -- View this message in context: http://camel.465427.n5.nabble.com/Split-XML-with-xmlTokenizer-and-add-root-element-tp5750237p5750360.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: Camel transaction handler forces reconnecting to ActiveMQ
Hi See this page about using connection pooling http://camel.apache.org/activemq On Tue, Apr 15, 2014 at 10:25 PM, nqbeel a.nabeelaha...@gmail.com wrote: Also I did see that when I remove failover from the Broker URL it seems to be working fine. Currently its set to broker.url=failover:(ssl://server:61617)?maxReconnectDelay=6 Is there anything that needs to be changed to accommodate failover? -- View this message in context: http://camel.465427.n5.nabble.com/Camel-transaction-handler-forces-reconnecting-to-ActiveMQ-tp5750224p5750267.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: CouchDB Attachment
On Sat, Apr 12, 2014 at 10:47 AM, gutsal.arsen gutsal.ar...@softsky.com.ua wrote: From what I see they does not support saving attachments. They consider body is JSON string. I think camel-couchdb component should be patched and if in.body of type of GenericFile or InputStream is recognized, attachment should be saved. Sounds like a good idea for the file / generic file part. Not sure about input stream, as that can be a regular body in json format too. Fell free to log a JIRA ticket http://camel.apache.org/contributing -- View this message in context: http://camel.465427.n5.nabble.com/CouchDB-Attachment-tp572p5750141.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: Split XML with xmlTokenizer and add root element?
hi, I just filed CAMEL-7388 and committed the change. (only in master at the moment) This enclosing/wrapping mode gets enabled with the inheritNamespaceToken property is set to *. One might say, I am misusing the inheritNamespaceToken property to provide this extra option. But this actually fits nicely, as this property will become useless under the root enclosing/wrapping mode and so using this property name to configure this mode is a benefit of not needing to introduce another property that can semantically conflict with the inheritNamespaceToken property. Let me know if you dislike this configuration option. thanks regards, aki 2014-04-23 9:34 GMT+02:00 Claus Ibsen claus.ib...@gmail.com: On Fri, Apr 18, 2014 at 9:11 AM, cgiera christoph.gi...@mic-cust.com wrote: Hi all, should we create a camel jira issue for this? Yeah fell free to log a JIRA ticket. And as always contributions is welcome http://camel.apache.org/contributing kind regards, Christoph -- View this message in context: http://camel.465427.n5.nabble.com/Split-XML-with-xmlTokenizer-and-add-root-element-tp5750237p5750360.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: ApplicationContextRegistry and JndiRegistry
Temporary workaround for you would be usage of spring-jee namespace. With code shown below you just set ref=testJNDI and you don't need any extra Java code. jee:jndi-lookup id=testJNDI jndi-name=app/TestJNDI expected-type=com.ge.camel.jndi.TestJNDI / Kind regards, Łukasz Dywicki -- l...@code-house.org Twitter: ldywicki Blog: http://dywicki.pl Code-House - http://code-house.org Wiadomość napisana przez Claus Ibsen claus.ib...@gmail.com w dniu 23 kwi 2014, o godz. 09:32: Hi Camel's registry is a facade for an actual registry such as - jndi - spring's app context - osgi service registry So the spring stuff is only registered in spring's own app context (eg that is how spring works). So you cannot use jndi to lookup stuff that are in spring's app context. But you can create a composite registry in Camel that lookup in jndi and then spring afterwards. But to do that you would need to write some java code to setup that, etc. Not as easy and clean to do. On Tue, Apr 22, 2014 at 3:36 PM, Jacinto, Alex (GE Energy Management) alex.jaci...@ge.com wrote: Is there a way I can make the two work? What happens is that when I do ApplicationContextRegistry but wants to access through jndi it won’t work, if I do the JndiRegistry, it would not resolve all my routeContextRef. My camel-context looks like: routeContext id=“template xmlns=http://camel.apache.org/schema/spring; route from uri=“vm:from / bean ref=“java:app/TestJndi/ to uri=“vm:to / /route /routeContext camelContext id=“id xmlns=http://camel.apache.org/schema/spring; routeContextRef ref=“template / /camelContext I would like to use camel simply for routing then use my beans for transformation. Am I going at this the wrong way? Let me know. Thanks in advance. Alex -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: Split XML with xmlTokenizer and add root element?
as it seems the corresponding source files have not been linked to the jira ticket, you can find examples/test cases at: https://git-wip-us.apache.org/repos/asf?p=camel.git;a=tree;f=camel-core/src/test/java/org/apache/camel/language/tokenizer;h=72c5debe203cc31f7cd0a7e369c162b721c7308d;hb=01d587525f937b3135791f1c1d100909b245382a camel-core/src/test/java/org/apache/camel/language/tokenizer/TokenizeWrapLanguageTest.java 2014-04-23 10:25 GMT+02:00 Aki Yoshida elak...@gmail.com: hi, I just filed CAMEL-7388 and committed the change. (only in master at the moment) This enclosing/wrapping mode gets enabled with the inheritNamespaceToken property is set to *. One might say, I am misusing the inheritNamespaceToken property to provide this extra option. But this actually fits nicely, as this property will become useless under the root enclosing/wrapping mode and so using this property name to configure this mode is a benefit of not needing to introduce another property that can semantically conflict with the inheritNamespaceToken property. Let me know if you dislike this configuration option. thanks regards, aki 2014-04-23 9:34 GMT+02:00 Claus Ibsen claus.ib...@gmail.com: On Fri, Apr 18, 2014 at 9:11 AM, cgiera christoph.gi...@mic-cust.com wrote: Hi all, should we create a camel jira issue for this? Yeah fell free to log a JIRA ticket. And as always contributions is welcome http://camel.apache.org/contributing kind regards, Christoph -- View this message in context: http://camel.465427.n5.nabble.com/Split-XML-with-xmlTokenizer-and-add-root-element-tp5750237p5750360.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Logging in servlet example
Hi, I'm using the servlet example from camel 2.12 with Tomcat 7. It works fine, but I can't get logging to work. Neither log message=something or to uri=log:something/ turn up in catalina.out or the log file. I assume it's something about log4j but it's proving hard to find. Any ideas? -- View this message in context: http://camel.465427.n5.nabble.com/Logging-in-servlet-example-tp5750476.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Logging in servlet example
On Wed, Apr 23, 2014 at 10:49 AM, Mark Lawson ma...@emconnect.com wrote: Hi, I'm using the servlet example from camel 2.12 with Tomcat 7. It works fine, but I can't get logging to work. Neither log message=something or to uri=log:something/ turn up in catalina.out or the log file. I assume it's something about log4j but it's proving hard to find. Any ideas? There is a log4j.properties in the WAR file you need to adjust for logging. Or some way remove log4j and whatnot from the WAR and use tomcat logging. Though that is a general WAR in Tomcat problem. How to use a central log configuration file. You can likely search the web for answers about that. -- View this message in context: http://camel.465427.n5.nabble.com/Logging-in-servlet-example-tp5750476.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
How to make an oauth 1.0 request the Camel way ?
Hi, I already have an access token and shared secret. To make an oauth request, I could manually set all the appropriate http headers. I am wondering if it could be done more elegantly using a Camel component. Thanks in advance for any assistance ! Shing
Re: Logging in servlet example
Hello Mark Camel uses SLF4J as logging framework and you can use any compatible logging implementation (log4j, logback, ...). For one stop shop solution for Tomcat check my project: https://github.com/grgrzybek/tomcat-slf4j-logback With correct ZIP archive available here: https://sourceforge.net/projects/tc-slf4jlogback/files/ you can configure Tomcat to use SLF4J+Logback and the instructions will help you configure your Web application to use separate logging configuration. regards Grzegorz Grzybek 2014-04-23 10:49 GMT+02:00 Mark Lawson ma...@emconnect.com: Hi, I'm using the servlet example from camel 2.12 with Tomcat 7. It works fine, but I can't get logging to work. Neither log message=something or to uri=log:something/ turn up in catalina.out or the log file. I assume it's something about log4j but it's proving hard to find. Any ideas? -- View this message in context: http://camel.465427.n5.nabble.com/Logging-in-servlet-example-tp5750476.html Sent from the Camel - Users mailing list archive at Nabble.com.
camel file moving after process to default .camel or .done,
when i'm not use noop=true, the file moving default folders .camel but my execution going continusely also delete=true geeting same problem pls help me... camel:route id=employeeDBServiceCall camel:from uri=file:D:/CAMELCXFRDWORKSPACE/CXF_BOOK_EXAMPLES/EmployeeDBWebServiceCall/input?delay=2000amp;delete=true/ camel:to uri=file:D:/CAMELCXFRDWORKSPACE/CXF_BOOK_EXAMPLES/EmployeeDBWebServiceCall/csvfile/ camel:process ref=fileProcess/ /camel:route *FileProcessors.java* public class FileProcessors implements Processor { @Override public void process(Exchange exchange) throws Exception { // TODO Auto-generated method stub File file = exchange.getIn().getBody(File.class); System.out.println(CVS FILE NAME : +file); MessageFactory factory; SOAPMessage soapMsg; SOAPPart part = null; SOAPEnvelope envelope; SOAPHeader header ; SOAPBody body ; SOAPBodyElement element ; try{ BufferedReader br = null; String line = ; String cvsSplitBy = ,; br = new BufferedReader(new FileReader(file)); while ((line = br.readLine()) != null) { String[] record = line.split(cvsSplitBy); factory = MessageFactory.newInstance(); soapMsg = factory.createMessage(); part = soapMsg.getSOAPPart(); String serverURI = http://employee.contract.example.org/;; envelope = part.getEnvelope(); envelope.addNamespaceDeclaration(emp, serverURI); header = envelope.getHeader(); body = envelope.getBody(); element = body.addBodyElement(envelope.createQName(addEmployee,emp)); SOAPElement soapElement= element.addChildElement(arg0); soapElement.addChildElement(EmployeeId).addTextNode(record[0]); soapElement.addChildElement(LastName).addTextNode(record[1]); soapElement.addChildElement(FirstName).addTextNode(record[2]); soapElement.addChildElement(Gender).addTextNode(record[3]); soapElement.addChildElement(DepartmentId).addTextNode(record[4]); soapElement.addChildElement(Hiredate).addTextNode(record[5]); soapElement.addChildElement(Salary).addTextNode(record[6]); System.out.println(SOAP msg created); Date date=Calendar.getInstance().getTime(); FileOutputStream fOut = new FileOutputStream(D:/CAMELCXFRDWORKSPACE/CXF_BOOK_EXAMPLES/EmployeeDBWebserviceCall/SOAPReqMsgs/SoapReqMessage+date.getTime()+.xml); soapMsg.writeTo(fOut); Thread.sleep(3000); } }catch(Exception e){ e.printStackTrace(); } } } *output* CVS FILE NAME : D:\CAMELCXFRDWORKSPACE\CXF_BOOK_EXAMPLES\EmployeeDBWebServiceCall\input\CamelTest.csv SOAP msg created SOAP msg created CVS FILE NAME : D:\CAMELCXFRDWORKSPACE\CXF_BOOK_EXAMPLES\EmployeeDBWebServiceCall\input\CamelTest.csv SOAP msg created SOAP msg created CVS FILE NAME : D:\CAMELCXFRDWORKSPACE\CXF_BOOK_EXAMPLES\EmployeeDBWebServiceCall\input\CamelTest.csv SOAP msg created SOAP msg created CVS FILE NAME : D:\CAMELCXFRDWORKSPACE\CXF_BOOK_EXAMPLES\EmployeeDBWebServiceCall\input\CamelTest.csv SOAP msg created SOAP msg created CVS FILE NAME : D:\CAMELCXFRDWORKSPACE\CXF_BOOK_EXAMPLES\EmployeeDBWebServiceCall\input\CamelTest.csv SOAP msg created SOAP msg created CVS FILE NAME : D:\CAMELCXFRDWORKSPACE\CXF_BOOK_EXAMPLES\EmployeeDBWebServiceCall\input\CamelTest.csv SOAP msg created SOAP msg created.. -- View this message in context: http://camel.465427.n5.nabble.com/camel-file-moving-after-process-to-default-camel-or-done-tp5750482.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Logging in servlet example
Got it to work by defining the logger as a Bean using http://stackoverflow.com/a/13160573/2625368 bean id=myLogger class=org.apache.log4j.Logger factory-method=getLogger constructor-arg value=servlet-example/ /bean and in my route to uri=bean:myLogger?method=info / -- View this message in context: http://camel.465427.n5.nabble.com/Logging-in-servlet-example-tp5750476p5750483.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: cxf how to add wsa addressing with cxf://someAddress[?options] uri format?
I forgot to mention that the wsa addressing headers only cause problems when the attribute mustUnderstand=1 is set. -- View this message in context: http://camel.465427.n5.nabble.com/cxf-how-to-add-wsa-addressing-with-cxf-someAddress-options-uri-format-tp5750440p5750484.html Sent from the Camel - Users mailing list archive at Nabble.com.
Need to write correct Spring XML DSL
Hi All, I am new to Apache Camel. What I need to know is how to write SPRING XML DSL to accomplish particular task. Here is small description of my task below - I need to read a supplied file containing delimited line of text and process the file by different processor previously defined. This processor would be selected on the basis of file content. For. e.g. the file contains - userid=1~pass=jayanta~oprncode=REPT~custno=499001~ Here we can find the value of oprncode is 'REPT'. Depending on this value we need route it to different processor for processing the file data. For this what should I write in XML DSL file ? Thanks in advance. Jayanta P. -- View this message in context: http://camel.465427.n5.nabble.com/Need-to-write-correct-Spring-XML-DSL-tp5750485.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: ApplicationContextRegistry and JndiRegistry
Thanks for the suggestion Willem, I’ll look at the link. With this setup, I would have one context that uses the JNDI and another context that uses the spring and uses the context that has the jndi. I’ll give it a try, thank you. On 4/22/14, 10:32 PM, Willem Jiang willem.ji...@gmail.com wrote: Current camel doesn’t share the Spring ApplicationContextRegistry with the JndiRegistry. But I think you can workaround it by using camel context component[1] which can hold a camel context as a new component. [1]http://camel.apache.org/context.html -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On April 22, 2014 at 9:37:31 PM, Jacinto, Alex (GE Energy Management) (alex.jaci...@ge.com) wrote: Is there a way I can make the two work? What happens is that when I do ApplicationContextRegistry but wants to access through jndi it won’t work, if I do the JndiRegistry, it would not resolve all my routeContextRef. My camel-context looks like: I would like to use camel simply for routing then use my beans for transformation. Am I going at this the wrong way? Let me know. Thanks in advance. Alex
Re: ApplicationContextRegistry and JndiRegistry
Hi Claus, thanks for the response. I was not trying to lookup spring stuff through jndi, I was trying to have access both worlds - spring beans and my container beans (jndi). I might be mixing both worlds but I really just want the spring DSL plus the camel routing. To further explain, what our plan is to put placeholders on uri routes including where the jndis should go. This way, we don¹t touch our xml file, we simply create our transformation and put it in our properties files and off it goes. I did look at creating what you mentioned, it looks like it easy enough to say: hey, your look up starts with ³java:² then it would be JNDI. But I couldn¹t figure out where the spring applicationcontext would be injected, is that available through the spring dsl? I was looking for something like: bean id=registry class=org.apache.camel.impl.JndiRegistry² constructor-arg Š./ /bean Your book rocks btw, really helpful. Thank you again. On 4/23/14, 3:32 AM, Claus Ibsen claus.ib...@gmail.com wrote: Hi Camel's registry is a facade for an actual registry such as - jndi - spring's app context - osgi service registry So the spring stuff is only registered in spring's own app context (eg that is how spring works). So you cannot use jndi to lookup stuff that are in spring's app context. But you can create a composite registry in Camel that lookup in jndi and then spring afterwards. But to do that you would need to write some java code to setup that, etc. Not as easy and clean to do. On Tue, Apr 22, 2014 at 3:36 PM, Jacinto, Alex (GE Energy Management) alex.jaci...@ge.com wrote: Is there a way I can make the two work? What happens is that when I do ApplicationContextRegistry but wants to access through jndi it won¹t work, if I do the JndiRegistry, it would not resolve all my routeContextRef. My camel-context looks like: routeContext id=³template xmlns=http://camel.apache.org/schema/spring; route from uri=³vm:from / bean ref=³java:app/TestJndi/ to uri=³vm:to / /route /routeContext camelContext id=³id xmlns=http://camel.apache.org/schema/spring; routeContextRef ref=³template / /camelContext I would like to use camel simply for routing then use my beans for transformation. Am I going at this the wrong way? Let me know. Thanks in advance. Alex -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: ApplicationContextRegistry and JndiRegistry
Thanks Luke, I'll try this solution. On 4/23/14, 4:38 AM, Łukasz Dywicki l...@code-house.org wrote: Temporary workaround for you would be usage of spring-jee namespace. With code shown below you just set ref=testJNDI and you don't need any extra Java code. jee:jndi-lookup id=testJNDI jndi-name=app/TestJNDI expected-type=com.ge.camel.jndi.TestJNDI / Kind regards, Łukasz Dywicki -- l...@code-house.org Twitter: ldywicki Blog: http://dywicki.pl Code-House - http://code-house.org Wiadomość napisana przez Claus Ibsen claus.ib...@gmail.com w dniu 23 kwi 2014, o godz. 09:32: Hi Camel's registry is a facade for an actual registry such as - jndi - spring's app context - osgi service registry So the spring stuff is only registered in spring's own app context (eg that is how spring works). So you cannot use jndi to lookup stuff that are in spring's app context. But you can create a composite registry in Camel that lookup in jndi and then spring afterwards. But to do that you would need to write some java code to setup that, etc. Not as easy and clean to do. On Tue, Apr 22, 2014 at 3:36 PM, Jacinto, Alex (GE Energy Management) alex.jaci...@ge.com wrote: Is there a way I can make the two work? What happens is that when I do ApplicationContextRegistry but wants to access through jndi it won't work, if I do the JndiRegistry, it would not resolve all my routeContextRef. My camel-context looks like: routeContext id=template xmlns=http://camel.apache.org/schema/spring; route from uri=vm:from / bean ref=java:app/TestJndi/ to uri=vm:to / /route /routeContext camelContext id=id xmlns=http://camel.apache.org/schema/spring; routeContextRef ref=template / /camelContext I would like to use camel simply for routing then use my beans for transformation. Am I going at this the wrong way? Let me know. Thanks in advance. Alex -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
how do I check conditions in XML DSL
I have a CSV file which contain following data: value1=A,value1=B My requirement is that : if value1=A then go to fileA if value1=B then go to fileB I want to do this using XML DSL. I am attaching here with my code snippet,by which I can not check the conditions by using xpath. How do I write this xpath expression in Camel? Any help is greatly appreciated. Thanks in advance! routeContext id=actionRoutes xmlns=http://camel.apache.org/schema/spring; route id=route1 from uri=file:E:\\bankappfiles\\received?delete=true / log message=Title Name [${body}]/ split stopOnException=true tokenize token=,/ choice when xpath resultType=java.lang.String/value1/xpath /when /choice /split process ref=fileProcessor / /route /routeContext -- View this message in context: http://camel.465427.n5.nabble.com/how-do-I-check-conditions-in-XML-DSL-tp5750490.html Sent from the Camel - Users mailing list archive at Nabble.com.
visualization
Is there an alternative to camel:dot that could render the routes in a diagram and generate docs? Thanks Rakesh -- View this message in context: http://camel.465427.n5.nabble.com/visualization-tp5750486.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: visualization
On Wed, Apr 23, 2014 at 1:52 PM, ayilliath ayilli...@gmail.com wrote: Is there an alternative to camel:dot that could render the routes in a diagram and generate docs? Yeah the hawtio project does that to visualize Camel routes at runtime. http://hawt.io/ And Fuse IDE as a java editor can visualize XML routes using graphic eip diagrams. http://tools.jboss.org/features/apachecamel.html Thanks Rakesh -- View this message in context: http://camel.465427.n5.nabble.com/visualization-tp5750486.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: [Camel-Cxf] Camel Exchange not returned when SocketTimeoutException happens
Thanks Willem, I was able to upgrade to 2.12.X branch and I still have the same problem (when a SocketTimeoutException happens, the routing of the message stops as it would have died). I'm going to upgrade to 2.13.0 now to check it again. I have been testing more and I have found out that if I use exactly the same route but the service to consume is not httpS, and I make a SocketTimeoutException happen there is no problem. However, when I use a service with SSL there is. (Maybe because of this, the unit test that you updated the other day worked) I'll inform you as soon as I test this with 2.13.0 release. Thanks in advance. KR, Aida. Willem.Jiang wrote You can register the executeOperationsBatchExecutorService after camel context is started. Or you can register a custom ManagementLifecycleStrategy to manage the lifecycle of your ExecutorService. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On April 22, 2014 at 11:11:24 PM, Aida ( ai.desu@ ) wrote: Hi Willem, Thank you very much for your response. I'm trying to * upgrade my version of Camel to 2.13.0 in order to check if I have the same problem in the last release * , as you told me, but I found an obstacle. From Apache Camel 2.12.0, the ManagementStrategyFactory (that initializes the DefaultManagementAgent of the CamelContext) doesn´t initialize the ManagementStrategy service. Before 2.12.0 (line 37 aprox): ... try { answer = new ManagedManagementStrategy(context, new DefaultManagementAgent(context)); // must start it to ensure JMX works and can load needed Spring JARs ServiceHelper.startService(answer); // prefer to have it at first strategy context.getLifecycleStrategies().add(0, new DefaultManagementLifecycleStrategy(context)); log.info(JMX enabled.); } catch (Exception e) { ... And from 2.12.0 (line 37 aprox): .. try { answer = new ManagedManagementStrategy(context, new DefaultManagementAgent(context)); // must add management lifecycle strategy context.getLifecycleStrategies().add(0, new DefaultManagementLifecycleStrategy(context)); } catch (Exception e) { ... My problem is that I'm registering MBeans on my configureRoute() methods, in order to register the ExecutorService(s) used in my RouteBuilders: @Override public void configureRoute() { //Threadpool executor with the default pool size ThreadPoolExecutorWrapper executeOperationsBatchExecutorService = new ThreadPoolExecutorWrapper(ROUTE_NAME); try { getContext().getManagementStrategy().getManagementAgent().register(executeOperationsBatchExecutorService, executeOperationsBatchExecutorService.getMBeanName()); } catch (JMException e) { throw new RuntimeCamelException(It was impossible to register the MBean with name: + executeOperationsBatchExecutorService.getMBeanName().getCanonicalName(), e); } ... } As from 2.12.0 the service is not started, in the DefaultManagementAgent, the MBeanServer is null, so a NullpointerException is thrown (and I cannot test my issue with Apache Camel 2.13.0). I have tried with the configurations described in [1] (configuring a jmxAgent with Spring) to see if this way the initialization happened before but with no luck. For JUnit tests (where a nullpointerException is also launched) if i set useJmx() returning true and I force the initialization of the agent like this: context.getManagementStrategy().getManagementAgent().start(); It works fine, but I'm not able to solve it in a real environment. Any help with this would be really appreciated, so I can test this scenary with the last Camel version to see if I can reproduce it. Thanks in advance, KR, Aida. [1] http://camel.apache.org/camel-jmx.html Willem.Jiang wrote I just wrote a simple test[1] in camel trunk(camel-2.14-SNAPSHOT) to reproduce the error. But I cannot reproduce the error. Can you * * try to use last released camel-2.13.0 for verification * * ? [1]https://git-wip-us.apache.org/repos/asf?p=camel.git;a=commit;h=fdc3b321 -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On April 22, 2014 at 12:26:07 AM, Aida ( ai.desu@ ) wrote: Hi, I'm working with the cxf component in order to consume from JAX-WS services, and everything works like a charm, but I'm * having trouble when a * * SocketTimeoutException happens. In this case, I have no Camel Exchange * * coming back from the endpoint * . Example: from(startEndpoint) .doTry() .to(cxfEndpoint) .doCatch(Throwable.class) .log(Hey, an exception happened) .bean(myExceptionHandler) .end(); When a Exception that is
Using consumer.bridgeErrorHandler won't allow onException() route to execute completely.
Hello, We are using consumer.bridgeErrorHandler=true in our route, so that if there's an exception during picking up of files, the Camel Error Handler can deal with it. It appears from the documentation and code snippet at: http://camel.apache.org/file2.html (Using consumer.bridgeErrorHandler section) that if there's an error picking up files, the onException clause will be invoked and will continue to execute the .to(mock:error) clause. However, in our case, the onException clause is invoked, however the .to clause isn't. Here's how our code looks like: onException(SomeException.class).process(new Processor() { @Override public void process(Exchange exchange) { //Do some logging, processing etc. } }).to(direct:sendEmail); So, in the above code the .to(direct:sendEmail) part is never invoked. While I was debugging this, I found out that in BridgeExceptionHandlerToErrorHandler.java#handleException(String message, Exchange exchange, Throwable exception), Exchange.REDELIVERY_EXHAUSTED is set to true on Exchange: // and mark as redelivery exhausted as we cannot do redeliveries exchange.setProperty(Exchange.REDELIVERY_EXHAUSTED, Boolean.TRUE); This causes this exchange to get marked as exhausted in RedeliveryErrorHandler.java#processErrorHandler(final Exchange exchange, final AsyncCallback callback, final RedeliveryData data) and the .to(direct:sendEmail) part of the route is never processed. This isn't compliant with the documentation. So, the question is: do we need to set another property on the route to execute the complete route? Currently, we are just removing Exchange.REDELIVERY_EXHAUSTED from the exchange in our onException clause onException(SomeException.class).process(new Processor() { @Override public void process(Exchange exchange) { exchange.getProperties().remove(Exchange.REDELIVERY_EXHAUSTED); } }).to(direct:sendEmail); -- View this message in context: http://camel.465427.n5.nabble.com/Using-consumer-bridgeErrorHandler-won-t-allow-onException-route-to-execute-completely-tp5750507.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Basic direct-vm scenario produces error
Thanks, Raul, it was a naming error. On 4/21/14, 5:18 PM, Raul Kripalani wrote: Check the endpoint URIs on the producer and consumer side. There seems to be a mismatch - perhaps it's a copy paste error? On 22 Apr 2014 00:50, John Dubchak j...@johndubchak.com wrote: Hi, I am trying to route a JMS message using an xpath expression. The expression and message conversion seem to work fine but I am getting an error that one of the direct-vm endpoints are not found. Here is the structure of the router: DataFormat jaxb = new JaxbDataFormat(...); from(getInboundReceiver()) .unmarshal(jaxb) .choice() .when(xpath(eventTypeOf(abc:inbound:file-receive))) .log(Dispatching event ${id} to receive handler) .to(direct-vm:abc_InboundFileReceive) .endChoice() .when(xpath(eventTypeOf(abc:inbound:file-validate))) .log(Dispatching event ${id} to validation handler) .to(direct-vm:abc_InboundFileValidate) .endChoice() .when(xpath(eventTypeOf(abc:inbound:file-process))) .log(Dispatching event ${id} to processing handler) .process(applyProcessor) .to(direct-vm:abc_InboundFileProcess) .endChoice() .otherwise() .log(Processing ${id} did not match expressions.); In the abc_InboundFileValidate route I have: from(direct-vm:cdw_InboundFileValidate) However, I have this error in the log file: DefaultErrorHandler | 108 - org.apache.camel.camel-core - 2.12.3 | Failed delivery for (MessageId: queue_abc.events_ID_host_name-65483-1398122729446-4_1_-1_1_1 on ExchangeId: ID-host_name-65482-1398122729423-2-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.component.directvm. DirectVmConsumerNotAvailableException: No consumers available on endpoint: Endpoint[direct-vm://abc_InboundFileValidate]. Exchange[JmsMessage[JmsMessageID: ID:host_name-65483- 1398122729446-4:1:-1:1:1]] I know I'm probably doing something incorrectly, but I can't seem to figure it out. Any help is appreciated. Thanks, John
Failing to load converters
Hi, We have a camel routes converts a JSONObject (jettison JSON) to String using the method convertBodyTo(String.class). However we see that there is an exception which comes and just fails to continue with the route. Following is the exception Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.codehaus.jettison.json.JSONObject to the required type: java.lang.String with value {supplyItem_GTIN:24. [INFO] [talledLocalContainer] at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:147) [INFO] [talledLocalContainer] at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100) This issue occurs intermittenttly. It looks like the camel is unable to load the default converters. Thanks, Preethi -- View this message in context: http://camel.465427.n5.nabble.com/Failing-to-load-converters-tp5750509.html Sent from the Camel - Users mailing list archive at Nabble.com.
RE: how do I check conditions in XML DSL
Does your file has only one line with csv seperated values ? Do you want whole file to be transferred to the other directory based on logic ? What if two conditions are satisfied on one line ? value1=A and value2=B . Here is the example you can start with ... you can use more features of simple language to build your condition. route from uri=file://csvfile / split stopOnException=true tokenize token=,/ choice when simple ${in.body} == 'value1=A'/simple to uri=file://csvfileoutA / /when when simple ${in.body} == 'B'/simple to uri=file://csvfileoutB / /when otherwise to uri=file://csvfileoutOther / /otherwise /choice /split to uri=file://csvfileout / - Ravi From: AINDRILA ACHARYA [aindril...@issac.in] Sent: Wednesday, April 23, 2014 6:22 PM To: users@camel.apache.org Subject: how do I check conditions in XML DSL I have a CSV file which contain following data: value1=A,value1=B My requirement is that : if value1=A then go to fileA if value1=B then go to fileB I want to do this using XML DSL. I am attaching here with my code snippet,by which I can not check the conditions by using xpath. How do I write this xpath expression in Camel? Any help is greatly appreciated. Thanks in advance! routeContext id=actionRoutes xmlns=http://camel.apache.org/schema/spring; route id=route1 from uri=file:E:\\bankappfiles\\received?delete=true / log message=Title Name [${body}]/ split stopOnException=true tokenize token=,/ choice when xpath resultType=java.lang.String/value1/xpath /when /choice /split process ref=fileProcessor / /route /routeContext -- View this message in context: http://camel.465427.n5.nabble.com/how-do-I-check-conditions-in-XML-DSL-tp5750490.html Sent from the Camel - Users mailing list archive at Nabble.com. This e-mail and any files transmitted with it are for the sole use of the intended recipient(s) and may contain confidential and privileged information. If you are not the intended recipient(s), please reply to the sender and destroy all copies of the original message. Any unauthorized review, use, disclosure, dissemination, forwarding, printing or copying of this email, and/or any action taken in reliance on the contents of this e-mail is strictly prohibited and may be unlawful.
Re: Failing to load converters
Hi, Can you tell us more about when did you get this kind of issue? What’s your camel route look like? How did deploy the camel route? Did you run it as a stand alone Java Application or deploy it into some other container? -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On April 24, 2014 at 1:12:01 PM, Preethi (preethi.krishna...@gmail.com) wrote: Hi, We have a camel routes converts a JSONObject (jettison JSON) to String using the method convertBodyTo(String.class). However we see that there is an exception which comes and just fails to continue with the route. Following is the exception Caused by: org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type: org.codehaus.jettison.json.JSONObject to the required type: java.lang.String with value {supplyItem_GTIN:24. [INFO] [talledLocalContainer] at org.apache.camel.impl.converter.BaseTypeConverterRegistry.mandatoryConvertTo(BaseTypeConverterRegistry.java:147) [INFO] [talledLocalContainer] at org.apache.camel.impl.MessageSupport.getMandatoryBody(MessageSupport.java:100) This issue occurs intermittenttly. It looks like the camel is unable to load the default converters. Thanks, Preethi -- View this message in context: http://camel.465427.n5.nabble.com/Failing-to-load-converters-tp5750509.html Sent from the Camel - Users mailing list archive at Nabble.com.