Re: Stream Cache / spool file deletion before aggregation in Multicast, involving huge data
Hi Claus, The problem can happen with multicast, even if there is no aggregation strategy. If in the last branch exchange of multicast, stream caching happens (and also clean up of file on completion of branch), then if the next step (processor) after multicast tries to read the data from the incoming exchange, same issue will happen. Pls. try to handle this aspect as well as part of the same JIRA. Thanks, Lakshmi -- View this message in context: http://camel.465427.n5.nabble.com/Stream-Cache-spool-file-deletion-before-aggregation-in-Multicast-involving-huge-data-tp5756092p5756160.html Sent from the Camel - Users mailing list archive at Nabble.com.
Propagate SoapFault with simple Camel proxy
Hi! I'm trying to create a simple WS proxy using Switchyard 1.1 with Camel: -- PromotedService -- Camel -- ProxifiedService With the current configuration I'm able to send and recieve messages without any problem. However, when the ProxifiedService throws a SoapFault it is not propagated to the caller of the PromotedService. What can I do to ensure the the PromotedServiceCaller receives the SOAPFault as reponse? This is what I have tried so far: /onException(SoapFault.class) .process( new Processor() { public void process(Exchange exchange) throws Exception { //This method is never called. SoapFault fault = exchange.getProperty(Exchange.EXCEPTION_CAUGHT, SoapFault.class); exchange.getOut().setFault(true); exchange.getOut().setBody(fault); exchange.setProperty(Exchange.ERRORHANDLER_HANDLED, false); exchange.removeProperty(CamelExceptionCaught); } }) .handled(true) .end(); *from(switchyard://PromotedService) .process(myProc) // -- I just add some headers here to the original request. .handleFault() .to(switchyard://ProxifiedService).handleFault().end();*/ Thank you! -- View this message in context: http://camel.465427.n5.nabble.com/Propagate-SoapFault-with-simple-Camel-proxy-tp5756164.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Stream Cache / spool file deletion before aggregation in Multicast, involving huge data
Hello, I have a very simple example which shows that the problem does not only occur for MultiCast. The problem always occurs when in a sub-route the message body is streamed via CachedOutputStream to the file system and the cached file is deleted at the end of the soub-route, although the main-route needs access to the result body of the sub-route. public class StreamCacheInSubRouteTest extends ContextTestSupport { @Override protected RouteBuilder createRouteBuilder() throws Exception { return new RouteBuilder() { @Override public void configure() throws Exception { context.setStreamCaching(true); context.getStreamCachingStrategy().setEnabled(true); context.getStreamCachingStrategy().setSpoolDirectory( target/camel/cache); context.getStreamCachingStrategy().setSpoolThreshold(1l); from(direct:startError) .to(direct:subroute).to(mock:result); from(direct:subroute) // .process(new Processor() { @Override public void process(Exchange exchange) throws Exception { CachedOutputStream cos = new CachedOutputStream(exchange); String s = Test Message 1; cos.write(s.getBytes(Charset.forName(UTF-8))); cos.close(); InputStream is = (InputStream) cos.newStreamCache(); exchange.getOut().setBody(is); } }) // .to(mock:result_subroute); } }; } @Test public void test() throws Exception { MockEndpoint mock = getMockEndpoint(mock:result); mock.expectedMessageCount(1); template.sendBody(direct:startError, start/start); byte[] data = mock.getReceivedExchanges().get(0).getIn() .getBody(byte[].class); assertEquals(Test Message 1, new String(data, UTF-8)); } } I will add this example to the jira ticket mentioned by Claus. Regards Franz On Fri, Sep 5, 2014 at 1:23 PM, lakshmi.prashant lakshmi.prash...@gmail.com wrote: Hi, Mybeans.xml http://camel.465427.n5.nabble.com/file/n5756092/Mybeans.xml *Issue:* Whenever data is spooled in file via CachedOutputStream in any camel component in a multicast branch, that data becomes unreadable in a) Aggregation Strategy of Multicast b) After multicast, in case there is no aggregation strategy We are getting: a) FileNotFound issues as the file is deleted on completion of the cloned branch exchange. b) Premature end of file, when we read data from InputStream and use XMLReader / STAX to read the data. If we use the Constructor: new CachedOutputStream(exchange, false), the streamcache file will not be deleted. But the file may never be cleaned up we do not want to do that. *Details* We are using camel 2.13.2 - I have a multicast route with an AggregationStrategy. And in each multicast branch, we have a custom camel component that returns huge data (around 4 MB) and writes to StreamCache (CachedOutputStream) and we need to aggregate the data in the multicast (AggregationStrrategy). In the Aggregation strategy, I need to do XPath evaluation using camel XPathBuilder. Hence, I try to read the body and convert from StreamCache to byte[] to avoid 'Error during type conversion from type: org.apache.camel.converter.stream.InputStreamCache.' in the XPathBuilder. When I try to read the body in the beginning of the AggregationStrategy, I get the following error. * /tmp/camel/camel-tmp-4e00bf8a-4a42-463a-b046-5ea2d7fc8161/cos6047774870387520936.tmp (No such file or directory), cause: FileNotFoundException:/tmp/camel/camel-tmp-4e00bf8a-4a42-463a-b046-5ea2d7fc8161/cos6047774870387520936.tmp (No such file or directory). at java.io.FileInputStream.open(Native Method) at java.io.FileInputStream.init(FileInputStream.java:138) at org.apache.camel.converter.stream.FileInputStreamCache.createInputStream(FileInputStreamCache.java:123) at org.apache.camel.converter.stream.FileInputStreamCache.getInputStream(FileInputStreamCache.java:117) at org.apache.camel.converter.stream.FileInputStreamCache.writeTo(FileInputStreamCache.java:93) at org.apache.camel.converter.stream.StreamCacheConverter.convertToByteArray(StreamCacheConverter.java:102) at com.sap.it.rt.camel.aggregate.strategies.MergeAtXPathAggregationStrategy.convertToByteArray(MergeAtXPathAggregationStrategy.java:169) at com.sap.it.rt.camel.aggregate.strategies.MergeAtXPathAggregationStrategy.convertToXpathCompatibleType(MergeAtXPathAggregationStrategy.java:161) Following is the line of code where it is throwing an error: Object body = exchange.getIn().getBody(); if( body instanceof StreamCache){ StreamCache cache = (StreamCache)body; xml = new String(convertToByteArray(cache,exchange)); exchange.getIn().setBody(xml); } * By disabling stream cache to write to file by setting a threshold of 10MB in multicast related routes, we were able to work with the aggregation strategy. But we do not want to do that, as we may have incoming data that maybe
Babel: new DSL for Camel
Dear all, We have recently open sourced Babel, a new DSL for Camel at http://crossing-tech.github.io/babel . Its goal is to provide more type safety as well as conciseness to your route definition. The API is written in Scala and in a manner which makes it readable for Java developers. You may find the sources at https://github.com/Crossing-Tech/babel . We look forward to getting your opinion about it. Happy hacking! For the Babel team, Christophe Pache -- View this message in context: http://camel.465427.n5.nabble.com/Babel-new-DSL-for-Camel-tp5756172.html Sent from the Camel - Users mailing list archive at Nabble.com.
Idempotent consumer, removeOnFailure=true and exception handling
Hi, So i'm using Camel 2.13.1 and the JDBC Idempotent Repository and I'd like to use the removeOnFailure =true option to be able to replay the transaction on failure. My question is whether implementing an onException clause which handles an exception would stop the removeOnFailure option from being carried out as the failure is being marked as 'handled=true'. Here is my onException clause in Spring XML:- camel:onException camel:exceptionjava.lang.Exception/camel:exception camel:redeliveryPolicy logStackTrace=true disableRedelivery=true logExhausted=true / camel:handled constanttrue/constant /camel:handled camel:log message=Transaction has failed and is being handled by the exception handler. Received message [${exception}], full stack trace [${exception.stacktrace}] loggingLevel=ERROR logName=com.lgim.sophis.unrecoverableerror/camel:log /camel:onException In the above case would the camel_messageprocessed table entry for the failing exchange be removed? Here is my route for idempotency:- route id=idempotentTransactionsRoute from uri=direct:filterForIdempotency / idempotentConsumer messageIdRepositoryRef=jdbcIdempotentRepository el${in.body.ID}/el to ref=direct:processTransaction / /idempotentConsumer stop / /route Any help appreciated! -- View this message in context: http://camel.465427.n5.nabble.com/Idempotent-consumer-removeOnFailure-true-and-exception-handling-tp5756198.html Sent from the Camel - Users mailing list archive at Nabble.com.
Dealing with large messages
When I create a restfull service using camel how should I deal with large reply messages. Can the messages be streamed somehow to the calling client and if sohow should I do this? -- View this message in context: http://camel.465427.n5.nabble.com/Dealing-with-large-messages-tp5756199.html Sent from the Camel - Users mailing list archive at Nabble.com.
Questions about CXF component
Hi, I am trying to connect to a WCF .NET webservice(wshttpbinding) via our proxy server. I had a few basic questions regarding CXF components: 1. Can CXF be run in standalone mode? No tomcat required? 2. Are the WS-* specs supported (such as Security, SecurityPolicy) or do I need to include WSS4J? 3. Can I use Java DSL? The examples seem to be in Spring xml. Thanks! -- View this message in context: http://camel.465427.n5.nabble.com/Questions-about-CXF-component-tp5756202.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Async reques/response
I started implementing the above but have few questions: 1) I am using activemq connection factory. How does camel know which broker and url to use to create activemq connection factory. 2) How can I set replyTo queue name as I don't want camel to create new temp queue for every request. On Sat, Sep 6, 2014 at 9:35 AM, Mohit Anchlia mohitanch...@gmail.com wrote: Yes it does. Let me give it a shot On Sat, Sep 6, 2014 at 6:33 AM, edmondo1984 edmondo.po...@gmail.com wrote: Hello, in Camel you need endpoint to be able to produce or consume data. So your route DSL look like the following : from(producer).to(consumer). In your case, if you don't have a proper producer, you can use a direct endpoint or a seda endpoint from(direct:input).to(activemq:etcetc) Then from the code that should produce the string, you will write the following code: CamelContext camelContext = new DefaultCamelContext(); camelContext.addRoutes(new MySimpleRouteBuilder()); ProducerTemplate producerTemplate = camelContext.createProducerTemplate(); Object reply = producerTemplate.requestBody(direct:input,Hello world); Does it make sense? Best Edmondo -- View this message in context: http://camel.465427.n5.nabble.com/Async-reques-response-tp5756113p5756116.html Sent from the Camel - Users mailing list archive at Nabble.com.
Camel RabbitMQ acknowledges event though autoAck is set to false and there is an exception in the route
Camel RabbitMQ component acknowledges the message even though the autoAck is set to false and there is an exception in the route. I don't know if I am doing anything wrong. My guess is that the error could be in the RabbitMQConsumer class. try { consumer.getProcessor().process(exchange); long deliveryTag = envelope.getDeliveryTag(); if (!consumer.endpoint.isAutoAck()) { log.trace(Acknowledging receipt [delivery_tag={}], deliveryTag); channel.basicAck(deliveryTag, false); } } catch (Exception e) { getExceptionHandler().handleException(Error processing exchange, exchange, e); } Process method does not throw exception but sets exception property of the exchange to the exception object when there is any error while processing the exchange. There may need to be a check to see if the exception property is null before acknowledging the message. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-RabbitMQ-acknowledges-event-though-autoAck-is-set-to-false-and-there-is-an-exception-in-the-roe-tp5756207.html Sent from the Camel - Users mailing list archive at Nabble.com.
Maven camel example - async request/reply
I have examples project inside of apache camel setup in the eclipse. I am trying to see if there are any examples of async request/reply pattern in that list?
Endpoint URI when using replyToHeader=Exclusive
When using replyTo header as Exclusive in queue endpoint is it also necessary to specify replyTo or does Camel automatically assigns one per producer?
Camel Mybatis 2.13.1 BATCH of 10,000 records
Hi, I ran into an issue where I was trying to insert a BATCH of roughly 3500 records into an Oracle 11g table of 13 columns from a CSV file using camel-bindy and camel-mybatis. The BATCH was generating huge trace files on the database sever due to ORA-4031 errors. The SQL statement running in each session is over 80,000 lines long, taking as input over 42,000 bind variables. Additionally, the process blocked over cursor contention. I'm trying to satisfy the requirement: If invalid data, then rollback. I did some research and tried the *EIP Splitter* on the collection in the Message Body. The *sub routes* to *split *and *save the record* to DB are placed in a *DB Transaction policy with PROPAGATION_REQUIRED*, it rolled back as expected. This worked absolutely fine. It took around 9 seconds to insert 5050 records. * Is Splitter a good choice for the above? Does anyone have other ideas? * -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Mybatis-2-13-1-BATCH-of-10-000-records-tp5756211.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: HTTP Basic Authentication
Hello, Pls find below my query of CXF-RS with Basic authentication: public void configure() throws Exception { System.out.println(inside route); MapString, Object properties = new HashMapString, Object(); AuthorizationPolicy authPolicy = new AuthorizationPolicy(); authPolicy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_BASIC); authPolicy.setUserName(test); authPolicy.setPassword(test); authPolicy.setAuthorization(true); // properties.put(AuthorizationPolicy.class.getName(), authPolicy); properties.put(org.apache.cxf.configuration.security.AuthorizationPolicy, authPolicy); CxfRsEndpoint myCxfEp = (CxfRsEndpoint)getContext().getEndpoint(cxfrs:http://0.0.0.0:9090?resourceClasses=com.test.CompanyServicebindingStyle=SimpleConsumer;); myCxfEp.configureProperties(properties); from(myCxfEp) ... I have tested it using SOAPUI doesn't ask for any authentication. Please suggest .. Thanks, Sayed -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756208.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Route Camel : Pass variables in a SQL query
Hello, I tried the below code and able to print the id, but not able to get the required query. Please correct the code: when simple${header.operationName} == 'getCompany'/simple setHeader headerName='id' simple$simple{body}/simple /setHeader log id=log1 message =param name---:${in.header.id} / to uri=sql:SELECT * from company where id = :#id/ /when Thanks, -- View this message in context: http://camel.465427.n5.nabble.com/Route-Camel-Pass-variables-in-a-SQL-query-tp477181p5756205.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Camel RabbitMQ acknowledges event though autoAck is set to false and there is an exception in the route
Hi Yeah you are right I am fixing this now. On Mon, Sep 8, 2014 at 8:35 PM, blr_developer sridhar2...@gmail.com wrote: Camel RabbitMQ component acknowledges the message even though the autoAck is set to false and there is an exception in the route. I don't know if I am doing anything wrong. My guess is that the error could be in the RabbitMQConsumer class. try { consumer.getProcessor().process(exchange); long deliveryTag = envelope.getDeliveryTag(); if (!consumer.endpoint.isAutoAck()) { log.trace(Acknowledging receipt [delivery_tag={}], deliveryTag); channel.basicAck(deliveryTag, false); } } catch (Exception e) { getExceptionHandler().handleException(Error processing exchange, exchange, e); } Process method does not throw exception but sets exception property of the exchange to the exception object when there is any error while processing the exchange. There may need to be a check to see if the exception property is null before acknowledging the message. -- View this message in context: http://camel.465427.n5.nabble.com/Camel-RabbitMQ-acknowledges-event-though-autoAck-is-set-to-false-and-there-is-an-exception-in-the-roe-tp5756207.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/
Re: HTTP Basic Authentication
The configuration only work for the client side, if you want to enable the HTTP Basic Authentication on the server side, you need to setup the Jetty ServletContextHandler for it. -- Willem Jiang Red Hat, Inc. Web: http://www.redhat.com Blog: http://willemjiang.blogspot.com (English) http://jnn.iteye.com (Chinese) Twitter: willemjiang Weibo: 姜宁willem On September 9, 2014 at 1:26:41 PM, sayed_india (sayed.abdulis...@gmail.com) wrote: Hello, Pls find below my query of CXF-RS with Basic authentication: public void configure() throws Exception { System.out.println(inside route); Map properties = new HashMap(); AuthorizationPolicy authPolicy = new AuthorizationPolicy(); authPolicy.setAuthorizationType(HttpAuthHeader.AUTH_TYPE_BASIC); authPolicy.setUserName(test); authPolicy.setPassword(test); authPolicy.setAuthorization(true); // properties.put(AuthorizationPolicy.class.getName(), authPolicy); properties.put(org.apache.cxf.configuration.security.AuthorizationPolicy, authPolicy); CxfRsEndpoint myCxfEp = (CxfRsEndpoint)getContext().getEndpoint(cxfrs:http://0.0.0.0:9090?resourceClasses=com.test.CompanyServicebindingStyle=SimpleConsumer;); myCxfEp.configureProperties(properties); from(myCxfEp) ... I have tested it using SOAPUI doesn't ask for any authentication. Please suggest .. Thanks, Sayed -- View this message in context: http://camel.465427.n5.nabble.com/HTTP-Basic-Authentication-tp5742229p5756208.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Idempotent consumer, removeOnFailure=true and exception handling
Hi Yes removeOnFailure will be called even if the exception was handled. On Mon, Sep 8, 2014 at 5:16 PM, Chris Melikian ch...@melikian.net wrote: Hi, So i'm using Camel 2.13.1 and the JDBC Idempotent Repository and I'd like to use the removeOnFailure =true option to be able to replay the transaction on failure. My question is whether implementing an onException clause which handles an exception would stop the removeOnFailure option from being carried out as the failure is being marked as 'handled=true'. Here is my onException clause in Spring XML:- camel:onException camel:exceptionjava.lang.Exception/camel:exception camel:redeliveryPolicy logStackTrace=true disableRedelivery=true logExhausted=true / camel:handled constanttrue/constant /camel:handled camel:log message=Transaction has failed and is being handled by the exception handler. Received message [${exception}], full stack trace [${exception.stacktrace}] loggingLevel=ERROR logName=com.lgim.sophis.unrecoverableerror/camel:log /camel:onException In the above case would the camel_messageprocessed table entry for the failing exchange be removed? Here is my route for idempotency:- route id=idempotentTransactionsRoute from uri=direct:filterForIdempotency / idempotentConsumer messageIdRepositoryRef=jdbcIdempotentRepository el${in.body.ID}/el to ref=direct:processTransaction / /idempotentConsumer stop / /route Any help appreciated! -- View this message in context: http://camel.465427.n5.nabble.com/Idempotent-consumer-removeOnFailure-true-and-exception-handling-tp5756198.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - Red Hat, Inc. Email: cib...@redhat.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen hawtio: http://hawt.io/ fabric8: http://fabric8.io/