apache-camel

Use options set on apache camel direct endpoint

好久不见. 提交于 2019-12-10 15:16:35
问题 I am building a routing slip bean and want to apart from the dynamic routing also to send a parameter to the endpoints of the recipients list. I wish to use something like "direct:test?param=value", where param and value are set inside the routing slip POJO From what I understand from the direct component, a single "direct:test" endpoint will receive all the routed exchanges, however I need a way to read the param send from the routing slip How can I use this param to the endpoint which

Enforce socket timeout on ActiveMQ from Camel route?

為{幸葍}努か 提交于 2019-12-10 13:58:32
问题 So below I have Camel (via Spring DSL) successfully integrating my beans with ActiveMQ queues: <!-- Note: this code is just a snippet; if you need to see more, please let me know! --> <camelContext id="my-camel-context" xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="activemq-myinstance:queue:myqueue" /> <onException> <exception>java.lang.Exception</exception> <redeliveryPolicy maximumRedeliveries="2" /> <to uri="activemq-myinstance:queue_failures" /> </onException> <to uri=

Exception using Jackson JSON library with camel

て烟熏妆下的殇ゞ 提交于 2019-12-10 12:57:35
问题 I am having trouble using the Jackson JSON library with camel. The exception is: FailedToCreateRouteException: Failed to create route... because of Data format 'json-jackson' could not be created. Ensure the data format is valid and the associated Camel component is present on the classpath Here is the beginning of classpath notice that the Jackson libs are there: <<< camel-maven-plugin:2.9.0:run (default-cli) @ portlistener <<< --- camel-maven-plugin:2.9.0:run (default-cli) @ portlistener --

Dynamic Drools Endpoint Update in Drools Camel Server

陌路散爱 提交于 2019-12-10 11:45:49
问题 The "User Guide" for Drools 6 states that a camel endpoint for drools shall be in the below format: <to uri="kie:{1}/{2}" /> where {1} : Execution Node identifier that is registered in the CamelContext {2} : Knowledge Session identifier that was registered in the Execution Node with identifier {1} Doubt # 1 : If the sessions are created before the endpoints are built, how the incremental changes in kmodule will be picked up by the sessions created before? Statement about KScanner from the

I want to conditionally split a List if exxchange is a List and continue processing

杀马特。学长 韩版系。学妹 提交于 2019-12-10 11:40:22
问题 I'm trying to conditionally split an exchange into its contents if it is a List, otherwise leave it as a single item and have both go to the same processor I ideally do not want to set up lots of inbetween direct:endpoints to achieve this from( X ) .when( body().isInstanceOf( List.class ) .split( body() ) .setHeader( "x", constant( "I don't care " ) // this needs to be set as split must have at least one child node .process( ? ) // here the exchange.in.body is now a single item from the List

Apache camel:bindy illegal argument exception

北慕城南 提交于 2019-12-10 11:34:49
问题 I am doing data format conversion between POJO to CSV and vice versa. In this while converting CSV to Object file(Unmarshalling) i am getting illegal argument exception for int data type. Only for string its working fine. Below is my POJO @CsvRecord(separator="//|",crlf="UNIX",generateHeaderColumns=false) public class EmployeeVO implements Serializable{ private static final long serialVersionUID = -663135747565879908L; @DataField(pos=1) private String name; @DataField(pos=3) private Integer

Spock mock verify returns 0 invocations

百般思念 提交于 2019-12-10 11:25:09
问题 Im working on a Spring Boot java service that contains a Camel Processor class as follows: public class MyProc implements Processor { @Autowired private LogService logService; public void process(Exchange e) { // exchange object processing logService.update(e) } } And I have the following Spock test: class MyProcTest extends Specification { @Shared def logService = Mock(LogService) @Shared def proc = new MyProc() def ctx = new DefaultCamelContext() def exch = new DefaultExchange(ctx) void

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

旧城冷巷雨未停 提交于 2019-12-10 11:23:18
问题 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(

Error after upgrading camel-cxf to 2.15.2 . Class Cast exception

此生再无相见时 提交于 2019-12-10 09:22:59
问题 After upgrading to apache camel-cxf to 2.15.2 and cxf 3.0.4 I have the following problem when starting up my camel routes. The route does a soap integration with a Payment Gateway. Has any body found a workaround for this? Please see stack trace below. Caused by: javax.ejb.EJBException: org.apache.camel.FailedToCreateProducerException: Failed to create Producer for endpoint: Endpoint[cxf://https://staging.payu.co.za/service/PayUAPI?dataFormat=PAYLOAD&portName=%7Bhttp%3A%2F%2Fsoap.api

Business logic in Camel processors vs service endpoints

瘦欲@ 提交于 2019-12-10 03:48:55
问题 In a Camel route, should I be thinking about putting my business logic in a discretely hosted bean endpoint, like a message-driven bean or a web service, vs just implementing it in Camel processors? It seems like cleaner separation of concerns to use Camel just for mediation & orchestration, using Processors as filters, rather than as a container for business logic. However I don't forsee the need for an EJB container at this time, and it seems like I'd need one to host MDBs. So cleaner