apache-camel

camel unit test with cametestsupport, template is always null

妖精的绣舞 提交于 2019-12-11 04:20:02
问题 I am doing a simple unit test with camel. All I want to do is to read a json from a file (under resources), send it to a java class for validation - this is the route that I am trying to test. Whatever I do, the template (which I use to sendBody(json) is always null. Here is my code public class RouteTests extends CamelTestSupport { @EndpointInject(uri = "mock:result") protected MockEndpoint resultEndpoint; @Produce(uri = "direct:start") protected ProducerTemplate template; @Autowired

CamelContext doesn't startup if one route is misconfigured

拥有回忆 提交于 2019-12-11 04:12:45
问题 We use Java DSL to configure our routes. All configurations for routes are in a db table and can be configured via a GUI. How is it possible to ensure that the camelContext starts up even if a route is misconfigured (e.g. .to(invalidurl or typo) in a route or simply a bug in a route)? Is there a possibilty to validate the routes before starting or maybe better some parameters/options which can be set on the context itself? 回答1: You can configure the routes with .autoStartup(false), and then

How to access (get) camel header in java dsl

一个人想着一个人 提交于 2019-12-11 04:08:45
问题 I have a code like - // use streaming to increase index throughput .setHeader(SolrConstants.OPERATION, constant(SolrConstants.OPERATION_INSERT_STREAMING)) // define solr endpoint and options .to("solr://" + getSolrEndPoint() + "?defaultMaxConnectionsPerHost=500&streamingThreadCount=500&maxRetries=3") .log(LoggingLevel.INFO, "Successfully indexed document id [" +header(BatchHeaders.DOCUMENT_ID) +"]") // end this route .end(); But what I m getting in the log is - severity="INFO " thread="Camel

How to upload file to AWS S3 using Camel aws-s3 producer?

会有一股神秘感。 提交于 2019-12-11 03:58:35
问题 I'm trying to upload a jpg file to AWS S3 bucket with Camel's aws-s3 producer. Can I make this work with this approach and if yes how? Now I'm only getting an IOException and can't figure out what would be the next step. I know I could implement the upload using TransferManager from the aws-sdk but now I'm only interested in Camel's aws-s3 endpoint. Here is my route with Camel 2.15.3: public void configure() { from("file://src/data?fileName=file.jpg&noop=true&delay=15m") .setHeader

Akka Camel - JMS messages lost - should wait for initialization of Camel?

被刻印的时光 ゝ 提交于 2019-12-11 03:17:26
问题 My experimental application is quite simple, trying what can be done with Actors and Akka. After JVM start, it creates actor system with couple of plain actors, JMS consumer (akka.camel.Consumer) and JMS producer (akka.camel.Producer). It sends couple of messages between actors and also JMS producer -> JMS server -> JMS consumer. It basically talks to itself via JMS service. From time to time I was experiencing weird behaviour: it seemed that from time to time, first of messages which where

Missing start boundary Exception when sending messages with an attachment file in Tomcat

我的梦境 提交于 2019-12-11 03:07:02
问题 I've found a number of possible matches to this problem but none that work for me. I'm using Apache Camel to deliver a file as an email attachement. It works perfectly using the following maven goals: jetty:run jetty:run-exploded jetty:run-war I'm using java 1.6. My deployment container is tomcat6. In tomcat6 and tomcat7 I get the following exception: org.springframework.mail.MailSendException: Failed messages: javax.mail.MessagingException: Missing start boundary; message exception details

Apache camel processing two csv files simultaneously

妖精的绣舞 提交于 2019-12-11 03:03:29
问题 I am trying to process two .csv files and to persist their data to the database. I am using java dsl and not springs for the same. To explain the scenario a bit better : I am reading two .csv files and processing them to upload their data in the sql database.The steps I performed for this are Specify the engine initialiser in the servlet container file. Create an EngineInitialiser Bind the EngineInitialiser to the core Engine. Create the dao files required to persist the data to the database.

Camel Restlet maxThreads Component Option

谁都会走 提交于 2019-12-11 02:59:52
问题 I have a problem. The apache camel documentation states that for the camel-restlet component (starting from 2.10 version) is possible to define the max number of threads that will service requests (http://camel.apache.org/restlet.html). How can i specify this parameter? This is the route that I made from( "restlet:http://localhost:" + config.getEmergencyRESTPort() + "?restletMethods=post,get&restletUriPatterns=#emergencyUriTemplates&maxThreads=64").process( new EmergencyServerProcessor(config

Simple Expression in apache-camel uri

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 02:46:44
问题 I'm new to apache-camel and know i met a problem. I want to use simple expressions in my uri definition, but i don't know how. For example: from("foo://bar").to("foo://bar?var=${header.varName}"); Is there a way to use such expressions? 回答1: Bernhard http://camel.apache.org/how-do-i-use-dynamic-uri-in-to.html Use the Recipient List EIP pattern, which allows you to compute the dynamic URI using an Expression. For example using the Simple expression language as shown below: recipientList(simple

apache camel simple expression not giving string value

三世轮回 提交于 2019-12-11 02:18:35
问题 I am using apache camel. I am trying to retrieve value from body using simple expression language. I need it as a String but simple returns SimpleBuilder object. So I have tried something like this simple("${body.address.line}").resultType(String.class).getResultType() but it is returning me java.lang.String. please tell me how can I get this expression's result as String? 回答1: That is only for configuring the simple expression. If you need to evaluate it then call the evaluate method String