apache-camel

apache camel how to get header attributes from sql-component

╄→гoц情女王★ 提交于 2019-12-11 02:17:27
问题 I'm new to Apache Camel and I've stared to write an application that grabs data from one database and inserts it to another database. I'm using the sql component and am trying to figure out how to grab the CamelSqlUpdateCount, CamelSqlRowCount and CamelSqlQuery from the message header using spring dsl. I know that I can get attributes in the data using this.... <log message="Processing product ${body[product_id]}"/> But when I try to grab data from my header after my insert like this... <from

camel how to process json with streaming mode?

℡╲_俬逩灬. 提交于 2019-12-11 01:14:09
问题 In order to read json and unmarshal in streaming mode what options are available in Camel OOB ? If not out of box how can this be implemented ? I found camel-xstream which might help. Is streaming mode a default of this or do we need to do something else to make it read in streaming mode ? There is also jackson streaming api. Is that accessible with camel ? Some examples would help. Thanks 回答1: You can use JSON data format, to to marshal and unmarshal Java objects to and from JSON. Some thing

Serving static files with camel routes

痴心易碎 提交于 2019-12-11 00:57:08
问题 I am trying to serve a static file in camel routes. The routes in my main class contains this piece of code: public final void configure() throws Exception { // declaring camel routes // match on uri prefix must be true when parameters are passed as part of the uri // for example, "http://localhost/hello/rick" // http.port is in local.properties file user-api from("jetty:http://0.0.0.0:{{http.port}}/user/dist/?matchOnUriPrefix=true") .process( new StaticProcessor( "help", "index.html", "dist"

Camel CXF: IllegalArgumentException parameters should be of type X

强颜欢笑 提交于 2019-12-11 00:27:30
问题 I'm working on a Camel project calling services with CXF. The services are defined through a wsdl and which I cannot modify it. I generated classes with wsdl2java: I will have many other remote services, they may change often, so I want to have the POJOs and interfaces to be generated as much as possible. My generated interface looks like this: @WebService(targetNamespace = "http://service.company.fr", name = "myService") @XmlSeeAlso({ObjectFactory.class}) public interface MyService {

ActiveMQ connections/sessions in PooledConnectionFactory pool not used with failover: uri

﹥>﹥吖頭↗ 提交于 2019-12-11 00:21:32
问题 I have a 2 broker cluster on AMQ 5.12.0 that I’m sending messages through from a Tomcat 8 web app. I have the following Camel (2.15.2) / Spring (4.2.1) config. which I’m using to configure an AMQ PooledConnectionFactory. <camel:camelContext id="camel-client"> <camel:template id="camelTemplate"/> </camel:camelContext> <bean id="jmsConnectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"> <property name="brokerURL" value="failover:(tcp://dev2.wtgroupllc.com:61626?keepAlive=true

Apache Camel Java DSL add newline to body

女生的网名这么多〃 提交于 2019-12-10 22:55:17
问题 So I have a netty4 socket route set up in Java DSL that looks like the following: @Override public void configure() throws Exception { String dailyDataUri = "{{SOCKET.daily.file}}" + "&fileName=SocketData-${date:now:yyyyMMdd}.txt"; from(socketLocation).routeId("thisRoute") .transform() .simple("${in.body}\n") .wireTap(dailyDataUri) .to(destination) ; Where both the wireTap and the destination are sending their data to two separate files. And the data collection in the destination file is

Camel Rest DSL retrieve HTTP POST multipart File

爱⌒轻易说出口 提交于 2019-12-10 22:05:39
问题 My Router class looks like below and i am trying to upload a video file and store it to a File location. SpringBootRouter.java package com.camelrest; import java.util.HashMap; import java.util.Map; import org.apache.camel.component.restlet.RestletComponent; import org.apache.camel.spring.boot.FatJarRouter; import org.restlet.Component; import org.restlet.ext.spring.SpringServerServlet; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.autoconfigure

Apache Camel RedisIdempotentRepository Configuration

不问归期 提交于 2019-12-10 21:54:13
问题 Has anyone been able to successfully get RedisIdempotentRepository working in a Camel Route? My Camel Route is built using Java 8+, Apache Camel (2.17.1) and Spring Boot (1.3.3.RELEASE). The Camel Route loads and processes messages but does not filter out duplicates: from("activemq:generic.order"). idempotentConsumer(header("uniqueId"), RedisIdempotentRepository.redisIdempotentRepository(redisTemplate,"camel-repo")). to("activemq:unique.order"); The RedisTemplate is connected to a local Redis

Read from database and write to file using camel

随声附和 提交于 2019-12-10 21:36:03
问题 I want to read from the database and write the records to a file using Camel. Below is my code: import javax.sql.DataSource; import org.apache.camel.CamelContext; import org.apache.camel.builder.RouteBuilder; import org.apache.camel.impl.DefaultCamelContext; import org.apache.camel.impl.SimpleRegistry; import org.apache.commons.dbcp.BasicDataSource; public class JDBCExampleSimpleRegistry { public static void main(String[] args) throws Exception { final String url = "jdbc:oracle:thin:@MYSERVER

Camel producerTemplate is not injected in spring MVC

青春壹個敷衍的年華 提交于 2019-12-10 21:17:30
问题 I'm using Spring MVC and Camel in my project, but encountering an issue that the producerTemplate is not able to be Autowired. Please check details below, File web.xml: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/dispatcher-servlet.xml</param-value> </context-param> File ispatcher-servlet.xml <import resource="camel-config.xml"/> File camel-config.xml, define camelContext <context:component-scan base-package="com.myproject.camel.routes"/> <camelContext