Re: camel-mail
It works adding to property. Many thx -- View this message in context: http://camel.465427.n5.nabble.com/camel-mail-tp5725119p5732817.html Sent from the Camel - Users mailing list archive at Nabble.com.
Securing jaxrs REST interface with HTTP Basic auth
Hello guys, a joke is saying that a number of tabs opened in web browser related to some problem could help you to estimate the time needed for implementation. I have now about 33 tabs opened :) I need to secure my REST interface, with HTTP Basic auth. In the project, we are currently still with Camel 2.10.1 (not yet resolved some troubles with upgrade to 2.11 :( ), we are using OSGi and Aries blueprint. All deployed into Apache Karaf. Just a simple hint which way to go is goood enough for me. Right now, I'm checking JAAS, but I'm really lost in this topic. -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi
Re: Securing jaxrs REST interface with HTTP Basic auth
Hello Martin, I think you could try addding a Filter or Interceptor that does Basic Auth. If you're using CXF you could try something like [1] Hope it helps, [1] http://cxf.apache.org/docs/secure-jax-rs-services.html On Mon, May 20, 2013 at 10:48 AM, Martin Stiborský martin.stibor...@gmail.com wrote: Hello guys, a joke is saying that a number of tabs opened in web browser related to some problem could help you to estimate the time needed for implementation. I have now about 33 tabs opened :) I need to secure my REST interface, with HTTP Basic auth. In the project, we are currently still with Camel 2.10.1 (not yet resolved some troubles with upgrade to 2.11 :( ), we are using OSGi and Aries blueprint. All deployed into Apache Karaf. Just a simple hint which way to go is goood enough for me. Right now, I'm checking JAAS, but I'm really lost in this topic. -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi -- Ioan Eugen Stan 0720 898 747
Re: Disable CXF logging in Jboss Fuse
Hi You should ask JBoss Fuse questions on the JBoss Fuse forum which you also did https://community.jboss.org/thread/228355 On Sun, May 19, 2013 at 7:26 AM, gsehgal1 gaurav_seh...@rocketmail.com wrote: Hello, Is there a way to disable CXF LoggingIntercepter both IN and OUT inside the FUSE container. We have enabled the camel-cxf feature as we are using REST. Though it keeps priting out the payload to the console; which we don't want. Any help would be appreciated. Cheers! Gaurav -- View this message in context: http://camel.465427.n5.nabble.com/Disable-CXF-logging-in-Jboss-Fuse-tp5732807.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - www.camelone.org: The open source integration conference. Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Asynchronous routing with jms hangs in midstream
Hi If you use transactions then do NOT use parallel processing etc, as the TX manager requires all work to be done on the same thread. On Sun, May 19, 2013 at 1:36 AM, glsilverman glsilver...@pssd.com wrote: I'm trying to send a message asynchronously between two camel routes each in a different bundle configured with blueprint.xml in Apache Karaf 2.3.1. I'm using Camel 2.11.0 and activemq-camel 5.8.0 feature installed. Once in a while the message goes through and is processed without incident. Most of the time, the exact same message hangs in mid-route, with no log output or errors to view so I can debug. Each time I have to delete the message queue in the activemqweb console to resend the message. I'm new to activemq and jms so I'm hoping someone can point out what I might be doing wrong. I've configured activemq in each blueprint file as follows: Here is my route: I'm just parsing a csv file with a number of rows and the import processor converts the data to a JPA entity and persists it. I'm using Aries JPA with transaction required, but I don't see that as a cause because the same data gets saved on one pass and on the next, maybe all but two will get saved and the queue will hang and the message won't even reach the processComplete consumer. If I had an error log to include with this message, I would do so. But I don't ever get one, even though my methods throw the ubiquitous java.lang.Exception, which I handle in my Camel context with an onException element. -- View this message in context: http://camel.465427.n5.nabble.com/Asynchronous-routing-with-jms-hangs-in-midstream-tp5732805.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - www.camelone.org: The open source integration conference. Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Securing jaxrs REST interface with HTTP Basic auth
Ok, so it seems that implementing org.apache.cxf.jaxrs.ext.RequestHandler could help me. How to register such a provider then? We have REST interfaces created like this: camel-cxf:rsServer id=restFoo address=/rest/foo serviceClass=com.rest.FooRest/ We have few of these. I'm not sure, it it's possible to register jax-rs provider with this. On Mon, May 20, 2013 at 10:02 AM, Ioan Eugen Stan stan.ieu...@gmail.com wrote: Hello Martin, I think you could try addding a Filter or Interceptor that does Basic Auth. If you're using CXF you could try something like [1] Hope it helps, [1] http://cxf.apache.org/docs/secure-jax-rs-services.html On Mon, May 20, 2013 at 10:48 AM, Martin Stiborský martin.stibor...@gmail.com wrote: Hello guys, a joke is saying that a number of tabs opened in web browser related to some problem could help you to estimate the time needed for implementation. I have now about 33 tabs opened :) I need to secure my REST interface, with HTTP Basic auth. In the project, we are currently still with Camel 2.10.1 (not yet resolved some troubles with upgrade to 2.11 :( ), we are using OSGi and Aries blueprint. All deployed into Apache Karaf. Just a simple hint which way to go is goood enough for me. Right now, I'm checking JAAS, but I'm really lost in this topic. -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi -- Ioan Eugen Stan 0720 898 747 -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi
Re: Securing jaxrs REST interface with HTTP Basic auth
So far it seems for me that I have a big problem with architecture of the application. It was working well so far, the approach we used. I mean, these camel-cxf:rsServer elements, with classes describing REST interface following jax-rs. The REST classes were looking a little bit weird, as they returning null (http://www.javacodegeeks.com/2012/05/rest-endpoint-for-integration-using.html) but it was possible then to use the rest class directly in the start of a camel routes with from(cxfrs:bean:something). Is something like this possible with this way of registering jax-rs? jaxrs:server id=customerService address=/ jaxrs:serviceBeans ref component-id=myServiceBean / /jaxrs:serviceBeans jaxrs:providers bean id=authorizationFilter class=com.foo.HttpAuth/ /jaxrs:providers /jaxrs:server The provider definitelly works like that, that's good. But everything else doesn't work :P On Mon, May 20, 2013 at 12:01 PM, Martin Stiborský martin.stibor...@gmail.com wrote: Ok, so it seems that implementing org.apache.cxf.jaxrs.ext.RequestHandler could help me. How to register such a provider then? We have REST interfaces created like this: camel-cxf:rsServer id=restFoo address=/rest/foo serviceClass=com.rest.FooRest/ We have few of these. I'm not sure, it it's possible to register jax-rs provider with this. On Mon, May 20, 2013 at 10:02 AM, Ioan Eugen Stan stan.ieu...@gmail.com wrote: Hello Martin, I think you could try addding a Filter or Interceptor that does Basic Auth. If you're using CXF you could try something like [1] Hope it helps, [1] http://cxf.apache.org/docs/secure-jax-rs-services.html On Mon, May 20, 2013 at 10:48 AM, Martin Stiborský martin.stibor...@gmail.com wrote: Hello guys, a joke is saying that a number of tabs opened in web browser related to some problem could help you to estimate the time needed for implementation. I have now about 33 tabs opened :) I need to secure my REST interface, with HTTP Basic auth. In the project, we are currently still with Camel 2.10.1 (not yet resolved some troubles with upgrade to 2.11 :( ), we are using OSGi and Aries blueprint. All deployed into Apache Karaf. Just a simple hint which way to go is goood enough for me. Right now, I'm checking JAAS, but I'm really lost in this topic. -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi -- Ioan Eugen Stan 0720 898 747 -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi
Re: Securing jaxrs REST interface with HTTP Basic auth
Hi On 20/05/13 12:19, Martin Stiborský wrote: So far it seems for me that I have a big problem with architecture of the application. It was working well so far, the approach we used. I mean, these camel-cxf:rsServer elements, with classes describing REST interface following jax-rs. The REST classes were looking a little bit weird, as they returning null (http://www.javacodegeeks.com/2012/05/rest-endpoint-for-integration-using.html) but it was possible then to use the rest class directly in the start of a camel routes with from(cxfrs:bean:something). Is something like this possible with this way of registering jax-rs? jaxrs:server id=customerService address=/ jaxrs:serviceBeans ref component-id=myServiceBean / /jaxrs:serviceBeans jaxrs:providers bean id=authorizationFilter class=com.foo.HttpAuth/ /jaxrs:providers /jaxrs:server Yes, simply do jaxrs:server id=customerService address=camel:/myCamelTransportAddress jaxrs:serviceBeans ref component-id=myServiceBean / /jaxrs:serviceBeans jaxrs:providers bean id=authorizationFilter class=com.foo.HttpAuth/ /jaxrs:providers /jaxrs:server And use that in combination with Camel Servlet transport. Also, have a look at the new Simple binding for cxfrs, available from Camel 2.11 Sergey The provider definitelly works like that, that's good. But everything else doesn't work :P On Mon, May 20, 2013 at 12:01 PM, Martin Stiborský martin.stibor...@gmail.com wrote: Ok, so it seems that implementing org.apache.cxf.jaxrs.ext.RequestHandler could help me. How to register such a provider then? We have REST interfaces created like this: camel-cxf:rsServer id=restFoo address=/rest/foo serviceClass=com.rest.FooRest/ We have few of these. I'm not sure, it it's possible to register jax-rs provider with this. On Mon, May 20, 2013 at 10:02 AM, Ioan Eugen Stan stan.ieu...@gmail.com wrote: Hello Martin, I think you could try addding a Filter or Interceptor that does Basic Auth. If you're using CXF you could try something like [1] Hope it helps, [1] http://cxf.apache.org/docs/secure-jax-rs-services.html On Mon, May 20, 2013 at 10:48 AM, Martin Stiborský martin.stibor...@gmail.com wrote: Hello guys, a joke is saying that a number of tabs opened in web browser related to some problem could help you to estimate the time needed for implementation. I have now about 33 tabs opened :) I need to secure my REST interface, with HTTP Basic auth. In the project, we are currently still with Camel 2.10.1 (not yet resolved some troubles with upgrade to 2.11 :( ), we are using OSGi and Aries blueprint. All deployed into Apache Karaf. Just a simple hint which way to go is goood enough for me. Right now, I'm checking JAAS, but I'm really lost in this topic. -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi -- Ioan Eugen Stan 0720 898 747 -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi
Re: Sharing a solution for discussion
Raúl, thanks for help. Your remark provide a councious reason to use camel-cxf, but, for now, as I am working with camel 2.8.0 and the parameters received from orbeon will never change (even for future forms) I planning making this change in another moment. Now I would like to ask about my next challenge I am facing: What could be a good approach to put the xml camming from existdb and send it, in a soap message, to a webserver? -- View this message in context: http://camel.465427.n5.nabble.com/Sharing-a-solution-for-discussion-tp5732560p5732839.html Sent from the Camel - Users mailing list archive at Nabble.com.
Not Expiring JMS Messages with ActiveMQ / Camel
Hi there, I am using ActiveMQ 5.8.0 and Camel 2.10.4. I am reading ExchangePattern.InOnly messages from a JMS queue, and want to expire those which are not processed within a given time explicitly to a named dead letter queue. The problem is I can't get things to expire. I have the following route: public class FulfillmentRequestRoute extends RouteBuilder { @Override public void configure() throws Exception { errorHandler(deadLetterChannel(jms:queue:dead).useOriginalMessage()); from(jms:queue:fulfillmentRequest?explicitQosEnabled=truetimeToLive=1transacted=truepreserveMessageQos=true) .transacted() .to(mock:initialProcessor); } } And the following ActiveMQ config: ?xml version=1.0 encoding=UTF-8? beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:broker=http://activemq.apache.org/schema/core; xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd; broker:broker useJmx=true persistent=true brokerName=myBroker broker:transportConnectors broker:transportConnector name=vm uri=vm://myBroker / broker:transportConnector name=tcp uri=tcp://localhost:${tcp.port} / /broker:transportConnectors broker:persistenceAdapter broker:kahaPersistenceAdapter directory=target/olp-activemq-data maxDataFileLength=33554432/ /broker:persistenceAdapter broker:destinationPolicy broker:policyMap broker:policyEntries broker:policyEntry queue= broker:deadLetterStrategy broker:sharedDeadLetterStrategy processExpired=true processNonPersistent=true / /broker:deadLetterStrategy /broker:policyEntry /broker:policyEntries /broker:policyMap /broker:destinationPolicy /broker:broker bean id=jms class=org.apache.activemq.camel.component.ActiveMQComponent property name=brokerURL value=vm://myBroker / property name=transacted value=true/ property name=transactionManager ref=jmsTransactionManager/ property name=acceptMessagesWhileStopping value=false/ /bean bean id=jmsTransactionManager class=org.springframework.jms.connection.JmsTransactionManager property name=connectionFactory ref=jmsConnectionFactory/ /bean bean id=jmsConnectionFactory class=org.apache.activemq.ActiveMQConnectionFactory property name=brokerURL value=vm://myBroker / /bean /beans Finally I have a Unit Test which creates two messages,one which will be processed, and the other which should time-out. @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {classpath:/META-INF/spring/camel-server.xml}) public class FulfillmentRequestTimeoutTest { @EndpointInject(uri = mock:initialProcessor) protected MockEndpoint mockEndpoint; @Produce protected ProducerTemplate template; protected ConsumerTemplate consumer; @Autowired @Qualifier(camel-server) protected CamelContext context; @DirtiesContext @Test public void requestPutOnTimedOutQueueIfOlderThanTimeToLive() throws Exception { // Given consumer = context.createConsumerTemplate(); int expectedValidMessageCount = 3; mockEndpoint.expectedMessageCount(expectedValidMessageCount); // When String xmlBody1 = ?xml version=\1.0\?bodyTHIS WILL NOT TIMEOUT/body; template.sendBody(jms:queue:fulfillmentRequest, ExchangePattern.InOnly, xmlBody1); long ttl = System.currentTimeMillis() - 1200; String xmlBody2 = ?xml version=\1.0\?body!TIMED OUT!/body; template.sendBodyAndHeader(jms:queue:fulfillmentRequest, ExchangePattern.InOnly, xmlBody2, JMSExpiration, ttl); // Then // The second message is not processed mockEndpoint.assertIsSatisfied(); // This fails, but it sees two messages rather than just one ListExchange list = mockEndpoint.getReceivedExchanges(); String notTimedOutMessageBody = (String) list.get(0).getIn().getBody(String.class); assertEquals(xmlBody1, notTimedOutMessageBody); Thread.sleep(5000); // And is instead routed to the timedOut JMS queue Object dlqBody = consumer.receiveBodyNoWait(jms:queue:dead); assertNotNull(Should not lose the message, dlqBody); // This also fails if I comment out the assert above assertEquals(xmlBody2, dlqBody); } @Configuration public static class ContextConfig extends SingleRouteCamelConfiguration {
Re: Not Expiring JMS Messages with ActiveMQ / Camel
It seems you're expecting the broker to expire the messages? By default the expiration task for a queue will run every 30s.. if your test is taking less time than that, you'll want to tune the broker to check for expiration a little sooner: policyEntry expireMessagesPeriod=1s / On Mon, May 20, 2013 at 5:04 AM, al94781 and...@harmel-law.com wrote: Hi there, I am using ActiveMQ 5.8.0 and Camel 2.10.4. I am reading ExchangePattern.InOnly messages from a JMS queue, and want to expire those which are not processed within a given time explicitly to a named dead letter queue. The problem is I can't get things to expire. I have the following route: public class FulfillmentRequestRoute extends RouteBuilder { @Override public void configure() throws Exception { errorHandler(deadLetterChannel(jms:queue:dead).useOriginalMessage()); from(jms:queue:fulfillmentRequest?explicitQosEnabled=truetimeToLive=1transacted=truepreserveMessageQos=true) .transacted() .to(mock:initialProcessor); } } And the following ActiveMQ config: ?xml version=1.0 encoding=UTF-8? beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:broker=http://activemq.apache.org/schema/core; xsi:schemaLocation=http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.2.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.8.0.xsd; broker:broker useJmx=true persistent=true brokerName=myBroker broker:transportConnectors broker:transportConnector name=vm uri=vm://myBroker / broker:transportConnector name=tcp uri=tcp://localhost:${tcp.port} / /broker:transportConnectors broker:persistenceAdapter broker:kahaPersistenceAdapter directory=target/olp-activemq-data maxDataFileLength=33554432/ /broker:persistenceAdapter broker:destinationPolicy broker:policyMap broker:policyEntries broker:policyEntry queue= broker:deadLetterStrategy broker:sharedDeadLetterStrategy processExpired=true processNonPersistent=true / /broker:deadLetterStrategy /broker:policyEntry /broker:policyEntries /broker:policyMap /broker:destinationPolicy /broker:broker bean id=jms class=org.apache.activemq.camel.component.ActiveMQComponent property name=brokerURL value=vm://myBroker / property name=transacted value=true/ property name=transactionManager ref=jmsTransactionManager/ property name=acceptMessagesWhileStopping value=false/ /bean bean id=jmsTransactionManager class=org.springframework.jms.connection.JmsTransactionManager property name=connectionFactory ref=jmsConnectionFactory/ /bean bean id=jmsConnectionFactory class=org.apache.activemq.ActiveMQConnectionFactory property name=brokerURL value=vm://myBroker / /bean /beans Finally I have a Unit Test which creates two messages,one which will be processed, and the other which should time-out. @RunWith(CamelSpringJUnit4ClassRunner.class) @ContextConfiguration(locations = {classpath:/META-INF/spring/camel-server.xml}) public class FulfillmentRequestTimeoutTest { @EndpointInject(uri = mock:initialProcessor) protected MockEndpoint mockEndpoint; @Produce protected ProducerTemplate template; protected ConsumerTemplate consumer; @Autowired @Qualifier(camel-server) protected CamelContext context; @DirtiesContext @Test public void requestPutOnTimedOutQueueIfOlderThanTimeToLive() throws Exception { // Given consumer = context.createConsumerTemplate(); int expectedValidMessageCount = 3; mockEndpoint.expectedMessageCount(expectedValidMessageCount); // When String xmlBody1 = ?xml version=\1.0\?bodyTHIS WILL NOT TIMEOUT/body; template.sendBody(jms:queue:fulfillmentRequest, ExchangePattern.InOnly, xmlBody1); long ttl = System.currentTimeMillis() - 1200; String xmlBody2 = ?xml version=\1.0\?body!TIMED OUT!/body; template.sendBodyAndHeader(jms:queue:fulfillmentRequest, ExchangePattern.InOnly, xmlBody2, JMSExpiration, ttl); // Then // The second message is not processed mockEndpoint.assertIsSatisfied(); // This fails, but it sees two messages rather than just one ListExchange list = mockEndpoint.getReceivedExchanges(); String notTimedOutMessageBody = (String) list.get(0).getIn().getBody(String.class); assertEquals(xmlBody1, notTimedOutMessageBody); Thread.sleep(5000); // And is instead routed
Re: Sharing a solution for discussion
Hi, I guess you need to do some xml transformation to make the xml fit of the soap message. Did you check out camel-xslt[1] before? [1]http://camel.apache.org/xslt.html -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Monday, May 20, 2013 at 7:24 PM, wagnermarques wrote: Raúl, thanks for help. Your remark provide a councious reason to use camel-cxf, but, for now, as I am working with camel 2.8.0 and the parameters received from orbeon will never change (even for future forms) I planning making this change in another moment. Now I would like to ask about my next challenge I am facing: What could be a good approach to put the xml camming from existdb and send it, in a soap message, to a webserver? -- View this message in context: http://camel.465427.n5.nabble.com/Sharing-a-solution-for-discussion-tp5732560p5732839.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
calling a non-direct consumer directly
Hello, I have a question. Suppose I have a route that has a consumer that is not direct, say it's jetty. For example: route R1 from uri=jetty:http://localhost:8080/test; / to ... / to ... / /route now I want to invoke this route from another route but I don't want to go via http, rather I want to treat it as if it's direct consumer. I'm doing this from either a regular producer/processor or programmatically (maybe a producerTemplate which I guess is still a producer), so I have an exchange that I want to just pass to the consumer as if the consumer is using the direct component. Is this possible and if so how? note: I don't want to actually modify route R1 to have a direct consumer, I want to keep it the same but just invoke it directly without having to go through the transport protocol and such of the consumer, in this case being jetty:http. Also it's all from within the same camel context as the route R1. -- View this message in context: http://camel.465427.n5.nabble.com/calling-a-non-direct-consumer-directly-tp5732844.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Not Expiring JMS Messages with ActiveMQ / Camel
Hi @ceposta, I've just put that line in my config and I can now see ActiveMQ saying queue://fulfillmentRequest expiring messages My test is still failing, but it's probably because I'm being an idiot somewhere. Thanks for your help. I'll post back the eventual outcome Cheers, Andrew -- View this message in context: http://camel.465427.n5.nabble.com/Not-Expiring-JMS-Messages-with-ActiveMQ-Camel-tp5732841p5732845.html Sent from the Camel - Users mailing list archive at Nabble.com.
cxf logging Feature Enabled to separate log file
Hi I am able to write cxf's inbound and outbound messages to log file with logFeatureEnabled. As of now these logs are written to my main app log file,but I need to write these inbound and outbound to separate file. Is there anyway I can mention appender name? - Regards kiran Reddy -- View this message in context: http://camel.465427.n5.nabble.com/cxf-logging-Feature-Enabled-to-separate-log-file-tp5732847.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Asynchronous routing with jms hangs in midstream
Wow!. Thanks for your insight. I would not have known about combining transactions with parallel processing. This could change my overall implementation. Would spawning a new thread for each pass in my import processor overcome this limitation, or just compound it? -- View this message in context: http://camel.465427.n5.nabble.com/Asynchronous-routing-with-jms-hangs-in-midstream-tp5732805p5732846.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: stream:file closeOnDone not close all time
Hi ! Please h o w can I pass by this limitation ? Le 19 mai 2013 22:58, Jean Francois LE BESCONT jflebesc...@gmail.com a écrit : If it is possible ! 2013/5/19 Jean Francois LE BESCONT jflebesc...@gmail.com Hi, Could you please tell me Claus how to use the addOnCompletion to close the stream ? THanks Jeff 2013/5/16 Jean Francois LE BESCONT jflebesc...@gmail.com By the way, the problem appears not on if there are two files. It appears if the last exchange is not passed to the endpoint. Example with only one file : from(file://C:/Temp/camel/rep1/?noop=true) .split() .tokenize(\n) .streaming() .process(new Processor() { public void process(Exchange exchange) throws Exception { // After 2 lines, next lines are rejected via an // exchange property i++; if (i 2) { exchange.setProperty(FILE_1, false); } else { exchange.setProperty(FILE_1, true); } } }) .choice() .when(property(FILE_1).isEqualTo(Boolean.TRUE)) .to(stream:file?fileName=C:/Temp/camel/rep1/out/out_1.csvcloseOnDone=true) .end() .end() .end(); Jeff 2013/5/16 Jean Francois LE BESCONT jflebesc...@gmail.com Hi, Thanks Claus for the answer. I have logged a jira ( https://issues.apache.org/jira/browse/CAMEL-6367) I have not really understand how to implements your recommandation about exchange.addOnCompletion. After downloaded the camel code to understand how package org.apache.camel.converter.stream works, I don't know how to access the fileInputStreamCache from the processor : .process(new Processor() { public void process(Exchange exchange) throws Exception { exchange.addOnCompletion(new SynchronizationAdapter() { @Override public void onDone(Exchange exchange) { FileInputStreamCache fileInputStreamCache= ?? ; try { if (fileInputStreamCache != null) { fileInputStreamCache.close(); } close(); } catch (Exception e) { LOG.warn(Error deleting temporary cache file: + tempFile, e); } } }); } Is it possible ? Thanks Jeff 2013/5/16 Claus Ibsen claus.ib...@gmail.com I have updated the wiki docs. Though we could improve the stream component to auto close the stream when the exchange is done at the end of routing as a fallback. Then your use-case with writing to 2+ files can be supported, as all the streams is closed when the routing is done at the end. This requires to add an onCompletion to the exchange exchange.addOnCompletion And then add logic there to close the stream Though a little challenge could be concurrency if you close the stream, and then another exchange is using it currently. Seems like the logic in stream producer should sync (lock) and not per method which is wrong. Or maybe better yet do not have a shared output stream. Fell free to log a JIRA ticket On Thu, May 16, 2013 at 8:07 AM, Claus Ibsen claus.ib...@gmail.com wrote: Hi That is because you do write to 2 files. The option was intended for writing to the same file. On Thu, May 16, 2013 at 7:43 AM, Jean Francois LE BESCONT jflebesc...@gmail.com wrote: Hi, what should I do ? Thanks Jeff 2013/5/15 Jean Francois LE BESCONT jflebesc...@gmail.com Hey ! A new option is available for the stream:file to close it when done (closeOnDone). This option is appeared in 2.11 after my jira ( https://issues.apache.org/jira/browse/CAMEL-6147) File unlock (or released or closed) looks to doesn't works fine if last line is not passed to the endpoint Example : We have a CSV with X line. We want to write a part of it in a file out_1.csv and a second part in a file out_2.csv according to a business rule, in my example the rule is after two lines readed. An example is : from(file://C:/Temp/camel/rep1/?noop=true) .log(start process file = ${file:name}) .split() .tokenize(\n) .streaming() .process(new Processor() { public void process(Exchange exchange) throws Exception { // After 2 lines, next lines are rejected via an exchange property i++ ; if( i 2) { exchange.setProperty(FILE_1, true ); } else { exchange.setProperty(FILE_1, false); } } }) .choice() .when(property(FILE_1).isEqualTo(Boolean.TRUE)) .to(stream:file?fileName=C:/Temp/camel/rep1/out/out_1.csvcloseOnDone=true) .when(property(FILE_2).isEqualTo(Boolean.TRUE)) .to(stream:file?fileName=C:/Temp/camel/rep1/out/out_2.csvcloseOnDone=true) .end() .end() .log(end process file = ${file:name}) .end() ; It create
Re: Securing jaxrs REST interface with HTTP Basic auth
wow, works, many thanks to you. I promised already few, but I should really write some tutorial on this topic…give me a slap if I don't do it next weekend… On Mon, May 20, 2013 at 1:26 PM, Sergey Beryozkin sberyoz...@gmail.com wrote: Hi On 20/05/13 12:19, Martin Stiborský wrote: So far it seems for me that I have a big problem with architecture of the application. It was working well so far, the approach we used. I mean, these camel-cxf:rsServer elements, with classes describing REST interface following jax-rs. The REST classes were looking a little bit weird, as they returning null (http://www.javacodegeeks.com/2012/05/rest-endpoint-for-integration-using.html) but it was possible then to use the rest class directly in the start of a camel routes with from(cxfrs:bean:something). Is something like this possible with this way of registering jax-rs? jaxrs:server id=customerService address=/ jaxrs:serviceBeans ref component-id=myServiceBean / /jaxrs:serviceBeans jaxrs:providers bean id=authorizationFilter class=com.foo.HttpAuth/ /jaxrs:providers /jaxrs:server Yes, simply do jaxrs:server id=customerService address=camel:/myCamelTransportAddress jaxrs:serviceBeans ref component-id=myServiceBean / /jaxrs:serviceBeans jaxrs:providers bean id=authorizationFilter class=com.foo.HttpAuth/ /jaxrs:providers /jaxrs:server And use that in combination with Camel Servlet transport. Also, have a look at the new Simple binding for cxfrs, available from Camel 2.11 Sergey The provider definitelly works like that, that's good. But everything else doesn't work :P On Mon, May 20, 2013 at 12:01 PM, Martin Stiborský martin.stibor...@gmail.com wrote: Ok, so it seems that implementing org.apache.cxf.jaxrs.ext.RequestHandler could help me. How to register such a provider then? We have REST interfaces created like this: camel-cxf:rsServer id=restFoo address=/rest/foo serviceClass=com.rest.FooRest/ We have few of these. I'm not sure, it it's possible to register jax-rs provider with this. On Mon, May 20, 2013 at 10:02 AM, Ioan Eugen Stan stan.ieu...@gmail.com wrote: Hello Martin, I think you could try addding a Filter or Interceptor that does Basic Auth. If you're using CXF you could try something like [1] Hope it helps, [1] http://cxf.apache.org/docs/secure-jax-rs-services.html On Mon, May 20, 2013 at 10:48 AM, Martin Stiborský martin.stibor...@gmail.com wrote: Hello guys, a joke is saying that a number of tabs opened in web browser related to some problem could help you to estimate the time needed for implementation. I have now about 33 tabs opened :) I need to secure my REST interface, with HTTP Basic auth. In the project, we are currently still with Camel 2.10.1 (not yet resolved some troubles with upgrade to 2.11 :( ), we are using OSGi and Aries blueprint. All deployed into Apache Karaf. Just a simple hint which way to go is goood enough for me. Right now, I'm checking JAAS, but I'm really lost in this topic. -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi -- Ioan Eugen Stan 0720 898 747 -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi -- S pozdravem / Best regards Martin Stiborský Jabber: st...@njs.netlab.cz Twitter: http://www.twitter.com/stibi
File URI + JDBC Idempotent Repository + new file key
Can I use a customized JdbcMessageIdRepository as the idempotentRepository in a File URI ? And if so, can I use the updated idempotentKey against this JdbcMessageIdRepository. i.e. from uri=file:directory?idempotentRepository=#JDBCRepoidempotentKey=${file:name}-${file:modified}-${file:size} . -- View this message in context: http://camel.465427.n5.nabble.com/File-URI-JDBC-Idempotent-Repository-new-file-key-tp5732855.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Sharing a solution for discussion
Willem, I was thinking to start with a simple hardcoded string message first because I have a so simple webservice that receive a string and return the same string. If this is ok, I will work with real xml instances... I found a aproach to do it and if someone have a remark, please help me!!! My inspiration was https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf/ Sorry for the length of the post and much comments, but I am put the solution in this way because was so hard to me find and understand a solution to create a cxf provider and it can help someone in the future. I would like to ask: 1) I am not shure if I still need xslt? Maybe in another moment. 2) Could I return javascript to the browser? *BELOW IS THE ROUTE* ?xml version=1.0 encoding=UTF-8? beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:cxf=http://camel.apache.org/schema/cxf; xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd; cxf:cxfEndpoint id=echoEndpoint serviceClass=org.apache.camel.example.cxf.provider.GreeterProvider address=http://localhost:8282/ode/processes/ProcessoSincrono; wsdlURL=wsdl/ProcessoSincronoArtifacts.wsdl endpointName=s:ProcessoSincronoPort serviceName=s:ProcessoSincronoService xmlns:s=br.edu.fzlbpms.teste/ camelContext xmlns=http://camel.apache.org/schema/spring; route id=FZLBPMS_CAMEL_ROUTE___OrbeonService from uri=jetty:http://localhost:18181/orbeonservice/pega_dados_do_formulario?sessionSupport=true/ to uri=Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR/ setHeader headerName=CamelHttpUri simplehttp://localhost:8282/exist/rest/db/orbeon/fr/${header.fzlbpms_orbeon_app}/${header.fzlbpms_orbeon_form}/data/${header.fzlbpms_orbeon_dataId}/data.xml/simple /setHeader log message=--/ log message=before inOut.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ inOut uri=http://doesnt.matter.we/override/it/anyways; / log message=--/ log message=before SOAPMessageProducerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ to uri=SOAPMessageProducerPROCESSOR/ log message=--/ log message=before SOAPMessageProducerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ to uri=cxf:bean:echoEndpoint / log message=--/ log message=before SOAPMessageConsumerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ to uri=SOAPMessageConsumerPROCESSOR/ log message=--/ log message=before SOAPMessageConsumerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ inOut uri=http://doesnt.matter.we/override/it/anyways; / /route /camelContext bean id=SOAPMessageConsumerPROCESSOR class=br.edu.fzlbpms.service.orbeon.SOAPMessageConsumerPROCESSOR / bean id=SOAPMessageProducerPROCESSOR class=br.edu.fzlbpms.service.orbeon.SOAPMessageProducerPROCESSOR / bean
Camel Quartz and JobStore
Hello, I'm trying to use the misfire property from Camel-Quartz persisting the data at the database ( SQL server ) with JobStore from Quartz but i'm facing a strange problem after the restart of the application. For some reason after the restart, all data disappear for some reason and the misfire is not getting triggered. When i setted the xx.isClustered=true the all data is kept what does make sense, but it's not my case. I would like to know if is there any way to keep the data intact after the app restart so i can see the misfire working properly. The class used to control the transaction is org.quartz.impl.jdbcjobstore.JobStoreTX Regards ! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Quartz-and-JobStore-tp5732853.html Sent from the Camel - Users mailing list archive at Nabble.com.
Enable disable routes at startup using Spring
Is there a way to get something like this to work: route autoStartup=${enableRoute} The value of the attribute is set to a valid parsible string representation of a boolean (ie. true or false) yet I keep getting the following error: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route8: Route[[From[quickfix:quickfix.cfg]] - [Filter[s... because of Error parsing [${enableRoute}] from property ${enableRoute} as a Boolean. Any assistnace would be greatly appreciated. -- View this message in context: http://camel.465427.n5.nabble.com/Enable-disable-routes-at-startup-using-Spring-tp5732852.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Sharing a solution for discussion
For the Question 1 I just found you create the SOAP message by hand, it could be more easy for you to use camel soap data format[1]. For the Question 2 What's the javascript looks like, if it is static you can add customer handler to the camel-jetty endpoint to return the static file to the browser. [1]http://camel.apache.org/soap.html -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, May 21, 2013 at 5:47 AM, wagnermarques wrote: Willem, I was thinking to start with a simple hardcoded string message first because I have a so simple webservice that receive a string and return the same string. If this is ok, I will work with real xml instances... I found a aproach to do it and if someone have a remark, please help me!!! My inspiration was https://svn.apache.org/repos/asf/camel/trunk/examples/camel-example-cxf/ Sorry for the length of the post and much comments, but I am put the solution in this way because was so hard to me find and understand a solution to create a cxf provider and it can help someone in the future. I would like to ask: 1) I am not shure if I still need xslt? Maybe in another moment. 2) Could I return javascript to the browser? *BELOW IS THE ROUTE* ?xml version=1.0 encoding=UTF-8? beans xmlns=http://www.springframework.org/schema/beans; xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance; xmlns:cxf=http://camel.apache.org/schema/cxf; xsi:schemaLocation= http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd; cxf:cxfEndpoint id=echoEndpoint serviceClass=org.apache.camel.example.cxf.provider.GreeterProvider address=http://localhost:8282/ode/processes/ProcessoSincrono; wsdlURL=wsdl/ProcessoSincronoArtifacts.wsdl endpointName=s:ProcessoSincronoPort serviceName=s:ProcessoSincronoService xmlns:s=br.edu.fzlbpms.teste/ camelContext xmlns=http://camel.apache.org/schema/spring; route id=FZLBPMS_CAMEL_ROUTE___OrbeonService from uri=jetty:http://localhost:18181/orbeonservice/pega_dados_do_formulario?sessionSupport=true/ to uri=Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR/ setHeader headerName=CamelHttpUri simplehttp://localhost:8282/exist/rest/db/orbeon/fr/${header.fzlbpms_orbeon_app}/${header.fzlbpms_orbeon_form}/data/${header.fzlbpms_orbeon_dataId}/data.xml/simple /setHeader log message=--/ log message=before inOut.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ inOut uri=http://doesnt.matter.we/override/it/anyways; / log message=--/ log message=before SOAPMessageProducerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ to uri=SOAPMessageProducerPROCESSOR/ log message=--/ log message=before SOAPMessageProducerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ to uri=cxf:bean:echoEndpoint / log message=--/ log message=before SOAPMessageConsumerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ to uri=SOAPMessageConsumerPROCESSOR/ log message=--/ log message=before SOAPMessageConsumerPROCESSOR.../ log message=### body = ${body}/ log message=###/ log message=###/ log message=###/ inOut uri=http://doesnt.matter.we/override/it/anyways; / /route /camelContext bean id=SOAPMessageConsumerPROCESSOR class=br.edu.fzlbpms.service.orbeon.SOAPMessageConsumerPROCESSOR / bean id=SOAPMessageProducerPROCESSOR class=br.edu.fzlbpms.service.orbeon.SOAPMessageProducerPROCESSOR / bean id=Handle_App_e_FormTitle_camming_from_orbeonformPROCESSOR class=br.edu.fzlbpms.service.orbeon.Pega_dados_do_formularioPROCESSOR / /beans public class SOAPMessageConsumerPROCESSOR implements Processor { /** * just prepare to show response in the browser */ public void process(Exchange exchange) throws Exception { //SOAPMessage processSOAP = processSOAP(exchange); String soapMessageBodyContentAsString = SOAPMessageBodyContentAsString(exchange); exchange.getIn().setBody(soapMessageBodyContentAsString); } public String SOAPMessageBodyContentAsString(Exchange exchange){ SOAPMessage soapMessage =
Re: Enable disable routes at startup using Spring
Hi, How did you setup the property component? I think you can not use the Spring property placeholder inside route definition. But here is an example you can take a look. camelContext xmlns=http://camel.apache.org/schema/spring; propertyPlaceholder id=properties location=org/apache/camel/my.properties/ route autoStartup={{enableRoute}} …… -- Willem Jiang Red Hat, Inc. FuseSource is now part of Red Hat Web: http://www.fusesource.com | http://www.redhat.com Blog: http://willemjiang.blogspot.com (http://willemjiang.blogspot.com/) (English) http://jnn.iteye.com (http://jnn.javaeye.com/) (Chinese) Twitter: willemjiang Weibo: 姜宁willem On Tuesday, May 21, 2013 at 4:44 AM, javaCzar wrote: Is there a way to get something like this to work: route autoStartup=${enableRoute} The value of the attribute is set to a valid parsible string representation of a boolean (ie. true or false) yet I keep getting the following error: org.apache.camel.RuntimeCamelException: org.apache.camel.FailedToCreateRouteException: Failed to create route route8: Route[[From[quickfix:quickfix.cfg]] - [Filter[s... because of Error parsing [${enableRoute}] from property ${enableRoute} as a Boolean. Any assistnace would be greatly appreciated. -- View this message in context: http://camel.465427.n5.nabble.com/Enable-disable-routes-at-startup-using-Spring-tp5732852.html Sent from the Camel - Users mailing list archive at Nabble.com (http://Nabble.com).
Re: File URI + JDBC Idempotent Repository + new file key
Yes you can On Tue, May 21, 2013 at 12:22 AM, PMulido marc.pul...@barcap.com wrote: Can I use a customized JdbcMessageIdRepository as the idempotentRepository in a File URI ? And if so, can I use the updated idempotentKey against this JdbcMessageIdRepository. i.e. from uri=file:directory?idempotentRepository=#JDBCRepoidempotentKey=${file:name}-${file:modified}-${file:size} . -- View this message in context: http://camel.465427.n5.nabble.com/File-URI-JDBC-Idempotent-Repository-new-file-key-tp5732855.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - www.camelone.org: The open source integration conference. Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Re: Camel Quartz and JobStore
Hi Can you try setting stateful=true On Mon, May 20, 2013 at 11:41 PM, mpaivafontes mpaivafon...@gmail.com wrote: Hello, I'm trying to use the misfire property from Camel-Quartz persisting the data at the database ( SQL server ) with JobStore from Quartz but i'm facing a strange problem after the restart of the application. For some reason after the restart, all data disappear for some reason and the misfire is not getting triggered. When i setted the xx.isClustered=true the all data is kept what does make sense, but it's not my case. I would like to know if is there any way to keep the data intact after the app restart so i can see the misfire working properly. The class used to control the transaction is org.quartz.impl.jdbcjobstore.JobStoreTX Regards ! -- View this message in context: http://camel.465427.n5.nabble.com/Camel-Quartz-and-JobStore-tp5732853.html Sent from the Camel - Users mailing list archive at Nabble.com. -- Claus Ibsen - www.camelone.org: The open source integration conference. Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
Transactions in camel
Hi my route is like this from(activemq:queue:partners) .transacted() .process(new Processor() { public void process(Exchange exchange) throws Exception { // TODO Auto-generated method stub String recipients = activemq:queue:output1,activemq:queue:output2,activemq:queue:output3,pp; exchange.getIn().setHeader(recipients, recipients); } }) .recipientList(header(recipients)); --If transaction fails it will going to the dead letter queue, insted of going the dead letter queue, it should be available in partners queue. How can i configure my route -- View this message in context: http://camel.465427.n5.nabble.com/Transactions-in-camel-tp5732863.html Sent from the Camel - Users mailing list archive at Nabble.com.
Re: how is the automatica type conversion happening
Hi Its the type converter that kicks in http://camel.apache.org/type-converter.html There is a fallback converter for JAXB so when you declare the method signature to have CompanyMsg as parameter type, then Camel will try to convert the message body to this type. And as CompanyMsg is a JAXB annotated class, then JAXB kicks-in. On Mon, May 20, 2013 at 7:22 PM, Vegi, Vamsi (MAN-Corporate-CON) vamsi.v...@manheim.com wrote: Hello I am confused how the camel framework is automatically unmarshalling the XML file into an JaxB object Here is my Configurator, with the route def == @Override public void configure() throws Exception { LOG.info(CompanyMsgRouter: configure called); try { jaxbContext = JAXBContext.newInstance(CompanyMsg.class); jaxbUnmarshaller = jaxbContext.createUnmarshaller(); } catch (JAXBException e) { e.printStackTrace(); } from(file:C:\\camel\\files\\in?noop=true) // contains XML Msg .routeId(READ_Q_ROUTE_ID) .log(LoggingLevel.INFO, uploading file:${header.CamelFilePath}) .bean(new TransformSvcCompanyMsg(), getCompleteCompanyDao); // expects JAXB object here } == The method: getCompleteCompanyDao has the signature like like public Company getCompleteCompanyDao(final CompanyMsg compMsg) { : : } Question is: when I run the app, it works fine, but I am confused as when and where the unmarshalling is happening. I am not explicitly calling the JaxB unmarshaller Is it using the jaxBUnMarshaller that I had previously defined? Btw, all the needed JaxB classes are in the path. -thanks -V -- Claus Ibsen - www.camelone.org: The open source integration conference. Red Hat, Inc. FuseSource is now part of Red Hat Email: cib...@redhat.com Web: http://fusesource.com Twitter: davsclaus Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen