apache-camel

camel http endpoint forming url dynamically

妖精的绣舞 提交于 2019-12-06 10:21:29
问题 Guys I am trying to use { from("direct:a").to (someUrl).processor(new Processor(){ @Override public void process(Exchange arg0) throws Exception { // do something } }); where someUrl is of the type http://xyz.com/{id}?test=<value1>&test1=<value2> } and this url will change on every request to the route. What i have already tried. Passing params as headers and try to access in the route using the header("test") and using ${in.header.test} both doesn't seem to work. any suggestions will be

How does one Set the “Pick” Expression for Apache Camel's FlexibleAggregationStrategy in Spring XML?

 ̄綄美尐妖づ 提交于 2019-12-06 10:11:36
问题 I am attempting to configure an Apache Camel route in Spring XML using Apache Camel 2.14. The route will involve either an <aggregator> or an <enrich> / <pollEnrich> ; I'm not yet experienced enough with Camel to know which EIP will be most useful. Either way, I'm going to need an aggregationStrategy . My end goal involves creating a Camel route for a client who wants the routes configured in XML. By searching around the Internet, I learned of the existence of a Camel class called

Camel CSVRecord Camel Bindy

吃可爱长大的小学妹 提交于 2019-12-06 09:53:37
问题 I'm using camel with bindy (2.16.0) to parse a csv file. The file contains a header and a footer. Both are used as metadata to describe common data for all other records. (Customer defined so I cant change the CSV Format) Im using Bindy to parse the data for me. The issue that I'm having is that for CSVRecord you cannot exclude the footer. I'm able to skip the header but the parsing of the data fails because it cannot parse the footer since the data format is different. Is there a way to

Apache Camel - Dynamically changing throttle values

夙愿已清 提交于 2019-12-06 09:11:43
Can anyone please give a sample on how to dynamically change the maxRequestsPerPeriod by using a Throttler processor instance or using a throttle element in Apache Camel ? (Reference - How to change Processor properties during runtime using Camel? ) We cannot use Expression with header because if the header is absent then the Throttler uses the old value. What we need is, in a bean based on some condition we have to update the throttle value so that it will be used until next update. In our case, we cannot use message header for this purpose. How can we navigate the runtime processors in the

Reading reloadable xml file from external Tomcat directory

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-06 08:21:32
Prerequisites Apache Tomcat 7 Spring 3.2.11.RELEASE Apache Camel 2.14.1 My Webapplication is deployed in ${catalina.home}/webapps/ as usual Requirements Reading xml file placed outside of war-Archive (for example from ${catalina.home}/myfolder/) The xml file should be reloadable . So if the xml changes the new xml file should be available in my Webapplication The xml file should be mapped to Java-Objects First try I have added the file to classpath via tomcat in catalina.home /conf/catalina.properties: common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catalina.home}/lib,$

Accessing Data from JSON body inside Apache Camel

对着背影说爱祢 提交于 2019-12-06 08:15:33
问题 I am working with an API which basically allows for the navigation of a file-system. I am trying to access data from within the returned JSON by the API in order to perform a function on it. Below is the code I am using the access the API. I have tried to use unmarshal to convert the JSON returned to a Map. from("timer://foo?fixedRate=true&period=120000") .log("Checking for files") .setHeader("Authorization", simple(myHttp.getAuth())) .setHeader("CamelHttpMethod", constant("GET")) .to(myHttp

DBCP Idle Connections not being reused in Camel Route

ぐ巨炮叔叔 提交于 2019-12-06 06:31:47
问题 I am pretty sure the idle connections are not being re-used or I am leaking connections. I have a simple route that start from a file consumer. The file consumer consumes text files. After picking up the file I check a table to ensure that this is not a duplicate file. I then convert the message body from a file to string. I then split the file up and run the individual pieces through a route depending on what type of record it is. Each one of these routes eventually inserts this record into

Camel retry control with multiple exceptions

旧街凉风 提交于 2019-12-06 05:52:40
问题 Preface: I'm fairly new to Camel, and after digesting Camel in action as best as possible, I'm adapting it to a project I'm on. In this project, we have some rather complex error handling, and I want to make sure I can replicate this as we Camel-ize our code. On our project (as most) there are a set of Exceptions we want to retry and a set that we don't - but more specifically, there are a set that we want to retry more than others (not all recoverable errors can be treated the same). In this

Camel - How to stop route execution on exception?

烈酒焚心 提交于 2019-12-06 05:41:14
问题 Is there any way I can stop the route execution (after displaying a log message) when exception is caught? <doTry> <process ref="messageProcessor"/> <doCatch> <exception>java.lang.IllegalArgumentException</exception> <log message="some message related to the exception" /> </doCatch> </doTry> Please provide a way to achieve this in Spring DSL. I've already tried < stop/> but that doesn't display log message. 回答1: Added a process in doCatch which stop's a Camel context. <doTry> <process ref=

Apache Camel: How to send two http requests in parallel and wait for the responses?

為{幸葍}努か 提交于 2019-12-06 05:39:09
In Apache Camel, where I am defining a route, how can I send two or more http requests in parallel and wait on their 'futures'to get the responses for further processing like in Java with AsyncHttpClient? AsyncHttpClient asyncHttpClient = new DefaultAsyncHttpClient(); Future<Response> f = asyncHttpClient.prepareGet("http://www.example.com/").execute(); Response r = f.get(); Just for the context, the following route calls the GET contacts http call and returns the response synchronously. from("direct:getContact") .to("http://host:port/contacts/1453") Rafał Spryszyński Try to split You route