apache-camel

Proxy authentication with Camel using ProducerTemplate

匆匆过客 提交于 2019-12-02 09:15:32
I have a project that's using Camel and running on a ServiceMix server, but I can't seem to get it to access external web services, and I suspect it's because I can't set the proxy authentication properly. Exchange exchange = producerTemplate.request(url, new Processor() { public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader(Exchange.HTTP_METHOD, "POST"); exchange.getIn().setHeader(Exchange.CONTENT_TYPE, "application/json"); } }); response = exchange.getOut().getBody(String.class); If I put a breakpoint on the last line, I see a ConnectionTimedOutException in

How to get Camel FTP to fetch only once on demand

怎甘沉沦 提交于 2019-12-02 08:58:12
I'm fairly new to Camel. I've been trying to get Camel to fetch a single file via FTP only once, on demand. I couldn't get it to work. Here is what I've tried. Let me know what is the best approach and what is wrong with my code. 1- Send an empty message after the file was read and when the empty message is received, stop the route. from("direct:myStart") .routeId("routeA") .pollEnrich("ftp:...disconnect=true&sendEmptyMessageWhenIdle=true") .choice() .when(body().isNull()).process(RouteStopper("routeA")) .otherwise().to("validator:file.xsd") .to("somewhere") .end(); And my RouteStopper public

Dynamic routing Apache Camel

会有一股神秘感。 提交于 2019-12-02 08:27:40
Is there some solution to create a camel route dynamically, in time execution? In a common way, we explicitly define a camel route as: from("direct:a") .to("direct:b"); However, I want to create some routes in time execution when be required. For example, from a property file, the application will read the properties and create the routes using the properties. I'll have the code: from({property1}) .to({property2}); If exists one more property file the application must create dynamically another route and add it in the camel context. Is that possible, someone can help me? To create camel route

Camel RaabitMQ Acknowledgement

让人想犯罪 __ 提交于 2019-12-02 07:55:51
I am using Camel for my messaging application. In my use case I have a producer (which is RabbitMQ here), and the Consumer is a bean. from("rabbitmq://127.0.0.1:5672/exDemo?queue=testQueue&username=guest&password=guest&autoAck=false&durable=true&exchangeType=direct&autoDelete=false") .throttle(100).timePeriodMillis(10000) .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { MyCustomConsumer.consume(exchange.getIn().getBody()) } }); Apparently, when autoAck is false, acknowledgement is sent when the process() execution is finished (please correct me if

Set TTL Apache Camel JAva DSL

允我心安 提交于 2019-12-02 07:47:49
How do you set the TTL for a message when using Java DSL? I have something like this: ... from ("timer:something?delay=3000&period=15000") ... .to("{{some.property}}") .end() ... I want to set a time to live on the message being sent. I ended up setting the JMSExpiration header field of the messages being created similar to the following .setHeader("JMSExpiration", constant(System.currentTimeMillis() + 1000)) We are using Apache ActiveMQ 5.7. I assume TTL means Time to Live. In Camel this is component specific how they deal with this. Some components support this, and others do not. You should

Size Limit of camel header variable and property

余生颓废 提交于 2019-12-02 05:56:43
I have to store the request xml in to database. I was using header variable to do that. exchange.getIn().setHeader("inputRequestXml", body); it was working for some files And I was getting below exception for some files, it seems like because of the file size. 413 Request entity too large So I have changed the implementation by using camel property, like below exchange.setProperty("inputRequestXml", body); Now I am not getting the exception. But I am afraid that will it handle the bigger files in actual PROD environment. So i want to know, What would be the size limit of header variable and

Validation error with integer property (camel)

孤者浪人 提交于 2019-12-02 05:46:34
问题 I'am using OSGi Configuration Properties in Blueprint Camel (v 2.13.2) and everything was fine until I tried to properties a integer property : timePeriodMillis in tag. This code works nice : <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf" xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0

Apache Camel - IBM MQ integration

我是研究僧i 提交于 2019-12-02 05:42:34
I have a Apache camel (version 2.18) project that sends a file to my partner's IBM MQ server by IBM MQ client. However, my partner uses the messageId as the filename, thus, we have to set specific filename to messageId . My question is how we can change the messageId ? I tried to add JMS_IBM_MQMD_MsgId or MsgId or modify the JMSMessageId in JMS header before I send the file to the IBM MQ server, but it doesn't work. Do you have any solution? Here is the code in spring file. For example, before we send JMS to my partner's server. We set the below key/value to JMS header: exchange.getIn()

How to transactionally poll Kafka from Camel?

坚强是说给别人听的谎言 提交于 2019-12-02 04:39:39
问题 I'm currently working on message bus based on kafka and managed by camel and Spring. I have a XML route definition to poll events and retrieve the corresponding complete business objects from an external API that looks like that : ` <route id="station-event-enrich-route" autoStartup="true" > <from uri="kafka:{{kafka.cluster.url}}?brokers={{kafka.cluster.url}}&topic={{events.topic.name}}&autoCommitEnable=false&allowManualCommit=true&maxPollRecords={{station.brocker.bulk.limit}}&groupId={{kafka

How to send message to different Queue hosted in different queue manager and hostname in IBM MQ cluster

偶尔善良 提交于 2019-12-02 04:18:09
My Apache-camel based app is consuming message from one of IBM queue, for e.g. below is the details for connection factory hostname=host1000 QManager=QM1000 Port="some port" Channel="common channel" Camel flow to consume and process and send the response to ReplyQueue which is coming from message header. from(wmq:queue:<INPUT_QUEUE>) .bean("processBean") .bean("beanToSendMsgToReplyQueue") In camel header I am getting below JMSReplyQueue. You can see that it's a different Queue manager and this queue manager is from different host but in a clusters environment. JMSReplyTo = queue://QM1012/TEST