apache-camel

Camel: importing routeContext into an external camelContext

主宰稳场 提交于 2019-12-14 03:16:21
问题 I have a camel context in project A: <camelContext id="camelContext"> <route id="camelRoute1"> <from uri="vm:foo" /> <log message="camelRoute1 completed" /> </route> </camelContext> Project B and project C use project A as a Maven dependency. Each one of the projects B and C defines their own <routeContext> (in separate xml files): Project B: <routeContext id="bRoutes" xmlns="http://camel.apache.org/schema/spring"> <route id="barB"> <from uri="direct:barB"/> <to uri="mock:barB"/> </route> <

Camel Context cvc 2.4.2 error which doesnt find the camelContext

こ雲淡風輕ζ 提交于 2019-12-14 03:12:42
问题 I know and had been through a lot of similar problems like this. But still i am not getting where i am missing out. I have specified the latest xsds in name space. Still i get the error when i run in Web Sphere. But i dont get any problems with Tomcat. <beans xmlns="http://www.springframework.org/schema/beans" xmlns:camel="http://camel.apache.org/schema/spring" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:cxf="http://camel

Apache Camel XPath with nodelist

我的梦境 提交于 2019-12-14 02:05:42
问题 I would like to concatenate all values from the Apache Camel XPath result and add it to the message context. The header should look like: "|value1|value2|valueN|" My route looks like: from("direct:test") .setHeader("key").xpath("//Identifier", List.class) .to("mock:result") What is the best way for doing that? Is there a way to implement an own result type? Thanks 回答1: As Willem said, you have to write your own processor. For such a little thing, my favourite way is to declare a function in

Apache Camel context getting stopped automatically

∥☆過路亽.° 提交于 2019-12-13 22:40:37
问题 I have a weird issue. Everything works perfectly when i run from IDE. Camel context gets stopped automatically when i run from console. What is causing the issue? Logs attached. 10:04:22.015 [Thread-3] DEBUG o.a.c.i.c.AnnotationTypeConverterLoader - Found 3 packages with 16 @Converter classes to load 10:04:22.079 [Thread-3] DEBUG o.a.c.i.c.AnnotationTypeConverterLoader - Loading file META-INF/services/org/apache/camel/TypeConverter to retrieve list of packages, from url: jar:file:/C:/projects

How to send text message instead of byte message

泄露秘密 提交于 2019-12-13 20:00:27
问题 I am building a camel route using blueprint.xml that talks to my JMS queue. I have been getting mysterious errors where my spring boot app that acts as a consumer for my queue is sending my xml as a byte message instead of text message and the Spring consumer chokes on this. Here are the two messages, the text one works: 2016-06-24 07:08:22,671 | INFO | Sending message: ActiveMQBytesMessage {commandId = 8, responseRequired = true, messageId = ID:ThomasLaptop-54711-1466766502054-1:1:2:1:1,

Apache Camel - Re-consume JMS message after X minutes, after Transaction Rollback

亡梦爱人 提交于 2019-12-13 18:12:11
问题 I'm using Apache Camel, SpringBoot and WMQ in my application to connect to an external service. When the connection to this service fails e.g. when the service is down, I'm rolling back the message to the input queue using JMS transaction. However, the messages are re-consumed instantly after redelivery, which is not what I want. I'd like the messages to be consumed again but after say every 30 minutes giving the external service enough time to come back up. Is there a way to configure this

Camel REST Bean Chaining

别等时光非礼了梦想. 提交于 2019-12-13 14:23:48
问题 I currently have a REST route builder that looks as follows: rest("/v1") .post("/create") .to("bean:myAssembler?method=assemble(${in.header.content})") .to("bean:myService?method=create(?)"); The bean myAssembler takes raw JSON and transforms this into MyObject. This object is then returned and I want it forwarded onto myService as a parameter for its create method. How can I do this using Camel? 回答1: Your beans will bind automatically to specific parameters like Exchange if you put it as a

Camel: How to skip multiple header lines in CSV files

人盡茶涼 提交于 2019-12-13 07:29:28
问题 I'm going to process CSV files using Apache Camel. My files have multiple header lines. In Camel I only find skipFirstLine or skipHeaderRecord (which is not clear for me) but how to skip more than one line? 回答1: If the number of lines to skip is fixed, then you can use the simple language to skip X number. You likely need to covert the message to a String first, .convertBodyTo(String.class) .transform(simple("${skip(3)}") See more about skip method at: http://camel.apache.org/simple This

Throttling based on time interval

主宰稳场 提交于 2019-12-13 07:18:55
问题 I have 4 queues in ActiveMq and messages from each queue should be sent out to external service, for picking up the messages from queue i am using Apache Camel and i am throttling the messages. But my problem here is for different queues i have different social hours, For E.g. Queue 1 messages should be sent only between 6AM to 5PM, Queue 2 messages should be sent only between 10AM to 10PM like that. So i want to know can we handle this using Apache camel throttling. Or please suggest me some

How to detect loss of JMS Topic connection

江枫思渺然 提交于 2019-12-13 06:27:58
问题 We have swing GUI clients that are connecting to a server process. The clients 'call' services on the server using jms:queue 'from' endpoints defined in Camel routes, and using ActiveMQ as the underlying JMS broker. However, the client also offers a Camel jms:topic endpoint for the server to broadcast messages back to the client. Unfortunately, it looks like the topic connection is getting lost somehow, and although the client can still 'call' the services on the server, the server cannot