apache-camel

Infinite loop in Camel - Rabbit MQ

Deadly 提交于 2019-12-06 15:20:10
I have a small server-route, which takes a message from queue.in and puts in queue.out. When I put ONE message in queue.in , the server runns in an infinite loop. I wonder what I'm missing in terms of configuration. This seems like a very simple route. The small server-route: <camelContext id="camel-server" xmlns="http://camel.apache.org/schema/spring"> <jmxAgent disabled="false" onlyRegisterProcessorWithCustomId="false" createConnector="true" usePlatformMBeanServer="true" registerNewRoutes="true" statisticsLevel="All" includeHostName="false" mask="false" id="agent" /> <endpoint id="queue.in"

JAXB marshalling in Apache Camel

牧云@^-^@ 提交于 2019-12-06 15:02:43
I am new to Apache camel and need to perform a task where i need to marshal an object to xml file. I am using the below code but it is not working. Here, foo.pojo is package where JAXB annotated classes are present JaxbDataFormat jaxbDataFormat = new JaxbDataFormat("foo.pojo"); from("direct:start").marshal(jaxbDataFormat).to("file:C:/Users/Anand.Jain/Desktop/hello/abc.xml").end(); Please help. Peter Keller Option 1: Configure the context path JaxbDataFormat jaxbDataFormat = new JaxbDataFormat("foo.pojo"); OptionFactory or jaxb.index file must be defined in the given package as explained here .

Dynamic routing in camel en-queues messages infinitely

烈酒焚心 提交于 2019-12-06 15:02:08
I am working on camel’s dynamic router to derive and dispatch to the relevant queue by referring http://camel.apache.org/dynamic-router.html Following is the camel config xml: <route id="dynamicRouter" autoStartup="true"> <from uri="vm://service1?concurrentConsumers=10&timeout=0" /> <choice> <when> <simple>${body.documentStatus} == 'SUCCESS' </simple> <log message="routing to dynamic router" /> <dynamicRouter> <!-- use a method call on a bean as dynamic router --> <method ref="messageRouter" method="route" /> </dynamicRouter> </when> </choice> </route> Following is my dynamic router bean:

Apache camel:bindy illegal argument exception

非 Y 不嫁゛ 提交于 2019-12-06 14:12:28
I am doing data format conversion between POJO to CSV and vice versa. In this while converting CSV to Object file(Unmarshalling) i am getting illegal argument exception for int data type. Only for string its working fine. Below is my POJO @CsvRecord(separator="//|",crlf="UNIX",generateHeaderColumns=false) public class EmployeeVO implements Serializable{ private static final long serialVersionUID = -663135747565879908L; @DataField(pos=1) private String name; @DataField(pos=3) private Integer age; @DataField(pos=2) private String grade; // getter setter } csv data sumit|4th standrad|22 the above

How to insert blob using camel SQL component with Oracle Database

你。 提交于 2019-12-06 14:00:15
问题 I am trying to insert an input stream using camel SQL component (http://camel.apache.org/sql-component.html). I have the following table in Oracle Database: table EMPLOYEE(NAME varchar(32) ,SURNAME varchar(32) , PIC BLOB ); and the following route: <route> <from uri="direct:startOracle" /> <to uri="sql:INSERT INTO EMPLOYEE (Name, surname, pics) VALUES (# , # , #)?dataSource=#oracle" /> </route> when I try to run the following code: Resource r = contex.getResource("classpath:file/ciao.jpg");

Spock mock verify returns 0 invocations

血红的双手。 提交于 2019-12-06 13:42:16
Im working on a Spring Boot java service that contains a Camel Processor class as follows: public class MyProc implements Processor { @Autowired private LogService logService; public void process(Exchange e) { // exchange object processing logService.update(e) } } And I have the following Spock test: class MyProcTest extends Specification { @Shared def logService = Mock(LogService) @Shared def proc = new MyProc() def ctx = new DefaultCamelContext() def exch = new DefaultExchange(ctx) void setupSpec() { proc.logService = logService } def "log is updated when valid exchange is processed"() {

akka-camel 2.2.1 route definition using Spring XML

坚强是说给别人听的谎言 提交于 2019-12-06 13:29:28
I am using akka-camel 2.2.1 and need to configure routes to and away from Consumer and Producer actors, respectively. I am currently defining routes and adding them to the internal Camel context within the CamelExtension programmatically like so: camel.context.addRoutes(new RouteBuilder { def configure() = { from("file:/tmp?include=whatever.*.log&noop=true&sendEmptyMessageWhenIdle=true") .split(body(classOf[String]).tokenize("\n")) .streaming() .to("seda:input-route") from("seda:update-route") .to("bean:db-update-bean?method=process") }}) I have an Actor that extends Consumer which reads from

Camel + Jackson : Register a module for all deserialization

这一生的挚爱 提交于 2019-12-06 13:26:30
I'm using Camel for my application, and messages come in to routes as JSON. I use JACKSON as my deserializer. I have a case where I require a custom serializer/deserializer to handle one of my messages. What I want to do is register the custom serializer/deserializer for keys. In Camel, how do I make sure that the serializer/deserializer is available for whenever I marshall/unmarshall in my routes? You can define what dataformat you want using .unmarshal(<dataFormatComponent>) http://camel.apache.org/data-format.html http://camel.apache.org/json.html 来源: https://stackoverflow.com/questions

How to route from Camel servlet component to http component?

久未见 提交于 2019-12-06 13:23:44
问题 I'm trying to configure a multicast route that receives an HTTP POST and POSTs it to multiple instances of a service. From reading the documentation, and playing with the camel-example-servlet-tomcat, it looks like it should be simple, but i'm stuck. This question was helpful, but i'm still stuck. Here's my web.xml for configuring the Camel Servlet: <web-app...> <!-- location of spring xml files --> <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF

Apache camel getbody as custom class

不打扰是莪最后的温柔 提交于 2019-12-06 11:23:37
问题 The question is rather simple, perhaps because I'm a little confused in the process. What I'm trying to do is shown in the code example: cc.addRoutes(new RouteBuilder() { @Override public void configure() throws Exception { from("file://files?noop=true") .split() .tokenize("\n") .split() .method(SplitToken.class, "hashTokens") and: class SplitToken { @SuppressWarnings("unchecked") public static List<HashMap<String, Integer>> hashTokens(final Exchange exchange) { List<String> oldstr = exchange