FAQ Database Discussion Community


Streaming binary file from SQL Database through Apache Camel back to endpoint

java,rest,servlets,streaming,apache-camel
I'm trying to get some varbinary data out of an SQL database, when a REST call is made to my Camel service. I can get the data as a byte array and set that as the body of the Camel Exchange, and then Servlet will return that as raw bytes...

Camel file component URI format

java,apache-camel
Camel file component supports two notations for URI format: file:directoryName[?options] file://directoryName[?options] Why does the second one exist? It is less readable, especially when using Unix-like absolute paths, which is a frequent use case. In general, should I give preference to one over the other?...

CamelJdbcColumnNames header missed

spring,apache-camel
I try to use the jdbc component from camel. I found the documentation here: http://camel.apache.org/jdbc.html. It works well as the result is available from the database but there is no header in the queued answer called CamelJdbcColumnNames as mentioned in the documentation.All i can see is CamelJdbcRowCount. My camel version...

Throttle requests in camel not working

groovy,apache-camel,throttle,eip
Below are my 3 routes in my base groovy routes class deployed as base framework. from("jms:queue:EndPoint1?concurrentConsumers=100") .routePolicyRef("myPolicy") .transacted() .log("Recieved From Endpoint1") /*.to("log:Recieved From Endpoint1?groupSize=100")*/ .to("CommonEndpoint"); from("jms:queue:EndPoint2?concurrentConsumers=50") .rootPolicyRef("myPolicy") /*.to("log:Recieved From Endpoint2?groupSize=100")*/ .log("Recieved From Endpoint2") .to("CommonEndpoint"); from("CommonEndpoint") .delay(50)...

Mocking test class Spring camel

junit,apache-camel,spring-test
I am new to camel. I am trying to write a test case. public class A { private B b; public void update(String s){ //calling some methods on B ..... } } Test class public class TestA extends CamelSpringTestSupport { private ClassPathXmlApplicationContext xmlAppContext; @Test public void testA() { String xml...

Toggle for wiretap queue in Camel

java,apache-camel
Currently I'm using a choice() to determine if the toggle for the wiretap queue is switched on. Is there a better way to do it in Camel ? This is my code: package routes; import org.apache.camel.builder.RouteBuilder; public class MyRoute extends RouteBuilder{ private String inQueue; private String outQueue; private String wiretapQueue;...

Header missing at marshalling a sql result to csv

spring,apache-camel
I got this route in camel: <route id="route-sql"> <from uri="file://data/sqlin?delay=1000&amp;include=.*\.sql$&amp;charset=utf-8" /> <to uri="jdbc:datasourcePdm" /> <marshal> <csv delimiter="&#x9;" quoteDisabled="true" ></csv> </marshal> <to uri="file://data/sqlout"/> </route> It works and the data is written in csv-format but there is no header in the first line. Also the 'quoting-behaviour' is some kind of strange -...

How to set outgoing Host header from Camel http4 proxy

apache-camel,apache-httpclient-4.x
I am using Apache Camel 2.13.1 as a HTTP proxy using the http4 component: .from("servlet://*?matchOnUriPrefix=true") .to("http4://example.com/?bridgeEndpoint=true&httpClient.redirectsEnabled=false") Now I need to set the Host HTTP header parameter of the outgoing proxy request to the backend system because since it is used by the proxied application to generate absolute links, it has...

Database not update when using apache camel sql component

apache-camel
I'm trying to use apache camel (sql component) to update the DB. Problem is that the DB just doesn't get updated. The sql:update is working fine when i hard code the query, but when i try to use ${body[0][id]} it doesn't update required field. Any feedback on what might be...

Refactoring some legacy camel code, is this code unnecessary or am I missing something?

jboss,apache-camel,jbossfuse
I'm refactoring some apache camel legacy code in a JBoss Fuse instance and I've run into some code that I'm not sure what it's purpose is for. <when condition> <loadBalance id="someVar"> <failover roundRobin="true" maximumFailoverAttempts="3" /> <to uri="fabric:FABRICENDPOINT" /> </loadBalance> </when> I haven't used Fabric's load balancer before but from what...

What is behaviour of sql component serve as producer in Camel?

apache-camel
I am reading camel-example-sql, it has two routes defined as below: <!-- route that generate new orders and insert them in the database --> <route id="generateOrder-route"> <from uri="timer:foo?period=5s"/> <transform> <method ref="orderBean" method="generateOrder"/> </transform> <to uri="sql:{{sql.insertOrder}}"/> <log message="Inserted new order ${body[id]}"/> </route> <!-- route that process the orders by picking up...

Camel: Jetty response encoding

spring,jetty,apache-camel
I want to use the Jetty component in a Camel environment. This is an excerpt of my spring-config.xml: ... <bean id="webEnc" class="web.WebEnc" /> <camelContext> <route> <from uri="jetty:http://0.0.0.0/enc" /> <process ref="webEnc" /> </route> </camelContext> ... And here is the code used to return a String: import org.apache.camel.Exchange; import org.apache.camel.Processor; public class...

Confused with Apache Camel and ActiveMQ

jms,apache-camel,activemq
I'm pretty much new to Apache Camel & ActiveMQ and finding it really difficult and confusing to grasp the concept of the same.Infact, I'm new to this whole concept of JMS. I really don't understand how Apache Camel is different from ActiveMQ, because as per my understanding, both serves the...

Camel netty component example doesn't work, within Spring MVC

spring,apache-camel,netty
I've tried out a good looking example in this topic ( http://shengwangi.blogspot.hu/2015/01/camel-netty-hello-world-simple-example.html ), but it doesn't work for me. I would like to create an simple workable TCP adapter, which uses an own encoder and decoder. At first I check out above example ( it uses a simple String encoder...

No component found with Camel Bean Validator

java,validation,apache-camel,bean-validation
I am getting in route: Route(directRoute)[[From[direct-vm:getAddress]] -> [To[bean-v... because of Failed to resolve endpoint: bean-validator://validator?validationProviderResolver=myValidationProviderResolver due to: No component found with scheme: bean-validator I have added the following dependency : <dependency> <groupId>javax.validation</groupId> <artifactId>validation-api</artifactId> <version>1.1.0.Final</version> </dependency> <dependency>...

Camel Delete File Exception

java,file,apache-camel
When I am trying to process a file in Camel and it fails I try to move the file to an error directory but get the following error message: org.apache.camel.component.file.GenericFileOperationFailedException: Cannot delete file:.... I don't know if Windows is locking the file, but I have closed any streams that may...

Camel Direct end-point exception

java,apache-camel
I am having a simple problem. I am not able to read from a file end-point into a direct end-point. Below is the code snippet: public class SampleTwo { public static void main(String[] args) throws Exception { final CamelContext camelContext = new DefaultCamelContext(); camelContext.start(); camelContext.addRoutes(new RouteBuilder() { @Override public void...

Should a change in XML root element change the signature value for a sub element?

xml,security,apache-camel,xml-signature
I have tried to produce a detached XML signed document with camel. I have noticed that if I tamper name of the namespaces the document gets invalid. E.g. changing from "soap" to "soap1" namespace makes the document invalid. I get an: org.apache.camel.component.xmlsecurity.api.XmlSignatureInvalidValueException: Signature validation failed. The signature value could not...

Failed to deploy quickstart to Fabric8 on Jube

java,maven,apache-camel,jbossfuse,fabric8
I'm running Fabric8 2.1.5 version with Jube on my local Win7 PC, and trying to follow the documentation to deploy the Camel-Spring quickstart When I run "mvn fabric8:deploy" under quickstarts/java/camel-spring folder, I got the following error: [ERROR] Failed to execute goal io.fabric8:fabric8-maven-plugin:2.1.5:deploy (default-cli) on project quickstart-java-cam el-spring: Error executing: Failed...

Camel Multi-threaded Consumer

java,multithreading,apache-camel,producer
I have a DB with orders, each with a due date and a creation date. I want to pull a maximum of 4 orders into route and process them simultaneously. Each order may take between 10-20 minutes to process. But I would like to keep all threads going as much...

apache camel route to split sql results

mysql,jdbc,apache-camel
I am trying to do is select all rows from DB, and for each row update some column for that row. Below is my camel route. from("direct:insert"). from("sql:select * from my_table"). split(body()). log("${body[id]}"). end(); I use the below code to start this route... context.createProducerTemplate().sendBody("direct:insert", null); Problem is it happens multiple...

Camel Redirecting to another route on throttling

apache-camel,throttling
I have a camel route which will be throttled on recieving loads of messages. Suppose the maximum exchanges i defined is 3 per 2 seconds and the route recieves more than the limit i want to redirect those messages to some other load balancer route. Can someone help me how...

Sending mail with a custom MIME Message using Camel

java,email,apache-camel,spring-integration
I want to send a multipart MIME message (custom headers, plain text and HTML) using Camel. I can see in the source code that if I send a javax.mail.internet.MimeMessage in the body of a Camel message to the mail component, it send it without creating a new one. But in...

Call RPC/encoded Webservice with Apache Camel and CXF Endpoint

web-services,soap,cxf,apache-camel,soap-rpc-encoded
There is a lot of information about Apache Camel + CXF-Endpoint and RPC/encoded legacy webservices. But until now I did not find a solution for the problem. I want to call an RPC/encoded webservice from Apache Camel over the CXF endpoint. CXF does not support RPC/encoded Webservices. So I tried...

Camel Multicast; Direct and AMQ

java,web-services,soap,apache-camel,activemq
I have a Generic Camel Route which listens to a CXF:Bean(SOAP) Request with DataFormat: POJO. What I want this route to do is multicast the incoming exchange to AMQ JMS Queue, which will be consumed by another internal route at a later point and the other endpoint is a direct:Endpoint...

Apache Camel FTP - How to start the route manually

ftp,apache-camel
This Camel route should start reading files from a Ftp-Server: from("sftp://[email protected]") Now, I don't want this to start automatically, or polling, or similar. This should be started manually (externally, JMX). I have other routes which are being triggered via a MBean, and I use for that the direct label: from("direct:myRoute1")...

Split xml file in camel using the .split().tokenizeXML()?

java,xml,split,apache-camel,dsl
How to Split xml file in camel using the .split().tokenizeXML()? I have attached the code snippet. I dont know where I did mistake. Here is my input. <Record> <DataFile xmlns="Created"> </DataFile> <DataFile xmlns="Updated"> </DataFile> <DataFile xmlns="Deleted"> </DataFile> </Record> Here is my camel route // Main Route from(...) .routeId("processor route") .process(...)...

Camel Java DSL Route with Choice proceeds only for last condition

java,apache-camel
I have choice with many options, but the route works only for last condition. For other conditions, the route is stuck and wont proceed further. public class CamelChoiceTest { private CamelContext context; @Before public void initializeContext() throws Exception { RouteBuilder builder = new RouteBuilder() { public void configure() { from("direct:test")...

How to transfer files in order (first come first serve) using apache camel

spring,apache-camel
In my code there are two types of files with extension .csv or .psv and .tigger files. .csv files have more size than .trigger files, so .trigger files are getting transfer in prior to .csv files. How to make sure that once .csv files are transferred only .trigger files should...

camel route xml multiple file name regex

regex,routes,apache-camel
I am trying to pull the files with name '123*.txt', '987*.txt' from the sftp server. for that the route xml in camel configured as shown below. It is not processing both files, I have even tried as 123*.txt,987*.txt. Suggest the proper regex I can use here to process both files....

Can anyone tell me how to test my Camel Route if I have a choice operation?

java,unit-testing,testing,apache-camel
I have a Camel route that has implemented a Content based Routing EIP(Choice operation). I need to test it. I'm new to Camel. So, I'm unsure how to do it. Can anyone tell me how to test this operation. I have mentioned a sample code below that has to be...

Why does this Apache Camel intercept not work?

java,apache-camel,intercept
I have a main route builder: public class MainRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { from("activemq:a.out").to("activemq:b.in"); from("activemq:b.in").bean(MainMessageConsumer.class); } } I have a second "intercept" route builder: public class InterceptRouteBuilder extends RouteBuilder { @Override public void configure() throws Exception { interceptSendToEndpoint("activemq:a.out").to("activemq:c.in").skipSendToOriginalEndpoint(); from("activemq:c.in").bean(InterceptMessageConsumer.class); }...

Camel requestBodyAndHeaders() doesn't return the route result

apache-camel
I have a Camel route with split/aggregate: from("seda:start") .routeId("camelRoute") .log("Request: ${body}") .split() .method(SplitService.class, "splitRequest") .parallelProcessing() .bean(SendToWorker.class, "sendToQ1(${body}, ${headers})") .aggregate(header("corrID"), new CustomAggregationStrategy()).completionSize(5) .log("Aggregated ${body}") .bean(SendToWorker.class, "sendToQ2(${body}, ${headers})") .log("Response: ${body}"); The last log displays the result correctly. When I call it as @Autowired private ProducerTemplate...

Writing Custom methods in Java DSL for apache camel routes

java,apache-camel,dsl
Can i write my own Processor Definition methods in Camel and use that in my route as below ? from(uri) .to("http://host:port/testData") .**setTimeOut(long milliseconds)** from is implemented in RouteDefinition and to is implemented in ProcessorDefinition. Like that if i want to implement setTimeOut method and use it in java DSL, how...

CamelContext doesn't startup if one route is misconfigured

java,apache-camel
We use Java DSL to configure our routes. All configurations for routes are in a db table and can be configured via a GUI. How is it possible to ensure that the camelContext starts up even if a route is misconfigured (e.g. .to(invalidurl or typo) in a route or simply...

How use Jolokia to start a route section that is normally triggered on a timer

java,apache-camel,jolokia
I can call the following URL to find out the state of a Camel route section... http://localhost:8080/gateway047/jolokia/exec/org.apache.camel:context=VCM047,type=routes,name=%22VCM047_store_list_schedule%22/getState() This will give { timestamp: 1425658189, status: 200, request: { operation: "getState()", mbean: "org.apache.camel:context=VCM047,name="VCM047_store_list_schedule",type=routes", type: "exec" }, value: "Started" } The route section is defined as... <route id="VCM047_store_list_schedule"> <!-- Fire every 8 hours...

Karaf is unable to resolve bundle depending on ActiveMQ feature due to multiple Joda-Time versions

apache-camel,activemq,apache-karaf
My bundle has a transative bundle dependency on Joda-Time 2.x and gets deployed via a Karaf (3.0.3) feature file. It deployed just fine until I added dependencies to the activemq-broker (5.11.1) and activemq-camel features delivered with Karaf. My bundle now fails resolution because two paths to the package "org.joda.time" are...

Split Camel Context definition into multiple files/jars

apache-camel
I need to split the camel context definition into multiple files/projects. I'd like to have one file with only global configurations (like dataFormats, onCompletion handler, onException handler, interceptFrom, operational routes) and one file which builds on top of it defining mainly routes. I have not found any way to adjust/extend...

How can I get the Apache Camel Message History in logfile from log4j?

java,log4j,apache-camel,log4j2
in the Apache Camel documantation is a nice Message History. I want this for my errorHandler. So I do errorHandler( deadLetterChannel("direct:deadLetter") .logExhaustedMessageHistory(true) .maximumRedeliveries(3) .retryAttemptedLogLevel(LoggingLevel.WARN) ); and also: CamelContext context = getContext(); context.setMessageHistory(true); But the nice Message History doesn't show, not in the Console and not in the Logfile. How can...

What exactly does multicast() do?

apache-camel
What's the exact difference between from("stream:in") .to("stream:out", "stream:err"); and from("stream:in") .multicast() .to("stream:out", "stream:err"); ?...

Apache Camel MDC add field from Body

apache,logging,apache-camel
I am working with apache camel and would like to add certain keys to my logs using MDC. I went through the official Camel MDC Logging documentation which is pretty great. I am able to log my routeId's without much effort. I also need to add a field from Camel's...

Camel Thread Id changing when calling http component

java,redis,apache-camel
My route is like this: from(rabbitmq). to(redisLockerProcessor). to(processor1). to(ahc://http:).to(processor2) .to(redisLockReleaseProcessor) I am using redisson library which stores thread id which took the lock in redis. But in redisLockReleaseProcessor it is throwing exception that thread id is not same as thread id which took the lock. How does http components thread...

Camel Component: Is it possible to create a Consumer Only Component?

apache-camel
I have a dilemma. I have a GET based REST service and a POST based REST service. I have to create custom Camel Components for each of these. Can we create a Camel Component that only consumes? Similarly, is it possible to create a custom Camel Component that produces only?...

Camel and ActiveMQ

java,jms,apache-camel,activemq
I´m very new on the camel world, that is why I´m asking for your help. Let me tell you what I would like to do: I have this basic Camel standalone project: package maventest1; public class JmsToSql { private Main main; public static void main(String[] args) throws Exception { JmsToSql...

Automatic conversion to JSON when using ProducerTemplate

apache-camel
I would like to send JMS messages containing Java POJOs to ActiveMQ and all messages should be converted to JSON documents. So I need mechanism that will convert POJO to JSON and will send created document as text message to ActiveMQ. I would like to use ProducerTemplate#send(...) method without need...

Camel consume single message and stop, transacted

java,transactions,apache-camel,consumer,once
I am trying to use Camel to consume a single message from a JMS queue in a transacted manner. Specifically in a flow like this: Wait until message is published on JMS queue Try to consume and process the single message If processing fails (exception occurs), rollback the consumption If...

Cannot connect to websocket server using AHC-WS component in Apache Camel

apache-camel,slack-api
I'm using ACH-WS component in Apache Camel to connect to a websocket server using WSS (Slack's websocket server to be more precise). I have a route like this one: from("ahc-wss://host") .log(...) .to(...) When I init my app I see the following log: Route: wss-inbound-event started and consuming from: Endpoint[ahc-wss://ms109.slack-msgs.com/websocket/....] However...

Marshalling Guava Optional Class Object in Apache Camel

json,apache-camel,json-deserialization
I would like to marshal/unmarshal Optional Class Object data in camel. For example, the flow is as follows from("rabbit:x") .unmarshal().json(JsonLibrary.Jackson) .process(new Processor() { public void processor(Exchange exchange) { }); In the above route, in rabbit:x, there is a json data, which contains Guava Optional Class object. I would like to...

Apache Camel dynamic route based on file content

apache-camel,servicemix
I am trying to use apache camel to route file content to activemq queue. I use camel to poll xml files from a specific folder then send its content to queue. My problem is I want to send the content to dynamic queue name based on the content value. For...

Camel 2.10 change blueprint.xml location

java,osgi,apache-camel,blueprint
Is there an way to change the blueprint.xml file location? In my application, camel look for this on classpath and "OSGI-INF\blueprint" folder, but I want to point its reference to another file outside this folder (just like a second blueprint.xml option). I've tried the "fileApplicationContextUri" option on camel-maven-plugin plugin inside...

Apache Camel Send Nothing To ActiveMQ Queue

apache-camel,servicemix,fuseesb
I want to send xml files content to queue. Right now I'm using this configuration : <camelContext xmlns="http://camel.apache.org/schema/spring"> <route> <from uri="file:H:/test/file"/> <recipientList> <xpath resultType="String">/data/destination/text()</xpath> </recipientList> </route> And my xml file content : <data> <destination>activemq:queue:queueA</destination> <content>7500</content> </data> This config successfully send a message to queueA, but it has...

Apache Camel, delete=false is ignored [closed]

java,apache-camel
I am trying to copy one file from one directory into another. Here is simple code: class MyAwesomeRouter extends RouteBuilder { @Override public void configure() throws Exception { String fileName = "file:/Users/name/Desktop/?delete=false"; String toFile = "file:/Users/name/Documents/"; this.from(fileName).to(toFile); } } I noticed that anything I put in Desktop folder automatically moved...

Camel CXFRS cross origin resource sharing filter with Configurable Origin List

java,apache-camel,cors,cxfrs
I have used the example in the SO question here to configure a CORS filter (Camel JAX-RS and Cross Domain Request). However, as mentioned in the comments, this is not an ideal solution for production, and neither is placing an origin with a defined set of URLs appropriate for DEV...

Camel HTTP Endpoint: How to set URL-String to POST Parameter

java,http,http-post,apache-camel
Prerequisites Apache Tomcat 7 Spring 3.2.11.RELEASE Apache Camel 2.14.1 Camel HTTP Endpoint (<artifactId>camel-http</artifactId>) Problem At the moment I use following code to set POST-Parameters to the message body. The camel HTTP-Component reads the parameters and sends it. .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.POST.name())) .setHeader(Exchange.CONTENT_TYPE, constant("application/x-www-form-urlencoded; charset: UTF-8")) .setHeader(Exchange.CONTENT_ENCODING, constant("UTF-8"))...

Camel Wiretap Error Handling

java,apache-camel
I am new to camel (v 2.10.0) and searching for a problem that i have due to exceptions that we throw in routes which are called by wireTap(). PROBLEM: is that when exception are thrown from wiretap routes then error handling do not run for these exceptions. When we change...

Camel SFTP connection jcraft jsch exception

apache-camel,jsch,camel-ftp
I am using camel version 2.13.1,and camel-ftp version 2.13.1. I am trying to connect to sftp server through camel route. I am getting some error related to jCraft Jsch exception as shown below. org.apache.camel.component.file.GenericFileOperationFailedException: Cannot connect to sftp://[email protected]:22 at org.apache.camel.component.file.remote.SftpOperations.connect(SftpOperations.java:143) at org.apache.camel.component.file.remote.RemoteFileConsumer.connectIfNecessary(RemoteFileConsumer.java:154) at...

Camel as an HTTP Proxy to a REST service - How to route paths and parameters?

rest,servlets,proxy,apache-camel
I am trying to use Apache Camel as an HTTP proxy to a REST service, performing some auth in the middle, and have a route which looks like this (auth removed for testing purposes): from("servlet:apiwrapper?matchOnUriPrefix=true") .to("http://HOST/BASEPATH?bridgeEndpoint=true&amp;throwExceptionOnFailure=false"); When accessing the Camel Servlet path like so: http://CAMELHOST/apiwrapper/node http://CAMELHOST/apiwrapper/node/stuff/blah?etc=t And so on... I...

Apache Camel Scheduler error: Failed to resolve endpoint

java,apache,timer,apache-camel
I am trying to use "Scheduler component-http://camel.apache.org/scheduler.html but I am getting error. I need to fire scheduler every 60s and call my bean. I picked up the example from documentation and tried to implement it as is but it fails. public class SchedulerRoute extends RouteBuilder { @Override public void configure()...

Simple camel ftp route timeout

java,apache,ftp,apache-camel
Hi I'm new to camel and camel-ftp so bare with me. I configured a simple route inside a test class see below: import org.apache.camel.builder.RouteBuilder; import org.apache.camel.component.mock.MockEndpoint; import org.apache.camel.test.junit4.CamelTestSupport; import org.junit.Test; public class TestClass extends CamelTestSupport { String ftpSourceUri = "ftp://some.server.com:21?username=user&password=secret&fileName=test.csv"; @Test public void testRouteConsumesTestFileFromFTPEndpoint() throws Exception{ MockEndpoint mock =...

Is there a way I can autowire a bean in my route without using the .bean keyword in Camel?

java,spring,apache-camel,javabeans,autowired
Lets say for example, I have the following route: from(.....) .choice() .when(condition1) .bean(Class1.class,"method1") .when(condition2) .bean(Class1.class,"method2") .otherwise() .bean(Class1.class,"method3") .end(); Is there a way I can autowire Class1 to use all the methods instead of using the .bean function in camel. If you know any other efficient method. Please do let me...

Apache Camel - Delay when exception occurs

apache-camel
I have written a camel route that polls a file folder, picks up request, checks for memory consumption on server (in a java file). If its below threshold it drops the request on a JMS queue otherwise it throws an exception and picks it again for processing. What i need...

Apache Camel FTP component from a web application

ftp,apache-camel
I have an apache camel based web application. I have created restful routes using the camel servlet component. I have a requirement where I want to download a file from FTP to the local server when one of the restful URL in my application is invoked. I couldn't find any...

Camel pollEnrich and xml 'prettyPrint'

apache-camel
I am attempting to use Camel's pollEnrich feature, but it is not behaving as I would like... I'm not saying it's broken, but wondering if there is a way to get the behavior I desire. That is, I have an XML (blueprint) defined route that goes something like this: <route>...

JBoss Fuse container: Karaf or Wildfly

apache-camel,jbossfuse
What is the recommended container for JBoss Fuse 6.1: Apache Karaf or JBoss Enterprise Application Server? Since things like datasource configuration are much easier in an application server environment compared to that of Karaf, I am tilted towards Wildfly. But I am unsure if the choice of Wildfly is at...

Using datasource defined in blueprint in java to access oracle db

java,oracle,database-connection,apache-camel,datasource
Below is my datasource <bean id="dataSource" class="oracle.jdbc.pool.OracleDataSource" destroy-method="close"> <property name="URL" value="jdbc:oracle:thin:@${host}:${port}:${dbname}"/> <property name="user" value="${user}"/> <property name="password" value="${pass}"/> </bean> <service ref="dataSource" interface="javax.sql.DataSource"> <service-properties> <entry key="osgi.jndi.service.name" value="jdbc/oracleds"/> <entry key="datasource.name" value="OracleDS"/>...

Camel-NMR not available in servicemix 5.x

apache-camel,servicemix
I have been trying my head around the camel NMR component and wanted to practice some of use cases on servicemix platform. But to my surprise, I could not find the nmr feature in servicemix 5.3 version which I have. Is support for NMR in servicemix withdrawn? Please help me...

Camel JMS - does it pull messages from queue in a loop?

apache-camel,activemq
I've enabled JMS transactions as described in this document: http://camel.apache.org/transactional-client.html My queue subscriber is registered as follows: from("jms:queue:xyz).to(MyBean.class) There are no messages on this queue, but I can see in Camel log, that it starts and ends multiple JMS transactions and this happens multiple times with different thread id. This...

Timeouts in camel

jms,apache-camel
I'm using the split-aggregate functionality in Camel to split some work up amongst some JMS clients. The Camel route is defined (using groovy) as follows: from("vm:getQuotes") .split(new MethodCallExpression("requestSplitter", "splitAmongstBots"), new ArrayListAggregationStrategy()) .to("jms:queue:quoteRequests?requestTimeout=${responseTimeout}s") .unmarshal().json(JsonLibrary.Jackson) .end() The JMS clients can take between approx 15 and 90 seconds to process the tasks. I'm...

Intercept incoming JMS messages to ActiveMQ, reject/approve based on rules

java,jms,apache-camel,activemq
Is there a feature in ActiveMQ, perhaps with Camel, to do the following? intercept incoming message at the broker validate headers and/or body based on arbitrary rules throw exception to sender if message not validated, or.. reroute invalid messages to 'rejection' queue ...

Where is this variable coming from in this Apache Camel program?

java,apache-camel
/** * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you...

Getting Apache Camel to stop retrying if failed to move the file after route completion

java,file-io,exception-handling,locking,apache-camel
The example route below picks up a file and performs a series of operations on them. Once completed, as noted in the camel:from field, the route is instructed to move the file to a .processed directory. Alternatively if failed, move it to the .error folder. The problem occurs when another...

How to avoid retrieving a Spring managed bean from the context

spring,dependency-injection,apache-camel,inversion-of-control
My application receives messages, extracts data and persists the extracted data to a database. Data is received via a Apache Camel channel, added to a FIFO. The following code takes the next message from the FIFO and processes it. However, in order to do this it needs to get a...

Apache Camel File process is resulting in TypeConversion Error

scala,apache-camel,akka,akka-camel
I am using akka-camel to process files. My initial tests were working great, however when I started passing in actual xml files it is puking with type conversions. Here is my consumer (very simple, but puking at msg.bodyAs[String] class FileConsumer extends Consumer { def endpointUri = "file:/data/input/actor" val processor =...

How To Disable Camel HTTP Endpoint Stream Caching When Using Servlet in OSGi

apache-camel
I'm using an Apache Camel route to receive incoming HTTP traffic using the servlet component. The route is very simple: <camel:route id="peopleSoftServletService" errorHandlerRef="errorHandler"> <camel:from uri="servlet:///PeopleSoftService" /> <camel:setHeader headerName="origin"> <camel:simple>PeopleSoft Server: ${in.header.X-Forwarded-For}</camel:simple> </camel:setHeader> <camel:inOnly uri="activemq:peoplesoft" /> </camel:route> I'm encountering problems with stream caching. I'm not...

Apache Camel CXF

java,soap,apache-camel
Camel Configuration was working fine with v 2.13.4. After migrating to v 2.15.1 I am getting following error: Caused by: org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [org.apache.camel.component.cxf.spring.NamespaceHandler] for namespace [http://camel.apache.org/schema/cxf]: problem with handler class file or dependent class; nested exception is java.lang.UnsupportedClassVersionError: JVMCFRE003 bad major version; class=org/apache/camel/component/cxf/spring/NamespaceHandler, offset=6 at...

Apache Camel tesing. Remove RoutePolicy

java,apache-camel,zookeeper
Here is Apache Camel route: ZooKeeperRoutePolicy routePolicy = new ZooKeeperRoutePolicy("zookeeper:localhost:2181/fuse-example/routePolicy", 1); from("file:camelInpit").routeId("systemARoute") .routePolicy(routePolicy) .log(LoggingLevel.ERROR, "Starting route") [...] I want to remove routePolicy in my tests since there is no ZooKeeper in test environment, but this is not as easy as it seems context.getRouteDefinition("systemARoute").adviceWith(context, new AdviceWithRouteBuilder() { @Override public void configure()...

Using Apache Camel ProducerTemplate in Apache Storm bolt

java,apache-camel,storm
I'm trying to write simple Storm + Camel project. My Storm topology analyzes tweets and one bolt should send tweet text to apache camel route, which in turn is using websocket to notify some webapp. I cannot make it work due to NotSerializableExceptions received from bolts when trying to use...

Why does Jasypt try to decrypt Camel Property Placeholders, regardless of the ENC( prefix?

apache-camel,jbossfuse,jasypt,blueprint-osgi,blueprint
In my Blueprint application deployed in JBoss Fuse 6.1.0-379, I want to secure the password I use for creating a database connection. I read this article and added <enc:property-placeholder> to the blueprint configuration. However my blueprint configuration has many property placeholders, and it seems that the Jasypt Placeholder Resolver is...

How to ensure that Camel's ProducerTemplate waits for CamelContext to start

spring,apache-camel
I am trying to use the @EndpointInject annotation in order to create a ProducerTemplate to bridge my POJO to the CamelContext (as described here http://camel.apache.org/pojo-producing.html). The problem that I am running into is that the ProducerTemplate is injected into my POJO before all routes in the camel context are started....

How to access exception in Camel errorHandler?

java,exception-handling,apache-camel
Use Case I'd like to log unhandled exceptions for a particular route in Camel in a reusable manner. Specifically, I'd like to extract enough information from the exception and write it to the database, which is then read by some monitoring software. Through the use of a dead letter queue,...

Apache Camel set file extension

apache-camel
I'm getting xml listings from HTTP POST body and then try to save it as XML document on filesystem. Unfortunately, Camel do not automatically provide file extension, and file is saved without it, so I cannot open it in my XML-viewer. Also, I want to preserve auto-generated file names (like...

Camel route - Ignore return value

java,spring,java-ee,apache-camel
I have the following route: from("INPUT_QUEUE") .routeId("Test") .beanRef("logService", "save") .beanRef("deserialiser", "deserialise") The "save" method in LogService returns an integer. I do not want this integer to be passed on to the deserialise method. I need the json coming from the input queue to be passed on. Any help is appreciated...

Why Does This Apache Camel Route Not Convert JSON to XML?

java,json,xml,apache-camel
I am trying to convert some JSON to XML using an Apache Camel route. Below is the code with the route in it, listing 1. The code that calls this code is the second source code segment, listing 2. The JSON that I want to convert to XML is in...

Camel Java Routebuilder Timeout

java,apache-camel
I have a Camel routebuilder with the following route defined: from(route).routeId("route1") .bean(myBean) .setHeader(Exchange.HTTP_METHOD, constant("GET")) .to("log:get-data-request?level=INFO&ShowHeaders=false&ShowBody=true") .to(myURI) .to("log:get-data-response?level=INFO&ShowHeaders=false&ShowBody=true") Is it possible to add a timeout to this route so that if the reply from myURI takes longer than say 10 seconds it throws an exception of some sort? At the moment...

Pros and Cons of setting Lot of headers in Camel Exchange

apache-camel
I would like to know few things about Camel Headers what are the pros and cons of setting too many headers in camel Exchange? what are the pros and cons of setting too large headers in camel Exchange? ...

Automatically restore connection to the main queue when server is up again

java,jms,apache-camel,websphere-mq
I have a master MQ and a slave MQ. If the master MQ goes down, can I send the messages through the slave MQ using a message driven bean ? Also after my master MQ is up again can I reconnect the line automatically without restarting the JVM ?

Generate Javadoc for OSGi bundle

apache-camel,javadoc,servicemix,osgi-bundle,maven-javadoc-plugin
I'm newbie in OSGi world but I was able to do some Camel and OSGi bundles to do some tasks in a middleware. Everything I made since was a proof of concept, but now I want to refactor some part of my code and I start writing a OSGi bundle...

Multiple Connection Factories

java,spring,apache-camel,activemq,javabeans
I'm using spring boot and setting up multiple connection factories (pooled and jms). The issue I'm getting is that it seems to be trying to autowire them to the same object in javax.jms.ConnectionFactory. So its resulting in this exception: Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private javax.jms.ConnectionFactory org.springframework.boot.autoconfigure.jms.JmsAutoConfiguration.connectionFactory; nested...

Does ActiveMQ support multiple transactional consumers?

transactions,apache-camel,activemq,servicemix
I am developing OSGI bundles in ServiceMix to consume from the same queue of ActiveMQ. I need to be sure that the message is dequeued only if every thing goes fine so that I don't lose that message. So I used camel transactional client. I manged to implement it by...

How to use 'doneFileName' property of Camel for file name with double extension?

apache,apache-camel
I need to route and delete a tar.gz file using apache camel. My file name is filename.tar.gz and trigger file name is filename.trg. So, if I use this uri in from() - "&doneFileName=${file:name.noext}.trg camel routes the file with the Trigger file name - filename.tar.trg. But I need the doneFileName as...

Apache Camel Route to SOAP API

java,soap,apache-camel
I'm trying to post some xml data to a SOAP API through Apache Camel. Please see the Camel route below.What I'm trying here is to read an xml file in C:/input and send its content to a SOAP API hosted at my Tomcat (localhost:8080/myservice/soapws). Is it possible to use Camel's...

Changing default settings for JMS messaging in Camel

apache-camel
I've found only a way to specify JMS settings directly on end points, but I would like to change default values, so that we do not have to remember to set the same value on each endpoint. Below there are few examples of properties which I would like to set...

Camel ProducerTemplate not injected with annotation config

java,spring,apache-camel,activemq
First of all, I know there are very similar questions (Camel producerTemplate is not injected in spring MVC and Initializing camel from Spring annotation config) but they don't help in my case. I have a bean which sends messages with ProducerTemplate: public class SimpleProducer { @Produce(uri = "activemq:queue:simple") private ProducerTemplate...

Camel http4 download file using Basic authentication over Https

https,apache-camel,basic-authentication
I am trying to download a file from a Https url which requires Basic authentication. I am using HTTP4 I am trying to download from url - https://ebc.cybersource.com/ebc/DownloadReport/xxx.csv?authMethod=Basic&authUsername=scott&authPassword=tiger After the file is downloaded I need to save it to a folder. Here's what my code looks like from(xxx) .to("http4://ebc.cybersource.com/ebc/DownloadReport/xxx.csv?authMethod=Basic&authUsername=scott&authPassword=tiger") .to("file:target/messages/download");...

How to create a camel route that references a specific Java method?

java,apache-camel,dsl
I want to write a Camel route that reads all xml files in a specific directory, then calls a process Java method of a class that implements Processor to do something and print the result to screen. For example the Java class is named ScriptProcessor, and it has a process...

Extract data from JSON in vanilla Java/Camel/Spring

apache-camel,activemq,jolokia
I am trying to write a Camel route to get JMX data from an ActiveMQ server through the Jolokia REST API. I was able to successfully get the JSON object from the ActiveMQ server, but I am running into an issue where I cannot figure out how to parse the...

POI - Can't open xslx files in osgi

java,excel,osgi,apache-camel,apache-poi
Getting the next exception when trying to read xlsx files in osgi (jboss-fuse). Xls is working fine. Using the next jar files inside the bundle : <br> lib/xml-apis-1.0.b2.jar, \<br> lib/poi-scratchpad-3.9-20121203.jar, \<br> lib/poi-3.9-20121203.jar, \<br> lib/dom4j-1.6.1.jar, \<br> lib/poi-ooxml-schemas-3.9-20121203.jar, \<br> lib/poi-ooxml-3.9-20121203.jar, \<br> lib/xmlbeans-2.3.0.jar, \<br> lib/poi-excelant-3.9-20121203.jar, \<br> lib/xmlbeans-xpath-2.3.0.jar <br>...

Java & Apache-Camel: From direct-endpoint to file-endpoint

java,apache-camel
I've tried to build a route to copy files from one directory to an other directory. But instead of using: from(file://source-directory).to(file://destination-directory) I want to do something like this: from(direct:start) .to(direct:doStuff) .to(direct:readDirectory) .to(file://destination-folder) I've done the following stuff: Route @Component public class Route extends AbstractRouteBuilder { @Override public void configure() throws...

A simple HTTPS proxy server with Apache Camel

java,https,apache-camel,http-proxy
I am trying to implement a simple HTTP proxy service with Apache Camel. My code looks like this: from("jetty:http://localhost:80?matchOnUriPrefix=true") .recipientList(simple("jetty:${in.header.CamelHttpUrl}?bridgeEndpoint=true&throwExceptionOnFailure=false&disableStreamCache=true")); It is essentially this with a dynamic recipient list to support multiple destinations. I also had to add the disableStreamCache=true bit, otherwise I would get weird exceptions with path duplication...

Apache Camel SQL component is not closing resultset?

apache-camel
I am using Camel sql component to run select queries against Oracle DB. The war file is deployed on Jboss EAP 6.1. In the config file under configuration I have track-statements set to true (i.e. true). So Jboss checks if the result sets are closed when a connection is returned...