apache-camel

Spring Transaction Synchronization of JDBC and JMS

不羁岁月 提交于 2019-12-03 05:55:02
问题 I have a spring web app running on jboss that is currently configured to use the HibernateTransactionManager for db transactions and the JmsTransactionManager for jms. For jms we use Camel and ActiveMQ, our database is DB2. Within a transaction I need to write a number of records to the database and send two asynchronous jms messages. The jms messages are event notifications and I only want them to be sent if the database transaction commits. I am willing to accept the risk of the

Camel - Exception handling in 'sub routes'

无人久伴 提交于 2019-12-03 05:44:05
Camel explicitly handles two 'scopes' of error handling: Global per Route The issue I'm having is exceptions thrown in a 'sub route'. For instance, I've got this route: from("direct:sendToWebservice"). .processRef("massageBeforeSending"). .to("http://webservice.com"). .processRef("massageResponse"); Then I've got two other routes that need to send messages to the webservice: from(direct:fromSystemA"). .errorHandler(deadLetterChannel("direct:TellSystemA")). .to("direct:sendToWebservice"); from(direct:fromSystemB"). .errorHandler(deadLetterChannel("direct:TellSystemB")). .to("direct

How do I marshall nested key,value pairs into JSON with Camel and Jackson library?

眉间皱痕 提交于 2019-12-03 04:37:37
I have a Java project that currently returns a map to Camel without any nested key,value pairs, and the Jackson library marshalls it just fine into JSON using the Jackson library. For example if I put the following two key,values into a demoMap: Map<String,String> demoMap = new TreeMap<String,String> demoMap.put("key1","5"); demoMap.put("key2","10"); I get the following JSON: {"key1":"5","key2":"10"} However, now some of my key,value entries will have an optional visibility that I need to put as a nested key value in my map. Any key,values that don't have an optional visibility will use the

Apache Camel ftp consumer loads the same files again and again

穿精又带淫゛_ 提交于 2019-12-03 04:33:31
I have following spring configuration <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> <bean id="downloadLogger" class="com.thomsonreuters.oa.sdi.camel.DownloadLogger" /> <bean id="fileFilter" class="com.thomsonreuters.oa.sdi.camel.IgnoreReadyFilesFilter" /> <camelContext

How can I validate xsd using apache camel?

丶灬走出姿态 提交于 2019-12-03 03:48:31
I'm using apacheservicemix and I try to validate a xml document with apache camel. I have this route called students_route.xml : <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> <camelContext xmlns="http://camel.apache.org/schema/blueprint"> <route> <from uri="file:project/students.xml"/> <doTry> <to uri="validator:file:project/students.xsd"/> <to uri="file:valid"/>

Work Flow in Camel vs BPM

◇◆丶佛笑我妖孽 提交于 2019-12-03 03:04:02
We have used Apache camel as a Workflow engine.First Wehave WebService One and wait for the response and based on the response call WebService 2 or WebService 3.Its a pure WorkFlow and have couple of WorkFlow Steps like this.I have got less chances to work on a BPM product , like JBOSS BPM etc. Other than long running and support for human task any other good reason we have to choose a BPM product ? If both long running and human task support are not needed in our project can we use Camel or JBOSS FUSE to orchestrate business processes ? Thanks, Leo. salaboy Yeah.. as Antoine mention, from the

Apache Camel : “direct:start” endpoint - what does it mean ?

无人久伴 提交于 2019-12-02 21:37:32
I'm new to Apache Camel. Can someone explain what "direct:start" means in Camel. Please see http://camel.apache.org/http from("direct:start") .to("http://myhost/mypath"); Thanks. The "direct:start" above is simply saying that the route starts with a Direct Component named "start". The direct endpoint provides synchronous invocation of a route. If you want to send an Exchange to the direct:start endpoint you would create a ProducerTemplate and use the various send methods. ProducerTemplate template = context.createProducerTemplate(); template.sendBody("direct:start", "This is a test message");

Dynamic routing Apache Camel

雨燕双飞 提交于 2019-12-02 18:31:48
问题 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

Camel saves full http request but I want only attached file

人走茶凉 提交于 2019-12-02 16:28:24
问题 I have the following code base: @Component public class DummyRoute extends RouteBuilder { @Override public void configure() throws Exception { rest("/upload").post().to("file://rest_files"); } @Bean public ServletRegistrationBean servletRegistrationBean() { SpringServerServlet serverServlet = new SpringServerServlet(); ServletRegistrationBean regBean = new ServletRegistrationBean( serverServlet, "/rest/*"); Map<String,String> params = new HashMap<>(); params.put("org.restlet.component",

Apache Camel: Do I need to make my FTP-Consumer route transactional?

心已入冬 提交于 2019-12-02 16:00:52
问题 I have these FTP endpoint properties: include=.*.xml&delay=60s&consumer.bridgeErrorHandler=true&throwExceptionOnConnectFailed=true&binary=true&move=.done&soTimeout=300000 So an endpoint need to search every 60 secounds the *.xml files and consume it. After that the files will be proceed and moved in 'done' directory. I'm afraid that if f.e. by doing the move of a file an IOException occures, the file will already be deleted from the endpoint root directory. The question is: do I need to make