apache-camel

camel mock - MockEndpoint.whenAnyExchangeReceived process method not execute

余生长醉 提交于 2019-12-24 09:49:47
问题 I have example code below, why is the process method in MockEndpoint.whenAnyExchangeReceived NOT executed? I expect the response is "Expected Body from mock remote http call", but the actual response is what passed in request("Camel rocks"). public class CamelMockRemoteHttpCallTest extends CamelTestSupport { @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { from("direct:start") .to("http:/

Apache Camel : Control over route startup

南笙酒味 提交于 2019-12-24 09:24:17
问题 i have a restful webservice configured using cxf and camel. My config xml is : <jaxrs:server id="restContainer" address="/" staticSubresourceResolution="true"> <jaxrs:serviceBeans> <ref bean="FooBar" /> </jaxrs:serviceBeans> <jaxrs:providers> <bean class="org.apache.cxf.jaxrs.provider.JSONProvider"> <property name="dropRootElement" value="true" /> <property name="supportUnwrapped" value="true" /> </jaxrs:providers> <camelcxf:rsServer id="rsServer" address="/" serviceClass="com.camel.example

apache camel sql component - how to execute only once

浪尽此生 提交于 2019-12-24 08:39:35
问题 I've created/creating a simple Apache Camel program to move data from a source db to a target db. I have configured a route to do this and it works! The problem is that it just keeps executing the root every second or so. I only want it to execute once. I've been playing around with the timer repeatCount but can't quite get the root right. Can anyone help me to try and re-word what i have below so that it only executes once. <bean id="sourceSql" class="org.apache.camel.component.sql

Can I split compressed files into json components in Camel via Spring DSL

Deadly 提交于 2019-12-24 08:34:20
问题 In a nutshell, I need to take a gzipped file containing json very similar to this example, unzip it (I know how to do that), get each json object as a string and push it to AMQ from where it will be popped to a webservice. I'm fine with all of this with one object, but I will be receiving a file that represents an array. If this were an array of strings or xml, I see how Camel processes it, but I don't see a way to split json. Also, this will require streaming as these files can be very large

How to determine the type of the camel exchange object

本小妞迷上赌 提交于 2019-12-24 07:56:30
问题 I have two different services running on a web server. Both the services have an operation named 'xyz', with the following arguments. Service 1: Public String xyx(Student object) {} Service 2: public String xyz(Employee object){} Now i have a client which will invoke the operation of one of these services based on the message that it receives. The message will be received as a camel exchange. So i need to identify the type of the message and then invoke the appropriate service. How do i

Camel mail 2.13.0 searchterm: How to configure multiple from addresses?

核能气质少年 提交于 2019-12-24 07:47:12
问题 I only have to consume mails from the mailbox which are from address x OR address y. How can i configure this in a camel uri? I've only found the searchTerm configuration with 1 address(searchTerm.from=x) 回答1: segment your route using Direct Component, it works like method call for example: <route> <from uri="imap://admin@mymailserver_1"/> <to uri="direct:processMail"/> </route> <route> <from uri="imap://admin@mymailserver_2"/> <to uri="direct:processMail"/> </route> <route> <from uri="direct

OnCompletion() in Apache Camel is called more than once

心已入冬 提交于 2019-12-24 06:41:04
问题 In routeBuilder class it is having many routes, after completion of all routes need to call testMethod() but currently testMethod() method is calling many times .onCompletion().bean(TestProcessor.class,"testMethod").end() //Router Class from(Source).setHeader("message", body()).onCompletion().bean(TestProcessor.class,"testMethod").end(). choice().when(header("camelfilenameonly").contains("test1.csv")) .unmarshal().bindy(BindyType.Csv,Test1CsvDto.class).bean(TestProcessor.class,

CXF & Camel : IllegalArgumentException: Get the wrong parameter size to invoke the out service

爱⌒轻易说出口 提交于 2019-12-24 05:55:08
问题 I recently came across this issue when trying to pass an XML to a Cxf Webservice within apache Camel. Caused by: java.lang.IllegalArgumentException: Get the wrong parameter size to invoke the out service, Expect size 1, Parameter size 2. Please check if the message body matches the CXFEndpoint POJO Dataformat request. at org.apache.camel.component.cxf.CxfProducer.checkParameterSize(CxfProducer.java:241) One of the XML tags included a comma, which seems to be the issue. 回答1: As it turned out,

Apache Camel HTTP display request and response

点点圈 提交于 2019-12-24 05:53:43
问题 I am using Apache Camel to load data from CSV file to a webservice. Is there anyway I can display request and response. Below is the route configuration.. I split and aggregate 100 items from array to be sent as POST body. from(fileLocation) .unmarshal().csv().bean(new CSVConverter(), "process") .split(body()) .aggregate(constant(true), new GroupedBodyAggregationStrategy()) .completionSize(100) .completionTimeout(1000) .marshal().json(JsonLibrary.Jackson) .setHeader("Authorization", simple

how to pass namedQuery parameters in Apache Camel JPA by header?

牧云@^-^@ 提交于 2019-12-24 03:16:48
问题 I have this camel route: from("direct:getUser") .pollEnrich("jpa://User?namedQuery=User.findById&consumeDelete=false"); This is my user Entity: @Entity @NamedQueries({ @NamedQuery(name="User.findAll", query="SELECT u FROM User u"), @NamedQuery(name="User.findById", query="SELECT u FROM User u WHERE u.id = :id") }) public class User{ @Id private String id; } I have tried this route by setting the header: from("direct:getUser") .setHeader("id", simple("myid")) .pollEnrich("jpa://User?namedQuery