apache-camel

JSON to JSON transformation (preferably inside Apache Camel)

好久不见. 提交于 2021-02-08 03:00:35
问题 I have somewhat unique requirement, which I could not find an answer to so far. I need a JSON to JSON transformation. Preferably, if I could plug it into Apache Camel, that would be wonderful. As a side note, I would also welcome any suggestion to optimally store the JSON to JSON mapping. Is there any XSLT-based way of achieving this? Thanks! Mario 回答1: ZORBA with jsonIQ : http://www.jsoniq.org/ it's a native library, but with high performance. You have examples in the web page. 回答2: There is

How to send a response back over a established TCP connection in async mode using Apache Camel Netty4?

末鹿安然 提交于 2021-02-07 13:25:00
问题 I'm building a micro-service that has an Apache Camel route using Netty4 Component (http://camel.apache.org/netty4.html) in consumer mode. So, in my micro-service, this route that I'm building, will receive messages over a a TCP connection. To do that, I did this: @Override public void configure() throws Exception { this.from("netty4:tcp://localhost:7000?textline=true&encoding=utf8") .process(new Processor() { @Override public void process(final Exchange exchange) throws Exception { log.info(

Get and format yesterday's date in Camel's expression language

霸气de小男生 提交于 2021-02-07 11:45:36
问题 I am using the date in a path in Camel: fileName=${date:now:dd-MM-yyyy} but what I need is now - 1 day. Is that possible? 回答1: Well, not directly. The date: object in the simple language can only grab the current time (or some time value you have placed inside a header - which you could do in java or similar. But you could also do like this. Create a class: public class YesterdayBean{ public String getYesterday(){ Calendar cal = Calendar.getInstance(); DateFormat dateFormat = new

How to trigger Apache camel route from my java method

此生再无相见时 提交于 2021-02-07 11:13:51
问题 I am new to Apache Camel. My requirement is to trigger an Apache camel route in my code flow from method A(). Also I need to pass the object param of A() to the route. I do not want to use amq, file etc components. code : public void A(MyObjectType param) { //Need to call camel route with "param" } What's the best way to do this? 回答1: You can use the ProducerTemplate option, ProducerTemplate template = exchange.getContext().createProducerTemplate() and then you can do template.sendBody The

How to trigger Apache camel route from my java method

时光怂恿深爱的人放手 提交于 2021-02-07 11:13:47
问题 I am new to Apache Camel. My requirement is to trigger an Apache camel route in my code flow from method A(). Also I need to pass the object param of A() to the route. I do not want to use amq, file etc components. code : public void A(MyObjectType param) { //Need to call camel route with "param" } What's the best way to do this? 回答1: You can use the ProducerTemplate option, ProducerTemplate template = exchange.getContext().createProducerTemplate() and then you can do template.sendBody The

How to authorize using Apache Camel?

匆匆过客 提交于 2021-02-07 10:30:44
问题 I have to make a POST request curl -X POST --data-binary @auth.json http://somehost.com/auth { "response": { "status": "OK", "token": "622cee5f8c99c81e87614e9efc63eddb" } } , and this will return a JSON response with the token. auth.json is a JSON file with login and password. I then have two options: put the token in the header in future requests as "Authorization: TOKEN", or put it in a cookie and make other requests. How can I do it with Apache Camel? How can I receive HTTP response? Where

How to authorize using Apache Camel?

只愿长相守 提交于 2021-02-07 10:28:39
问题 I have to make a POST request curl -X POST --data-binary @auth.json http://somehost.com/auth { "response": { "status": "OK", "token": "622cee5f8c99c81e87614e9efc63eddb" } } , and this will return a JSON response with the token. auth.json is a JSON file with login and password. I then have two options: put the token in the header in future requests as "Authorization: TOKEN", or put it in a cookie and make other requests. How can I do it with Apache Camel? How can I receive HTTP response? Where

Spring Boot Camel Testing

不想你离开。 提交于 2021-02-07 09:21:02
问题 I need to test Camel routes in a Spring Boot Application. I've the Spring boot main class with all the necessary beans declared in it. I am using the CamelSpringJUnit4ClassRunner.class. Added my Spring boot main class in @ContextConfiguration as it contains all the configurations. I don't have a separate configuration class. I 've autowired CamelContext in my Test class: @Autowired CamelContext camelContext; But the test fails with the error: Caused by: org.springframework.beans.factory

Spring Boot Camel Testing

≯℡__Kan透↙ 提交于 2021-02-07 09:20:27
问题 I need to test Camel routes in a Spring Boot Application. I've the Spring boot main class with all the necessary beans declared in it. I am using the CamelSpringJUnit4ClassRunner.class. Added my Spring boot main class in @ContextConfiguration as it contains all the configurations. I don't have a separate configuration class. I 've autowired CamelContext in my Test class: @Autowired CamelContext camelContext; But the test fails with the error: Caused by: org.springframework.beans.factory

Apache ActiveMq Artemis client reconnecting to next available broker in clustered HA replication/shared-data store

ε祈祈猫儿з 提交于 2021-02-05 11:40:29
问题 Broker.xml (host1) and host2 just the port number changes to 61616 and slave as configuration. In reference with Apache Artemis client fail over discovery <?xml version="1.0" encoding="UTF-8" standalone="no"?> <configuration xmlns="urn:activemq" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:activemq /schema/artemis-configuration.xsd"> <core xmlns="urn:activemq:core"> <bindings-directory>./data/bindings</bindings-directory> <journal-directory>./data/journal<