apache-camel

Clustering in Apache Camel: Multiple JVMs Same CamelContext

老子叫甜甜 提交于 2020-08-02 18:47:18
问题 I have one application that we deploy on a cluster. The cluster might have 2 or 4 JVMs as per the environment. The application has same CamelContext which we are deploying on all the JVMs. Hence, all the JVMs have same routes. For FTP routes, that is good as it makes it competitive and only 1 JVM gets the files. However, while using timer based operation to fetch from DB, I see that all the JVMs read the same set of records and do the same job. What I want is, if one route picks it up, the

Clustering in Apache Camel: Multiple JVMs Same CamelContext

霸气de小男生 提交于 2020-08-02 18:43:31
问题 I have one application that we deploy on a cluster. The cluster might have 2 or 4 JVMs as per the environment. The application has same CamelContext which we are deploying on all the JVMs. Hence, all the JVMs have same routes. For FTP routes, that is good as it makes it competitive and only 1 JVM gets the files. However, while using timer based operation to fetch from DB, I see that all the JVMs read the same set of records and do the same job. What I want is, if one route picks it up, the

How to update a lambda function using apache camel?

ⅰ亾dé卋堺 提交于 2020-07-22 05:51:22
问题 I hava a camel rest api which is supposed to update my existing function in aws lambda. The code is like so -> .post("lambda-update-function") .route() .process(new Processor(){ @Override public void process(Exchange exchange) throws Exception { exchange.getIn().setHeader("CamelAwsLambdaS3Bucket", "bucketName"); exchange.getIn().setHeader("CamelAwsLambdaS3Key", "aws1.zip"); } }) .to("aws2-lambda://functionName?accessKey=insert&secretKey=insert&region=us-east-1&operation=updateFunction")

How to do custom error handling in an apache camel rest api?

孤者浪人 提交于 2020-07-16 08:00:29
问题 I have an apache camel rest api which downloads a file from S3. I send json input (key, bucketname, accessKey, secretKey, region) in order to write the URI. The code looks like this: public static class HelloRoute extends RouteBuilder { @Override public void configure() { rest("/") .post("file-from-s3") .route() .setHeader(AWS2S3Constants.KEY, key) .to("aws2-s3://bucketname?accessKey=INSERT&secretKey=INSERT&region=INSERT&operation=getObject") .endRest(); } } I am able to get the respective

How to setup transaction in Camel JMS Route

青春壹個敷衍的年華 提交于 2020-07-10 07:02:23
问题 How do I setup transaction in JMS route to rollback or not consume a message when an exception occurs. Below is my route. MQ is ActiveMQ. from("jms:queue:myQueue") .routeId("myRoute") .doTry() .toF("reactive-streams:myStream") .doCatch(Exception.class) .process(exchange -> exchange.getFromEndpoint().stop()) .end();` 回答1: Simply adding transacted did the job! Also, had to enable connection pooling and camel-jms-starter (for default factories). from("jms:queue:myQueue?transacted=true") .routeId

Camel Multiple Consumers Implementation Issue

萝らか妹 提交于 2020-07-09 14:39:07
问题 Let's say I have a Job Scheduler which has 4 consumers A, B, C and D. Jobs of type X will have to be routed to Consumer A, type Y to Consumer B and so on. Consumers A, B, C and D are to run as independent applications without any dependency, either locally or remotely. The consumers take varying times to complete their jobs, which are subsequently routed to the Job Scheduler for aggregation. Clones of one of the consumers may also be needed to share its eligible jobs. A job should however be

JsonMappingException with Apache Camel

主宰稳场 提交于 2020-07-09 05:37:51
问题 I am getting below exception with Camel Route Caused by: com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class org.apache.camel.converter.stream.InputStreamCache and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:284) at com.fasterxml.jackson.databind.SerializerProvider.mappingException(SerializerProvider

Camel : How to set matchOnUriPrefix=true for jetty component configured in <restConfiguration>

穿精又带淫゛_ 提交于 2020-06-29 11:26:14
问题 I have following camel routing configuration. <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> <!-- Rest Configuration --> <restConfiguration component="jetty" port="9092" bindingMode="auto"> <dataFormatProperty key="json.in.disableFeatures" value="FAIL_ON_UNKNOWN_PROPERTIES" /> </restConfiguration> <rest path="/" consumes="application/json" produces="application/json"> <post uri="/" type="com.aaa.xxxx.esb.config.xxxxEsbJsonMapping"> <route> <setHeader headerName=

Camel Kafka Version 2.14.3 unable to read messages

99封情书 提交于 2020-06-29 06:43:11
问题 I have a Kafka cluster(version : 0.10.1.0), with 9 brokers and 10 partitions. I tried consuming messages from a java application using camel kafka 2.14.3 . Here is my camel route <route id="ReadFromTopic"> <from uri="kafka:[[broker.list]]?topic=[[topic]]&zookeeperHost=[[zookeeper.host]]&zookeeperPort=[[zookeeper.port]]&groupId=[[consumer.group]]&consumerStreams=[[concurrency]]" /> <log message="Message Read from kafka topic : [[topic]]" loggingLevel="INFO" /> <log message=" BODY is ${body}"

How to manually ack/nack a PubSub message in Camel Route

无人久伴 提交于 2020-06-28 08:16:29
问题 I am setting up a Camel Route with ackMode=NONE meaning acknowlegements are not done automatically. How do I explicitly acknowledge the message in the route? In my Camel Route definition I've set ackMode to NONE. According to the documentation, I should be able to manually acknowledge the message downstream: https://github.com/apache/camel/blob/master/components/camel-google-pubsub/src/main/docs/google-pubsub-component.adoc "AUTO = exchange gets ack’ed/nack’ed on completion. NONE = downstream