apache-camel

How to aggregate one message into multiple group with camel aggregate?

萝らか妹 提交于 2019-12-11 10:46:42
问题 I'm trying to generate a aggregate view of consecutive market data, which means we need to calculate the sum value every 2 message. say the data coming in as: (V0,T0),(V1,T1),(V2,T2),(V3,T3).... V means value T means timestamp when we receive the data. We need to generate the sum for every 2 points say: (R1=Sum(V0,V1),T1),(R2=Sum(V1,V2),T2),(R3=Sum(V2,V3),T3),.... Any suggestion how can we do this by using aggregator2 or we need to write a processor for this? 回答1: You are right, aggregator2

Apache Camel multipart route

旧街凉风 提交于 2019-12-11 10:36:51
问题 I'm trying to route a file to HTTP file upload API via Apache Camel. But I'm getting following exception org.apache.camel.InvalidPayloadException: No body available of type: java.io.InputStream but has value: org.apache.http.entity.mime.MultipartFormEntity@71ef4d4f of type: org.apache.http.entity.mime.MultipartFormEntity on: org.apache.camel.component.file.GenericFileMessage@7e693963. Caused by: No type converter available to convert from type: org.apache.http.entity.mime.MultipartFormEntity

Migrate Apache Camel Endpoints

ぃ、小莉子 提交于 2019-12-11 10:19:12
问题 I have recently started with Apache Camel so apologies if this questions is silly. I have 2 processes A and B, and each process has an endpoint E1 and E2 respectively. Now let's imagine that I need to create a process C and that process B has to die. Can I migrate E2 to C and connect it through a route to E1 in process A? It is important to notice that A, B and C may be in different machines as well. I google for process migration in Camel, but all I found were articles referring to JBoss

Apache Camel Content Based Routing on Websocket Connections

∥☆過路亽.° 提交于 2019-12-11 10:16:05
问题 I have a hypothetical scenario: let’s pretend I have an Apache Camel websocket server and I’m allowing many websocket connections. Each client connection will need to be associated with a ClientID. The ClientID is obtained by a new connection via an InitConnection json message where a ClientID is a member of the message. The question is: is it possible to have camel associate a websocket instance with a ClientID in order to perform content based routing? 回答1: yes, It is possible. you can

How to extract substring IN JSON PATH using CAMEL

微笑、不失礼 提交于 2019-12-11 09:59:18
问题 I am trying to configure my routes based on the substring of value from an attribute. For example, I have this Json Attribute: { "carColor": "Red/hatchback" } There are other possibilities such as "Blue/Sedan" and "Black/SUV" etc. I would like to extract the colors only. Meaning I would like to extract the colors before the "/" sign like "Red", "Blue, "Black" etc. This is what I have at the moment: <when> <jsonpath>$.root[?(@.carColor == 'Red')]</jsonpath> <to uri="redCar"/> </when> I know it

Apache Camel : File to BeanIO and merge beanIO objects based on id

隐身守侯 提交于 2019-12-11 09:47:44
问题 I have the usecase to read employee, address and contact files in parallel and convert that to beanIO object and merge the beanIO object to produce the complete employeeDetails object. Emp File: 1 Foo Engineer 2 Bar AssistantEngineer Emp Contact File: 1 8912345678 foo@org.com 2 7812345678 bar@org.com Emp Address File: 1 city1 1234 2 city2 2345 Expected output in a EmployeeDetailsBeanIODataFormat object in Exchange: 1 Foo Engineer foo@org.com city1 1234 2 Bar AssistantEngineer bar@org.com

Not getting http response body when using camel producertemplate and http

人走茶凉 提交于 2019-12-11 09:37:30
问题 I am trying to invoke my simple GET rest service call using producertemplate as specified on http://camel.apache.org/http.html. I have used google.com as an example here. This is from a standalone client not running on any container. What am i not doing right here? SpringCamelContext camelcontext = (SpringCamelContext) springContext.getBean("camelcontextbean"); ProducerTemplate template = camelcontext.createProducerTemplate(); camelcontext.start(); Exchange exchange = template.send("http:/

Apache Camel Kafka support for Confluent schema Registry

孤街浪徒 提交于 2019-12-11 09:01:23
问题 I am trying to create camel route with kafka component trying to consume events with io.confluent.kafka.serializers.KafkaAvroDeserializer and schemaRegistry url along with other component parameters. I am not sure if this is full supported by Camel-Kafka currently. Can someone please comment on this ? from("kafka:{{kafka.notification.topic}}?brokers={{kafka.notification.brokers}}" + "&maxPollRecords={{kafka.notification.maxPollRecords}}" + "&seekTo={{kafka.notification.seekTo}}" + "

Locking file while appending data on Camel

我与影子孤独终老i 提交于 2019-12-11 08:46:10
问题 I am writing 2 routes to process a files in a directory, those files could have any name, but I need 2 routes as I need some complex processing. First route: <route id="Init"> <from uri="file:{{file.path}}?move=.done&moveFailed=.error&readLock=changed&readLockCheckInterval=1500&charset=UTF-8"/> <transacted/> <split streaming="true" stopOnException="true" shareUnitOfWork="true" parallelProcessing="false"> <tokenize token="\r\n"/> <choice> <when> <simple>${body.substring(0,4)} == 4000</simple>

Overriding or Intercepting Camel Logging

試著忘記壹切 提交于 2019-12-11 08:26:55
问题 An existing application uses Camel logging (bog the "log()" DSL, and also the Log component. We would like to either intercept or override so that every log message also logs out a specific Header value (e.g. x-correlation-id=ABC-123) What is a good, idiomatic way to achieve this? 回答1: Apache Camel supports pluggable LogListener since version 2.19.0 . This is pretty powerful, because its method onLog , which is invoked right before logging, have instances of Exchange , CamelLogger and message