Re: Custom fluent API in Java DSL
Hi! Can you give an example what type of method you want to add to the RouteBuilder? To my understanding if you need a custom DSL to lets say "reuse camel specific DSL sequences" its easier to write your own DSL completely hiding camel and rely on RouteBuilder internally as usual. But maybe I just did not understand your requirement? Jens Von meinem iPhone gesendet > Am 09.12.2015 um 01:27 schrieb Milli : > > Hi, > > In our project, we are looking at adding custom fluent API to the existing > JAVA DSL. > As in, add few custom methods to the existing `RouteBuilder` api to make > our own custom DSL. > > Is there a way to achieve this? > If so, what is the best way to do this? > > Thanks and regards,
Re: Camel-JMS JMS Selector getting overridden by new requests
Yes if the endpoint uri is the same, then its cached in camel. On Tue, Dec 8, 2015 at 6:21 PM, ravi.4indra wrote: > are the endpoints shared between multiple threads even if the bean is of > protoype scope? > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Camel-JMS-JMS-Selector-getting-overridden-by-new-requests-tp5774806p5774838.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: Camel-JMS JMS Selector getting overridden by new requests
are the endpoints shared between multiple threads even if the bean is of protoype scope? -- View this message in context: http://camel.465427.n5.nabble.com/Camel-JMS-JMS-Selector-getting-overridden-by-new-requests-tp5774806p5774838.html Sent from the Camel - Users mailing list archive at Nabble.com.
Does Camel support full duplex (bidirectional) asynchronous routes?
I am attempting to configure Apache Camel 6.1.0 support full duplex (bidirectional) asynchronous routes for both UDP and TCP using Netty4. The requirement is for numerous (20+) existing systems (non-Camel) get proxy by Camel. The custom protocols are not supported by Camel, and nor is it a necessary to have Camel support them. Some articles discuss that older versions of Camel do not support this requirement. If so, can someone advise me where to find custom solutions to make Camel support this requirement? (non-Camel TCP client port 7000) <--> (Camel/Netty) <--> (non-Camel TCP client port 7001) For a specific example, I want to communicate bidirectional between two consoles running netcat (Linux command line utility). My blueprint is show below. However, in all the cases attempted, I cannot get the blueprint to function per the stated requirements. http://www.osgi.org/xmlns/blueprint/v1.0.0"; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd";> http://camel.apache.org/schema/blueprint";> -- View this message in context: http://camel.465427.n5.nabble.com/Does-Camel-support-full-duplex-bidirectional-asynchronous-routes-tp5774839.html Sent from the Camel - Users mailing list archive at Nabble.com.
Custom fluent API in Java DSL
Hi, In our project, we are looking at adding custom fluent API to the existing JAVA DSL. As in, add few custom methods to the existing `RouteBuilder` api to make our own custom DSL. Is there a way to achieve this? If so, what is the best way to do this? Thanks and regards,
Can't use camel-geocoder in Karaf
Using Karaf 3.0.4 and Camel 2.16.1, I used "feature:install camel-geocoder" and get the following error when I try to use a geocoder endpoint: Caused by: java.lang.NoClassDefFoundError: com/google/gson/GsonBuilder at com.google.code.geocoder.Geocoder.geocode(Geocoder.java:56) at org.apache.camel.component.geocoder.GeoCoderProducer.process(GeoCoderProducer.java:89) at org.apache.camel.util.AsyncProcessorConverterHelper$ProcessorToAsyncProcessorBridge.process(AsyncProcessorConverterHelper.java:61) ... 23 more Caused by: java.lang.ClassNotFoundException: com.google.gson.GsonBuilder not found by wrap_mvn_com.google.code.geocoder-java_geocoder-java_0.16 [197] at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)[org.apache.felix.framework-4.2.1.jar:] at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)[org.apache.felix.framework-4.2.1.jar:] at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)[org.apache.felix.framework-4.2.1.jar:] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)[:1.8.0_66] ... 26 more -- Matt Sicker
Re: Soap Body is Empty or Partial XML
Thanks Aki, My first step in the Camel Route is to convert the body to a string. I was able to work around it by turning off streaming and since I need to modify the payload, I don't need streaming in this use case. Is it possible that the default for Streaming in older versions of Camel like 2.10.7 was false? That would explain the anamolies when we upgraded to Camel 2.14.x Thanks, Yogesh -- View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364p5774840.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Producer-consumer problem in Camel
And this one would be the final solution, sorry for distribution: from("activemq:queue:requests").to("direct:processRequest?exchangePattern=InOut"); from("direct:handleUserRequest") .to(ExchangePattern.InOnly, "activemq:queue:requests") . from("direct:processRequest") . -- View this message in context: http://camel.465427.n5.nabble.com/Producer-consumer-problem-in-Camel-tp5774608p5774836.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel cxfrs proxy response
Hi May be following this thread: http://camel.465427.n5.nabble.com/How-to-access-payload-from-REST-404-reply-in-cxfrs-td5773325.html can help ? Cheers, Sergey On 07/12/15 07:31, hoomanb wrote: Hi, I have exposed a cxfrs endpoint as my proxy rest service, once getting the request I'm calling two soap web services and getting the respond back from those service, in this process I'm using camel aggregator to aggregate the response results coming back from the soap calls, now up to here everything works as expected, the issue I'm facing is I have problem returning the response back to the rest client, so here's my route config: http://localhost:9002/route"; serviceClass="com.MyController" loggingFeatureEnabled="true" loggingSizeLimit="20"> http://camel.apache.org/schema/blueprint";> Here's com.MyController: @GET @Path("/{objectId}") @Produces(MediaType.APPLICATION_JSON) public List getMyObject(@PathParam("objectId") String objectId) { return null; } and here's the RequestProcessing class: from(Constants.REST_ENDPOINT) .routeId(getClass().getName()) .log("Entering the route...") .process(new EndpointProcessorManager()) .removeHeaders("CamelHttp*") .multicast() .parallelProcessing() .to(Constants.DIRECT_ENDPOINT_ONE) .to(Constants.DIRECT_ENDPOINT_TWO); from(Constants.DIRECT_ENDPOINT_ONE).process(new SupplierEnricherProcessor()).to(FIRST_SOAP_ENDPOINT).to(Constants.DIRECT_AGGREGATE_ENDPOINT); from(Constants.DIRECT_ENDPOINT_TWO).process(new GenericNAICSEnricherProcessor()).to(SECOND_SOAP_ENDPOINT).to(Constants.DIRECT_AGGREGATE_ENDPOINT); from(Constants.DIRECT_AGGREGATE_ENDPOINT) .aggregate(constant(true), new GroupedExchangeAggregationStrategy()) .completionSize(2) setBody(exchangeProperty(Exchange.GROUPED_EXCHANGE)) .process(new FinalTestProcessor()) [1] .bean(new ProcessJsonResponse(), "processBody") [2] .marshal(new JsonDataFormat(JsonLibrary.Jackson)); so in line [1] FinalTestProcessor processes the results from the web service calls to extract the desired result as a list of objects say for example: exchange.getIn().setBody(MyObjectList) . in line [2] I'm basically returning this result list as follows: return Response.status(Status.OK).entity(MyObjectList).build(); With this config all the calls and everything works but I can't seem to get the json respond that I need back to the REST caller. Any help would be appreciated on this. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-cxfrs-proxy-response-tp5774775.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Sergey Beryozkin Talend Community Coders http://coders.talend.com/
Re: Producer-consumer problem in Camel
Hello again, this is the solution what I found after playing with seda, load balancer, wiretap: ExecutorService execExecutorService = new ThreadPoolBuilder(getContext()) .poolSize(1).maxPoolSize(1).maxQueueSize(10).build("InvoiceExecutorService"); from("direct:handleUserRequest") .routeId("invoice") .log("RECEIVED") .wireTap("direct:processRequestSync", executorService); .setBody().constant("Your request is being processed."); // User gets a response immediately from("direct:processRequestSync").to(ExchangePattern.InOut, "direct:processRequest"); from("direct:processRequest") .log("PROCESSING") // Long running operation, notify user via email when completed . .log("DONE") Now, I get the output what I expect. For example the 'handleUserRequest' is invoked randomly REST 3 times via REST. RECEIVED RECEIVED PROCESSING RECEIVED DONE PROCESSING DONE PROCESSING DONE -- View this message in context: http://camel.465427.n5.nabble.com/Producer-consumer-problem-in-Camel-tp5774608p5774834.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Limit number of JMS messages when processing asynchronously
Thank you four your ideas, Claus. We need the "asyncConsumer=true" setting as it dramatically boosts our performance (the broker already delivers the messages unsorted, so we have to re-order them anyway). But a route policy should do the trick - I have already thought about implementing a RoutePolicy to turn off the JMS consumer in some cases (The processed JMS messages are buffered in a database, another camel route is used to fetch & aggregate them. If there are many messages in the JMS queue, we sometimes experience the problem that database reads are blocked by the write operations of the JMS consumer until the traffic decreases - so for periods of high traffic, it could be useful to disable the JMS consumer from time to time to give the database consumer the chance to kick in) So - RoutePolicy, here we go! Thank you, Joerg -- View this message in context: http://camel.465427.n5.nabble.com/Limit-number-of-JMS-messages-when-processing-asynchronously-tp5774822p5774828.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: extracting HTTP query key values with Camel Rest and Jetty
Ah see this FAQ http://camel.apache.org/faq If you are on a new camel version, use the new toD - if not use receipientList as in the FAQ On Tue, Dec 8, 2015 at 3:38 PM, Vero Kato wrote: > hi, sorry, I didn't get any answer about this. can someone from the Apache > Camel devs reply. > > On Sun, Dec 6, 2015 at 12:03 PM, Vero Kato wrote: > >> hi, I'm using Apache Camel with Camel REST and Camel Jetty. >> >> I don't have any problems when we expose our Rest API like this: >> localhost:8080/rest/OurService/Value1/Value2 >> >> but I can't understand how I can extract data from this URL >> >> localhost:8080/rest/OurService?key1=Value1&ke2=Value2 >> >> i.e. I need something like this, but can't make it work: >> >> rest("/rest/OurService/").description("Our Service Description") >> .produces("application/json") >> .outType(LocalNetpositionQueryService.class) >> >> .to("bean:ourLocalService?method=retrieveData(${header.key1}, >> ${header.key2})"); >> >> Can you please suggest how to extract nicely with Camel Rest + Camel Jetty >> http query string key-value pairs? >> >> Thanks. >> Vero >> -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: extracting HTTP query key values with Camel Rest and Jetty
hi, sorry, I didn't get any answer about this. can someone from the Apache Camel devs reply. On Sun, Dec 6, 2015 at 12:03 PM, Vero Kato wrote: > hi, I'm using Apache Camel with Camel REST and Camel Jetty. > > I don't have any problems when we expose our Rest API like this: > localhost:8080/rest/OurService/Value1/Value2 > > but I can't understand how I can extract data from this URL > > localhost:8080/rest/OurService?key1=Value1&ke2=Value2 > > i.e. I need something like this, but can't make it work: > > rest("/rest/OurService/").description("Our Service Description") > .produces("application/json") > .outType(LocalNetpositionQueryService.class) > > .to("bean:ourLocalService?method=retrieveData(${header.key1}, > ${header.key2})"); > > Can you please suggest how to extract nicely with Camel Rest + Camel Jetty > http query string key-value pairs? > > Thanks. > Vero >
Re: Limit number of JMS messages when processing asynchronously
It depends a bit what you do with these messages in the Camel routes. The jms consumer is in fact sequential by default (so if the routing at some point becomes async, then it will wait for that inflight message to complete before it consumes the next). But you can turn that off with asyncConsumer=true, and if so the consumer will run as fast as it can. Using seda queues or other async components in the route all can have an influence how it all flows. Many of those jms settings is for tuning how the jms consumer react on load, so it can scale up and down dending on how many of threads are processing or idle, vs if there is no messages on the queue vs many messages etc. You can also use the throttler route policy http://camel.apache.org/routepolicy that can suspend/resume the routes depending on number of inflight messages. On Tue, Dec 8, 2015 at 1:57 PM, jpeschke wrote: > Hello all, > We have a system consuming messages at a high rate from a JMS queue > asynchronously and parallel. For Performance reasons, we have a very high > idle timeout, so normally our camel-based software never reconnects to the > broker and stays connected. > > The problem is that it seems that the asynchronous behaviour lets Camel take > as many JMS messages as it can get, so sometimes we have thousands of > inflight messages waiting to be processed. This is not such a big problem > during normal operation, but when we shut down the system for maintenance, > sometimes there are so many messages that they cannot be processed during a > graceful shutdown. > > My question is: How can I specify how many messages camel takes out of the > queue when using an asynchonrous consumer? > > I already defined > - idleConsumerLimit > - concurrentConsumers > - maxConcurrentConsumers > - maxMessagesPerTask > > but that doesn't seem to work (as far as I understand because these settings > influence how many threads are used to get messages out of the queue but not > how many messages may be "pumped" into the camel route) > > Any ides? > > Thank you & best regards, > Joerg > > > > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Limit-number-of-JMS-messages-when-processing-asynchronously-tp5774822.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Re: Having issues with Multicast to Aggregation ...
So I've tried a couple things, include adding a timeout, but that did not seem to work. Anyone have any other suggestions? - Josh Toepfer -- View this message in context: http://camel.465427.n5.nabble.com/Having-issues-with-Multicast-to-Aggregation-tp5774688p5774823.html Sent from the Camel - Users mailing list archive at Nabble.com.
Limit number of JMS messages when processing asynchronously
Hello all, We have a system consuming messages at a high rate from a JMS queue asynchronously and parallel. For Performance reasons, we have a very high idle timeout, so normally our camel-based software never reconnects to the broker and stays connected. The problem is that it seems that the asynchronous behaviour lets Camel take as many JMS messages as it can get, so sometimes we have thousands of inflight messages waiting to be processed. This is not such a big problem during normal operation, but when we shut down the system for maintenance, sometimes there are so many messages that they cannot be processed during a graceful shutdown. My question is: How can I specify how many messages camel takes out of the queue when using an asynchonrous consumer? I already defined - idleConsumerLimit - concurrentConsumers - maxConcurrentConsumers - maxMessagesPerTask but that doesn't seem to work (as far as I understand because these settings influence how many threads are used to get messages out of the queue but not how many messages may be "pumped" into the camel route) Any ides? Thank you & best regards, Joerg -- View this message in context: http://camel.465427.n5.nabble.com/Limit-number-of-JMS-messages-when-processing-asynchronously-tp5774822.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel Without Maven
Claus Ibsen-2 wrote > Some of the commercial vendors offers an offline distribution that > includes all the dependencies. > http://camel.apache.org/commercial-camel-offerings.html > > But the suggestions here to setup an internal maven repo is a good > suggestion. There is a lot of Java software today that are Maven > based. And it all just makes the lives of your developers more easier > if they can load their dependencies automatic from the internal maven > repo. > > They can the easily load a project in their editor from the maven > pom.xml file that setup everything for them. > No more need to store eclipse/idea project settings together with the > source code. Or having JARs in the source in a lib directory as we did > 10 years ago. > > > > > > On Mon, Dec 7, 2015 at 5:59 PM, gbchriste < > gary.christenot@ > > wrote: >> I'm planning to re-architect an existing Java application to incorporate >> messaging via JMS to integrate with a Windows back end system. I've done >> some rapid prototyping with ActiveMQ and I've also been reading through >> Camel in Action (Ibsen, et al) and am convinced that this is the >> combination >> I want to use. >> >> I'll confess up front that I'm a 2-decade Windows developer and have been >> dealing seriously with Java only for the last year or so, so I definitely >> have an uphill climb. I got the unenviable job of maintaining an >> application that was built for us by a contractor who disappeared after >> Version 1 was delivered. >> >> Anyway, the biggest roadblock in my plan is the heavy reliance that Camel >> places on Maven for managing Camel dependencies. Our organization's >> development activities are required to be carried out inside a separate >> network enclave that has highly restrictive policies for Internet access. >> Maven is one of the sites that cannot and never will be allowed to be >> accessed from within the development enclave and there is no way and >> never >> will be a way for me to take my development activities outside the >> enclave. >> >> So I need to come up with a work around to get all the necessary Camel >> dependencies as I add each Camel module. I've downloaded the entire >> Camel >> bundle to local jar files and can create local library references. I've >> already tried out the camel-core with some simple file and Bean >> endpoints. >> But trying to manually figure out what all the dependencies are for other >> Camel modules, and going and getting them, is proving to be more than I >> want >> to bite off. I spent 3 hours last night trying to figure out how to do a >> simple HTTP request using either camel-jetty or camel-http because I >> couldn't get all the right dependencies loaded up. >> >> Here's my thinking and would like to get some community input. I have a >> laptop loaded up with Netbeans (our organization Java standard IDE). >> What >> about this process: >> >> 1. Create a Maven project in Netbeans on laptop. There would be no code >> here. I'll just use it to communicate with the Maven repository. >> 2. Take laptop to a network connection outside the restricted enclave >> 3. Add dependencies to my Maven project for Camel modules (e.g. >> camel-core, >> camel-jetty, camel-jms, et al) >> 4. Let Maven project download all jars to local repository on laptop >> 5. Take laptop back to development enclave and copy in to lib folder of >> target project >> 6. Add Library references in target project >> >> Appreciate any help or advice folks can give. >> >> >> >> >> >> -- >> View this message in context: >> http://camel.465427.n5.nabble.com/Camel-Without-Maven-tp5774797.html >> Sent from the Camel - Users mailing list archive at Nabble.com. > > > > -- > Claus Ibsen > - > http://davsclaus.com @davsclaus > Camel in Action 2: https://www.manning.com/ibsen2 Thanks Claus! I've had Camel In Action sitting on my book shelf for about a month but really dug in to it this past weekend while thinking about my re-architecture needs. I'm looking forward to really digging and employing it in my application! Gary -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Without-Maven-tp5774797p5774821.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel/Spring - JavaConfig dont load CamelContext
Hi All, i have a problem with Camel in conjunction with Spring and Java configuration. All my routes getting picked up by Component Scanning but in the error log came up a Error: o.apache.camel.impl.DefaultCamelBeanPostProcessor -- No CamelContext defined yet so cannot inject into bean: org.apache.camel.component.file.FileComponent Im starting my app through gradle. It starts correctly my main class annotated with @Configuration and @Import. My Java Config looks like this: @Configuration @EnableAutoConfiguration @ComponentScan ({"com.app.service", "com.app.camel", "com.app.modules", "com.app.repository"}) public class CamelConfig extends CamelConfiguration {} My Route looks like this: @Component @Profile ({"app", "srv"}) public class SRV_Preparator extends Preparator { @Override public Endpoint producer() { return endpoint("file:" + this.baseDir + "?noop=true&fileName=SRV_NSB.XML"); } ... Preparator defined like public abstract class Preparator extends RouteBuilder { ... } Route Definition in Preparator class like: from(producer()).split().xtokenize(splitPath(), extractionMode(), namespaces()).streaming()... The log output shows that all routes in the package get loaded and started but the CamelContext seems to be missing? After start up the route doen't do anything. What is the problem? Can somebody give me a hint? Great Thx in advanced! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Spring-JavaConfig-dont-load-CamelContext-tp5774816.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Outputting time to logs for route to process a message
Hi There is a created timestamp on the exchange when it was created, so you can access that and log. Though we could also consider adding an easy to use function in simple language to output it, so you can do: .log("This message took ${elapsed} ms to process") On Tue, Dec 8, 2015 at 9:51 AM, gilboy wrote: > Hi > > My route does some business processing - i.e. consumes messages from a > topic, performs some business logic then sends message to a REST endpoint. > > After sending the message to the REST endpoint I have 1 final log statement > to state the route is complete for this particular message. I would like to > also output in this log statement the time it took to complete the > processing of this message on this route. > > I guess there are many ways but was wondering what the simplest and least > invasive is > > Thanks > Joe > > > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Outputting-time-to-logs-for-route-to-process-a-message-tp5774815.html > Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - http://davsclaus.com @davsclaus Camel in Action 2: https://www.manning.com/ibsen2
Outputting time to logs for route to process a message
Hi My route does some business processing - i.e. consumes messages from a topic, performs some business logic then sends message to a REST endpoint. After sending the message to the REST endpoint I have 1 final log statement to state the route is complete for this particular message. I would like to also output in this log statement the time it took to complete the processing of this message on this route. I guess there are many ways but was wondering what the simplest and least invasive is Thanks Joe -- View this message in context: http://camel.465427.n5.nabble.com/Outputting-time-to-logs-for-route-to-process-a-message-tp5774815.html Sent from the Camel - Users mailing list archive at Nabble.com.