apache-camel

How to filter files by extensions using include parameter in Camel component File2

╄→гoц情女王★ 提交于 2019-12-05 01:03:39
I need the simplest filter by extension: f.e. file 20120523.173227.CustomerMaster05092012.QWERTY.xml route: <from uri="file://{{fdr.folder.working.url}}&include=*.xml"/> doesn't work: Dangling meta character '*' near index 0 WARN - file://root_folder/working/) [FileConsumer] Consumer Consumer[file://root_folder/working/?delay=1000&delete=true&idempotent=false&include=*.xml&initialDelay=1000&readLock=changed] failed polling endpoint: Endpoint[file://root_folder/working/?delay=1000&delete=true&idempotent=false&include=*.xml&initialDelay=1000&readLock=changed]. Will try again at next poll. Caused

Camel parallel processing options

◇◆丶佛笑我妖孽 提交于 2019-12-05 00:24:27
问题 I am working on Camel routes in RedHat Fuse Service Works which has Camel 2.10. I would like to know the differences between the following implementations: 1/ using SEDA routes from("A") .split(body()) .to("seda:B"); from("seda:B?concurrentConsumers=4") .routeId("MySEDATestRoute") .to("C") .end(); 2/ using parallel processing from("A") .split(body()) .parallelProcessing() .to("C"); 3/ using threads from("A") .split(body()) .threads() .to("C"); From what I've seen the method 3 (threads) allows

What is the difference between “seda + concurrentConsumers” and “direct + threads”

旧巷老猫 提交于 2019-12-04 23:57:03
问题 Apache Camel provide two solutions for using thread pool: from("seda:stageName?concurrentConsumers=5").process(...) and from("direct:stageName").thread(5).process(...) I would like to know, what is the difference between the two solutions ? Is it just two kind of write the same thing or not ? What are the use cases ? 回答1: SEDA Component The seda: component provides asynchronous SEDA behavior so that messages are exchanged on a BlockingQueue and consumers are invoked in a separate thread to

Apache Camel HTTPS4 Basic Authentication

孤街醉人 提交于 2019-12-04 22:07:32
Does Camel-Http4 supports Basic Authentication? Followed this and other posts Camel http4 download file using Basic authentication over Https I am using camel 2.17.3 version. using camel-http4 component. The route sends a https4 multipart request to a REST endpoint . The REST service is behind the siteminder. Have truststore/ketstore/cert all setup and it works fine, just sending basic auth is causing trouble. Using postman i was able to call REST services with basic auth. However, all the calls from camel route fails and get HTTP error 403. I tried below options to get it working: Added basic

How to insert blob using camel SQL component with Oracle Database

依然范特西╮ 提交于 2019-12-04 19:12:00
I am trying to insert an input stream using camel SQL component ( http://camel.apache.org/sql-component.html ). I have the following table in Oracle Database: table EMPLOYEE(NAME varchar(32) ,SURNAME varchar(32) , PIC BLOB ); and the following route: <route> <from uri="direct:startOracle" /> <to uri="sql:INSERT INTO EMPLOYEE (Name, surname, pics) VALUES (# , # , #)?dataSource=#oracle" /> </route> when I try to run the following code: Resource r = contex.getResource("classpath:file/ciao.jpg"); InputStream inputStream = r.getInputStream(); aProducerTemplate.sendBody(new Object[] {"mario", "ross"

How to delay consuming messages in Apache Camel from ActiveMQ

醉酒当歌 提交于 2019-12-04 17:54:28
I have a requirement where I need to throttle by shaping (queuing) inbound traffic when client app sends more than 1000 requests in a 5 sec time span. The solution I followed is: I have a camel:throttle setting max requests to 1000 and timespan to 5 sec. When threshold is exceeded I am catching throttle exception and within the onException block, I am sending the throttled messages to an ActiveMQ request queue for further processing later as Camel is overloaded based on 1000 req/ 5 sec config. I am successful in implementing the above, however I would like to have Camel consumer to further

Apache Camel Xpath 2.0 with Saxon does not look to work in RouteBuilder / Predicates

筅森魡賤 提交于 2019-12-04 17:21:50
I am using ServiceMix 4.5.3 which includes Camel 2.10.7 and I am able to make XSLT 2.0 transformations with the Saxon library using the option endpoint like this: ... to("xslt:stylesheet.xsl?transformerFactoryClass=net.sf.saxon.TransformerFactoryImpl") ... However when I try to use the xpath function like this: private Namespaces ourNS = new Namespaces("myns", "urn:com:company:domain:namespace:myns/1"); // ... some code ... // Make a predicate to filter according a header : // The code attribute looks like: urn:phone:apple:iphone:4s Predicate isNotSamePhoneBrand = PredicateBuilder.isNotEqualTo

Java Camel framework: Losing message body in processor

浪子不回头ぞ 提交于 2019-12-04 16:48:43
All, Here's a simple route: <route> <from uri="jetty://http://0.0.0.0:9090/myproject" /> <setExchangePattern pattern="InOnly" /> <process ref="JsonValidator"/> <unmarshal> <json library="Jackson" unmarshalTypeName="com.myproject.JsonPojo"/> </unmarshal> ... </route> JsonValidator is a simple Java bean where I extend processor. Here, I want to make sure all the required fields are being passed in before I continue to the unmarshal call using Jackson to unmarshal the JSON to my POJO. All I'm doing in that bean right now is just one line: public void process(Exchange exchange) throws Exception {

Camel CSVRecord Camel Bindy

随声附和 提交于 2019-12-04 16:42:07
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 exclude the last line/footer from CSVRecord bindy or maybe have camel read and remove the last line in

Apache camel getbody as custom class

回眸只為那壹抹淺笑 提交于 2019-12-04 15:18:35
The question is rather simple, perhaps because I'm a little confused in the process. What I'm trying to do is shown in the code example: cc.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("file://files?noop=true") .split() .tokenize("\n") .split() .method(SplitToken.class, "hashTokens") and: class SplitToken { @SuppressWarnings("unchecked") public static List<HashMap<String, Integer>> hashTokens(final Exchange exchange) { List<String> oldstr = exchange.getIn().getBody(List<String>); //Create a key value hashmap from accumulated string list } } but