concurrentConsumers, failIfNoConsumers confusion
Hi All; I am trying to implement a route that can process only one message at a time; the route should reject incoming messages if it is busy. To be clear, I do not want messages to be queued for processing, I want them to be rejected and discarded, preferably with an exception returned to the caller. It would seem that some combination of options on a seda endpoint should do the trick, however I am not able to achieve this functionality. Here is my test code, running on camel 2.16.3 in ServiceMix 6.1.2: from("seda:test-server?concurrentConsumers=1&failIfNoConsumers=true&multipleConsumers=false") .log("test server - got request...") .delay(15000) .log("test server - sending reply") .routeId("test-server"); from("direct-vm:test-client") .log("test client calling server") .to("seda:test-server?concurrentConsumers=1&failIfNoConsumers=true&multipleConsumers=false") .log("test client got reply") .routeId("test-client"); output from calling the "test-client" route 7 times in less than 10 seconds: 2017-03-24 15:09:03,756 | 126 - org.apache.camel.camel-core - 2.16.3 | test client calling server 2017-03-24 15:09:03,757 | 126 - org.apache.camel.camel-core - 2.16.3 | test client got reply 2017-03-24 15:09:03,757 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - got request... 2017-03-24 15:09:04,392 | 126 - org.apache.camel.camel-core - 2.16.3 | test client calling server 2017-03-24 15:09:04,393 | 126 - org.apache.camel.camel-core - 2.16.3 | test client got reply 2017-03-24 15:09:05,073 | 126 - org.apache.camel.camel-core - 2.16.3 | test client calling server 2017-03-24 15:09:05,074 | 126 - org.apache.camel.camel-core - 2.16.3 | test client got reply 2017-03-24 15:09:07,997 | 126 - org.apache.camel.camel-core - 2.16.3 | test client calling server 2017-03-24 15:09:07,998 | 126 - org.apache.camel.camel-core - 2.16.3 | test client got reply 2017-03-24 15:09:11,228 | 126 - org.apache.camel.camel-core - 2.16.3 | test client calling server 2017-03-24 15:09:11,229 | 126 - org.apache.camel.camel-core - 2.16.3 | test client got reply 2017-03-24 15:09:11,923 | 126 - org.apache.camel.camel-core - 2.16.3 | test client calling server 2017-03-24 15:09:11,924 | 126 - org.apache.camel.camel-core - 2.16.3 | test client got reply 2017-03-24 15:09:12,552 | 126 - org.apache.camel.camel-core - 2.16.3 | test client calling server 2017-03-24 15:09:12,552 | 126 - org.apache.camel.camel-core - 2.16.3 | test client got reply 2017-03-24 15:09:18,760 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - sending reply 2017-03-24 15:09:18,761 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - got request... 2017-03-24 15:09:33,762 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - sending reply 2017-03-24 15:09:33,763 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - got request... 2017-03-24 15:09:48,765 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - sending reply 2017-03-24 15:09:48,766 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - got request... 2017-03-24 15:10:03,767 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - sending reply 2017-03-24 15:10:03,768 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - got request... 2017-03-24 15:10:18,770 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - sending reply 2017-03-24 15:10:18,771 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - got request... 2017-03-24 15:10:33,772 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - sending reply 2017-03-24 15:10:33,773 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - got request... 2017-03-24 15:10:48,775 | 126 - org.apache.camel.camel-core - 2.16.3 | test server - sending reply I have tried just about every combination of options on both server and client, yet no joy. I know there are other ways to implement this e.g. activemq, database lock, thread pool? etc... however I would rather a cleaner solution, handled simply at the incoming endpoint - if that is indeed possible. -- View this message in context: http://camel.465427.n5.nabble.com/concurrentConsumers-failIfNoConsumers-confusion-tp5796061.html Sent from the Camel - Users mailing list archive at Nabble.com.
suppressing log output during testing
This is not a camel issue, thought I might try anyway... I'm using eclipse Luna and Camel 2.13.2 while running unit tests on my routes, the console log is inundated with debug info (not interesting unless debugging the tests themselves) which I would like to suppress such that all I get is logging from the test classes and the tested routes. For example, running one simple test with one assertion results in 2500 log lines in the console... almost all lines are like the following: org.ops4j.pax.logging.pax-logging-api[org.apache.aries.blueprint.container.ReferenceRecipe] : bla bla bla problem is that the lines I am interested in are also wrapped by pax: org.ops4j.pax.logging.pax-logging-api[MY-ROUTE-ID] : MF error code: 123 any help greatly appreciated! -- View this message in context: http://camel.465427.n5.nabble.com/suppressing-log-output-during-testing-tp5768378.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: castor unmarshal without mapping file
I decided to RTFM - looks like your answer is spot on: http://castor.codehaus.org/1.2/xml-mapping.html#2.2-Unmarshalling-Behavior > When Castor finds an element while unmarshalling a document, it will try > to use the mapping information to determine which object to instantiate. > If no mapping information is present, Castor will use the name of the > element to try to guess the name of a class to instantiate (for example, > for an element named 'test-element', Castor will try to instantiate a > class named 'TestElement' if no information is given in the mapping file). > Castor will then use the field information of the mapping file to handle > the content of the element. > > If the class is not described in the mapping file, Castor will instrospect > the class using the Java Reflection API to determine if there is any > function of the form getXxxYyy()/setXxxYyy( > > x). This accessor will be associated with XML element/attribute named > 'xxx-yyy'. In the future, we will provide a way to override this default > behavior. > > ... I was hoping to find a xml ORM that would do all this on the fly without need of mapping file and/or skeleton class; seems I am expecting too much, and anyway i'm not sure how desireable this is from a dev perspective. -- View this message in context: http://camel.465427.n5.nabble.com/castor-unmarshal-without-mapping-file-tp5765569p5765666.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: castor unmarshal without mapping file
I *think* I understand what you are saying - however does that not equate to a mapping file? I was hoping that castor would function without a mapping file and create a default class structure, for example based on the element/attribute names in the XML document. I am a complete castor newb, so feel free to dumb it down for me. A little sample would go a long way. How for example do I "specify the template class structure of which the object has to be created"? aloha -- View this message in context: http://camel.465427.n5.nabble.com/castor-unmarshal-without-mapping-file-tp5765569p5765665.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: blueprint + myBatis + transactions
Has anyone successfully used the mybatis component in a transaction? -- View this message in context: http://camel.465427.n5.nabble.com/blueprint-myBatis-transactions-tp5764629p5764668.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: blueprint + myBatis + transactions
Hi Willem; thanks for that - I will look into that. The documentation is clear on this, so if you are indeed right, the documentation needs to be corrected: http://camel.apache.org/mybatis.html wrote > A mybatis-spring SqlSessionFactoryBean then wraps that same DataSource: > class="org.mybatis.spring.SqlSessionFactoryBean"> > > > > > > value="classpath*:META-INF/mappers/**/*.xml"/> > > The camel-mybatis component is then configured with that factory: > class="org.apache.camel.component.mybatis.MyBatisComponent"> > > > -- View this message in context: http://camel.465427.n5.nabble.com/blueprint-myBatis-transactions-tp5764629p5764667.html Sent from the Camel - Users mailing list archive at Nabble.com.
blueprint + myBatis + transactions
Hi all; I am using ServiceMix 5.1.1 with its default Camel version 2.13.2; Mybatis-spring 1.2.2 I am trying to implement transactional DB access using MyBatis and blueprint. I have followed the directions in the camel documentation (http://camel.apache.org/mybatis.html). I'm stuck with the following error: java.lang.Exception: Unable to convert value org.mybatis.spring.SqlSessionFactoryBean to type org.apache.ibatis.session.SqlSessionFactory I realize that the documentation is using Spring as configuration - has anyone gotten this to work in Blueprint? -- View this message in context: http://camel.465427.n5.nabble.com/blueprint-myBatis-transactions-tp5764629.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: onException convertions to soapFault
you can use setFaultBody: ${body} here is a simple velocity script to create the fault document: http://schemas.xmlsoap.org/soap/envelope/";> $exchange.EXCEPTION_CAUGHT $exchange.getExchangeId() -- View this message in context: http://camel.465427.n5.nabble.com/onException-convertions-to-soapFault-tp5742775p5742797.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Passing parameters to a direct / seda / vm endpoint
right now we have access to the CamelToEndpoint exchange property, immediately following the direct/seda/vm consumer. The URI value of exchange.CamelToEndpoint can be preserved in a header and accessed later in the route to retrieve the custom/dynamic parameters from the querystring. It is not too pretty, but it would work. There could also be a new boolean option "allowCustomOptions" that would in effect turn syntax checking on/off for the direct/seda/vm producer endpoint. As it currently stands, attempting to add a custom option on the direct/seda/vm producer endpoint results in a "Failed to resolve endpoint" error when deploying the bundle. Another idea would be to check the producer endpoint for a matching consumer endpoint i.e. custom options on the producer endpoint URI querystring must match an option on an existing consumer endpoint URI querystring. It would act the same way as it currently acts when you misspell a valid option. BTW - thanks for the fast reply! best regards, ala -- View this message in context: http://camel.465427.n5.nabble.com/Passing-parameters-to-a-direct-seda-vm-endpoint-tp5742567p5742621.html Sent from the Camel - Users mailing list archive at Nabble.com.
Passing parameters to a direct / seda / vm endpoint
G'day all; Is there a way to pass parameters (i.e. like a function call) to a direct / seda / vm consumer endpoint? Setting headers works, but I reckon it would be much cleaner and clearer if we could pass actual parameters as part of the call to the endpoint, either as part of the URI or as child elements of the element. Even better would be if we could define parameters as optional/required on the consumer endpoint, but simply being able to pass them without resorting to headers etc.. would be much better imho. I am running version 2.10.7, and setting 'unknown' properties on the URI query string results in errors. -- View this message in context: http://camel.465427.n5.nabble.com/Passing-parameters-to-a-direct-seda-vm-endpoint-tp5742567.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can I avoid setting namespace prefixes in xpath expressions in camel?
well eddie - in this case RTFM! here is what you are looking for in the Java DSL: http://camel.apache.org/xpath.html -- View this message in context: http://camel.465427.n5.nabble.com/How-can-I-avoid-setting-namespace-prefixes-in-xpath-expressions-in-camel-tp5742461p5742468.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: How can I avoid setting namespace prefixes in xpath expressions in camel?
you can set the namespace prefixes at route level and just use the prefix anywhere in that route. off the top of my head I don't know the java DSL for it, but in xml you do: http://mydomain.com";> ... /nsprefix:book/nsprefix:chapter ... and of course you can specify multiple namespaces -- View this message in context: http://camel.465427.n5.nabble.com/How-can-I-avoid-setting-namespace-prefixes-in-xpath-expressions-in-camel-tp5742461p5742467.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF consumer endpoint + XSLT + Tracer = EmptyStackException
I suspect it may have to do with the type of object in the message, though It does not appear to be an issue with stream caching. I'm a newbie, so my grasp of the internals is still superficial. I tried stream caching at both context and route level without success. Also, there are several steps after the incoming consumer that shows the incoming message to be readable more than once. It seems to be an issue with the XSLT endpoint; I have encountered a similar issue with a wireTap in a route with two XSLT endpoints; having the wireTap before the first XSLT endpoint results in the same EmptyStackException - funny though because I can have any number of wireTaps after that first XSLT endpoint and the second XSLT performs as expected. I will do a little more playing around to see if I can isolate this problem better - it seems to be related to the CXF consumer at the start of the route as well; I am using the default XSLT transformer class, I will try to substitute xalan for example. aloha -- View this message in context: http://camel.465427.n5.nabble.com/CXF-consumer-endpoint-XSLT-Tracer-EmptyStackException-tp5741942p5742003.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF consumer endpoint + XSLT + Tracer = EmptyStackException
I had the cxf endpoint commented out in the route, and that did not come through in the post. here it is: aloha -- View this message in context: http://camel.465427.n5.nabble.com/CXF-consumer-endpoint-XSLT-Tracer-EmptyStackException-tp5741942p5741946.html Sent from the Camel - Users mailing list archive at Nabble.com.
CXF consumer endpoint + XSLT + Tracer = EmptyStackException
Hi all; Versions: Camel 2.10.6, CXF 2.6.8, ServiceMix 4.5.2 I have a route that consumes a CXF endpoint: works fine I added an XSLT transform to handle the incoming payload: works fine I set trace=true on the route: java.util.EmptyStackException tracing with either the CXF consumer endpoint or the XSLT transform works fine. It seems only when I have the two in the same route that I get the error. I tried with both streamCache=true and false but no luck. here is the blueprint config containing the endpoint and route: http://www.osgi.org/xmlns/blueprint/v1.0.0"; xmlns:camelcxf="http://camel.apache.org/schema/blueprint/cxf";> http://myns.com.au/namespaces/NV/Order"/> http://localhost/repository/stylesheets/Order_Request.xsl"/> please note that the file/pollEnrich consumers are there to replace the CXF endpoint and other internal processing to help isolate the error. here is the stack trace: 2013-10-21 15:00:54,149 | ERROR | qtp21434081-659 | DefaultErrorHandler | 100 - org.apache.camel.camel-core - 2.10.6 | Failed delivery for (Messag eId: ID-NMA02085-D7-54961-1382315079679-31-2 on ExchangeId: ID-NMA02085-D7-54961-1382315079679-31-1). Exhausted after delivery attempt: 1 caught: java.util.Empt yStackException java.util.EmptyStackException at org.apache.xml.utils.IntStack.peek(IntStack.java:127)[:] at org.apache.xml.dtm.ref.sax2dtm.SAX2DTM.startElement(SAX2DTM.java:1883)[:] at org.apache.xalan.xsltc.trax.DOM2SAX.parse(DOM2SAX.java:285)[:] at org.apache.xalan.xsltc.trax.DOM2SAX.parse(DOM2SAX.java:149)[:] at org.apache.xml.dtm.ref.DTMManagerDefault.getDTM(DTMManagerDefault.java:439)[:] at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:699)[:] at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1273)[:] at org.apache.xalan.transformer.TransformerImpl.transform(TransformerImpl.java:1251)[:] at org.apache.camel.builder.xml.XsltBuilder.process(XsltBuilder.java:128)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.impl.ProcessorEndpoint.onExchange(ProcessorEndpoint.java:101)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.component.xslt.XsltEndpoint.onExchange(XsltEndpoint.java:81)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.impl.ProcessorEndpoint$1.process(ProcessorEndpoint.java:71)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61)[100:org.apache.cam el.camel-core:2.10.6] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.SendProcessor$2.doInAsyncProducer(SendProcessor.java:122)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.impl.ProducerCache.doInAsyncProducer(ProducerCache.java:298)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:117)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:72)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.DelegateAsyncProcessor.processNext(DelegateAsyncProcessor.java:99)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:90)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:163)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:73)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:335)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:220)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.interceptor.StreamCachingInterceptor.process(StreamCachingInterceptor.java:52)[100:org.apache.camel.camel-core:2.10.6] at org.apache.camel.processor.RouteContex
Re: karaf / org.xml.sax not found
Sorry for the false alarm... had to add the org.xml.sax and javax.xml dependencies under Import-Package on the MANIFEST.MF for the legacy JAR bundle. I assume that because these legacy JARs were compiled years ago under java 1.4 or java 1.5 that they require these explicit package imports. ahhh the fun of being a newbie ;-) -- View this message in context: http://camel.465427.n5.nabble.com/karaf-org-xml-sax-not-found-tp5741570p5741571.html Sent from the Camel - Users mailing list archive at Nabble.com.
karaf / org.xml.sax not found
Hi all; this has nothing to do with Camel, thought I might throw it out here anyway... I have packaged up some JARs used to call a legacy middleware product (that I intend to integrate via Camel). I created an OSGi bundle containing these JARs and deployed to Karaf. I have created a separate bundle that declares a service interface that provides methods that wrap methods in the legacy JARs. The bundles deploy and start fine, and I can access them via blueprint declarative services. I am however getting an exception when calling one of the methods provided by these legacy middleware classes. here is the exception: java.lang.ClassNotFoundException: org.xml.sax.helpers.DefaultHandler not found the MANIFEST file for the legacy jar bundle has Bundle-RequiredExecutionEnvironment: JavaSE-1.6 the jre.properties shows the org.xml.sax.helpers package being exported I am at a loss as to what I have done wrong... anyone run into this before? I have tried on servicemix 4.5.2 (Karaf 2.2) and Karaf 2.3.3, same result I was able to get this running as a non-OSGi application, standalone in it's own jvm, including calling the legacy middleware product from a Camel route (Camel 2.12.2). I am now porting this application to OSGi and this is the latest snag I have hit... aloha -- View this message in context: http://camel.465427.n5.nabble.com/karaf-org-xml-sax-not-found-tp5741570.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: CXF Camel Blueprint - problem deploying Web Service application
OK I have gotten beyond this error. I was using the wrong schema/element. instead of: jaxws:endpoint from http://cxf.apache.org/blueprint/jaxws http://cxf.apache.org/schemas/blueprint/jaxws.xsd I used: cxfEndpoint from http://camel.apache.org/schema/blueprint/cxf http://camel.apache.org/schema/blueprint/cxf/camel-cxf.xsd now the bundle deploys with no errors. I really have to run so I will confirm tomorrow that the web services implemented in a camel route behind this endpoint still work as before using spring-dm. I will also post full source of my config for others who hit this snag. -- View this message in context: http://camel.465427.n5.nabble.com/CXF-Camel-Blueprint-problem-deploying-Web-Service-application-tp5741491p5741496.html Sent from the Camel - Users mailing list archive at Nabble.com.
CXF Camel Blueprint - problem deploying Web Service application
G'day all; I currently have a web service running standalone (no container) using CXF / Camel / Spring / Jetty. here is the setup in spring config: http://me.com.au/namespaces/2007/test/Order"/> Camel receives the incoming requests on a cxf endpoint: This is all working fine when executed using mvn:camel run, using jetty as http server. I now want to port this to use blueprint and run in servicemix. So I translated the above cxf config to this: http://me.com.au/namespaces/2007/test/Order"/> installing this into servicemix gives a null pointer exception: java.lang.NullPointerException at org.apache.aries.blueprint.container.RecipeBuilder.getValue(RecipeBuilder.java:335[10:org.apache.aries.blueprint:0.3.2] I can see the cxf-codegen generated classes so the stub code is being generated for the blueprint version as in the working spring version. I think I am missing something silly and obvious, so for the sake of brevity I have left out most of the config etc... I can post the entire config and pom and whatever else. One difference between the spring and blueprint code are the camel/cxf versions used. For the spring I am running the latest camel (2.12.1) and cxf (2.7.6) whereas I am attempting to deploy the blueprint to servicemix 4.5.2 (camel 2.10.6 / cxf 2.6.8) I am compiling both with maven 3.0.5 If more info from the spring/blueprint configs and pom files and karaf output is needed just let me know. thanks in advance! -- View this message in context: http://camel.465427.n5.nabble.com/CXF-Camel-Blueprint-problem-deploying-Web-Service-application-tp5741491.html Sent from the Camel - Users mailing list archive at Nabble.com.
Web Services consumer scenario - advice / ideas?
Hi all; sorry for the verbose post... I have a particular scenario for implementing a Web Services consumer: I have several services I would like to provide; some will be provided as REST and JSON, some as SOAP, some as all 3; For the SOAP/xml based services, I already have xml schema. The implementation of these services requires integrating several back-end systems. Camel will be perfect for implementing these services. Ideally all I really need is something to differentiate the incoming service requests, and marshall/unmarshall the requests and replies. I am not interested in using any heavy SOAP functionality - the SOAP will mostly be a simple wrapper around the XML data; indeed I may want to accept pure XML (based on the schemas I have) as well. I reckon this can all be done within Camel, without use of any WS frameworks like CXF, Spring Web Services or Axis. I likely will need to write a (few) processor / filter etc.. using jaxws and jaxrs, but that's OK. I may decide to have different URIs for REST/SOAP/JSON, or not and check properties/headers etc. to differentiate the requests. So my questions are: Am I missing something in that Camel will not be able to fully implement this scenario without using a WS framework? What can a framework provide that will make it a better solution? Personally, I do not find any WS framework code generation to be a plus in this scenario. Because the solution requires lots of back-end integration which most easily is implemented in Camel, I would find myself sticking camel code into any generated skeleton code anyway - so why bother? I am very well versed in XML - writing wsdl and xsd etc.. is not a problem. thoughts? ideas? criticism? it's all welcome! many thanks ala ps. latest version of camel, java6 -- View this message in context: http://camel.465427.n5.nabble.com/Web-Services-consumer-scenario-advice-ideas-tp5740788.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Jetty consumer - how to send reply?
thanks again guys! sorry for the newbie questions - still getting my head around the architecture and the major moving parts. aloha ala -- View this message in context: http://camel.465427.n5.nabble.com/Jetty-consumer-how-to-send-reply-tp5740450p5740633.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Jetty consumer - how to send reply?
Seems like the only way (without using a processor/filter/endpoint ) is to use enrich. I tried to use a file directly in setBody: from("jetty:http://localhost:8123/services?matchOnUriPrefix=true";) .log("Received Request\n\n ${body} \n-\n") .setBody(body().append(new File("C:\\devTestResponse.xml"))) .log("Sending Response\n\n ${body} \n-\n") .end(); this does not work. I infer from the documentation that setBody() is meant to work with expressions i.e. scripts/xpath etc.. that work on the current content of the Message. This exercise is more academic than a real requirement - just seeing what I can and cannot do within these routes. I can certainly live with pollEnrich as is. Thanks for all the help guys! aloha ala -- View this message in context: http://camel.465427.n5.nabble.com/Jetty-consumer-how-to-send-reply-tp5740450p5740616.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Jetty consumer - how to send reply?
Yep - pollEnrich works fine. I tried using setBody() directly in the route like so: from("jetty:http://localhost:8123/services?matchOnUriPrefix=true";) .streamCaching() . setBody(body().append("TEST RESPONSE")) .end(); this does not seem to work... any reason why? thanks for the fast reply Claus tusen takk og mvh ala -- View this message in context: http://camel.465427.n5.nabble.com/Jetty-consumer-how-to-send-reply-tp5740450p5740459.html Sent from the Camel - Users mailing list archive at Nabble.com.
Jetty consumer - how to send reply?
Hi all; I am playing around with the jetty component. Simple use case - I want to receive a POST request, log the request body, read in a file and return the file contents as the POST reply. Here is the camel route: from("jetty:http://localhost:8123/services?matchOnUriPrefix=true";) .log("Received Request\n\n ${body} \n-\n") .from("file:C:\\dev?fileName=TestResponse.xml&noop=true") .log("Sending Response\n\n ${body} \n-\n") .end(); All seems to be working - I get the request, see it in the log, read in the file, see the file contents in the log; however the HTTP client gets an HTTP 200 response code with no body (content-length=0); Obviously the response body is not being set... Do I need to use a processor to get the Exchange through which I set the response body? i.e. public void process(Exchange exch) throws Exception {exch.getOut().setBody("some response");} Is there any other way to set the HTTP response body for a jetty consumer? aloha ala -- View this message in context: http://camel.465427.n5.nabble.com/Jetty-consumer-how-to-send-reply-tp5740450.html Sent from the Camel - Users mailing list archive at Nabble.com.