spring-camel

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

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

Using Circuit Breaker with camel -ThrottlingExceptionRoutePolicy

≯℡__Kan透↙ 提交于 2020-01-03 03:28:11
问题 There is a route which is consuming messages from a jms queue and after doing some processing sending a request to unreliable web service(Which can be down at times). So in case of service is down then i need to stop consuming from queue for some time. I tried to use ThrottlingExceptionRoutePolicy . It will stop route as per configuration but issue is for the current message which gets the error as message is getting moved to dead letter queue. I've gone through the code of

Camel DataFormat Jackson using blueprint XML DSL throws context exception

陌路散爱 提交于 2019-12-22 01:35:05
问题 No matter where I place the dataformats in XML DSL blueprint, I get this error just starting at different places. if I remove it, it works but of course I can't convert JSON to POJO. ??? any help or tell me what I'm doing wrong, what i'm missing. thanks! Error Unable to start blueprint container for bundle passthrumt1.core/1.0.1.SNAPSHOT Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'endpoint'. One of '{"http://camel.apache

org.apache.camel.NoTypeConversionAvailableException: No type converter available to convert from type:

梦想与她 提交于 2019-12-20 04:19:19
问题 I have multipart file in the first place and I want to send it to camel pipeline and save this file with original name. my code: @Autowired ProducerTemplate producerTemplate; ... producerTemplate.sendBody("seda:rest_upload", multipartFile); on another side I have: from("seda:rest_upload").convertBodyTo(File.class).to("file://rest_files"); And also I try to register converter: @Converter public class MultiPartFileToFileConvertor { @Converter public static File toFile(MultipartFile

Could not save date field as ISO date in mongo db via Camel?

妖精的绣舞 提交于 2019-12-19 11:48:27
问题 I have pojo like this: @Document(collection = "data") public class DataPoint { @Id private String id; private LocalDateTime createdDate; .... } in some code base I have following code: @Autowired private ProducerTemplate producerTemplate; ... final List<DataPoint> dataPoints =.... producerTemplate.sendBody("mongodb:mongoBean?database=" + mongoDataConfiguration.getDatabase() + "&createCollection=true&operation=insert&collection=" + mongoDataConfiguration.getDataPointCollection(), dataPoints);

Apache Camel timeout synchronous route

我怕爱的太早我们不能终老 提交于 2019-12-12 10:17:52
问题 I was trwing to construct a synchronous route with timeout using Apache Camel, and I couldn't find anything in the framework with resolve it. So I decided to build a process with make it for me. public class TimeOutProcessor implements Processor { private String route; private Integer timeout; public TimeOutProcessor(String route, Integer timeout) { this.route = route; this.timeout = timeout; } @Override public void process(Exchange exchange) throws Exception { ExecutorService executor =

apache camel - seda endpoint multicast

断了今生、忘了曾经 提交于 2019-12-11 17:16:36
问题 from("seda:start) .multicast(new GroupedBodyAggregationStrategy()) .parallelProcessing() .to("seda:process1", "seda:process2") .end() .to("seda:join"); The plan is for process1 and process2 to run in parallel and for its output to be available on join endpoint. Above is working fine if on "direct", but on "seda" the behavior is that the "join" is getting invoked immediately even though process1 and process2 is still in progress. I have tried adding the following options to process1 and