Re: camel-jetty and loadbalancing

2009-12-14 Thread Charles Moulliard
Using this option, I get the following error :

org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://0.0.0.0:8282/reportservice/incidents with statusCode:
407
at
org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:150)
at
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:92)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
at
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at
org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at
org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:41)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

Here is the content of the log

09:53:15,484 | INFO  | 7786...@qtp2-1   | Tracer   |
rg.apache.camel.processor.Logger   88 | 518e911d-e3d3-451f-a54b-6de2e8c2fd49
 (route2) from(http://0.0.0.0:8181) -- setExchangePattern: InOut 
Pattern:InOut, Headers:{Keep-Alive=300,
Accept=text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8,
CamelHttpUri=/reportservice/incidents/123/, CamelHttpUrl=
http://localhost:8181/reportservice/incidents/123/, CamelHttpMethod=GET,
Host=localhost:8181, CamelHttpPath=/reportservice/incidents/123/,
Accept-Encoding=gzip,deflate, Connection=keep-alive,

Re: camel-jetty and loadbalancing

2009-12-14 Thread Willem Jiang

Hi Charles,

Please check out this option for http producer.

throwExceptionOnFailure 	 true 	 Camel 2.0: Option to disable throwing 
the HttpOperationFailedException in case of failed responses from the 
remote server. This allows you to get all responses regardles of the 
HTTP status code.


[1] http://camel.apache.org/http.html

Willem

Charles Moulliard wrote:

Using this option, I get the following error :

org.apache.camel.component.http.HttpOperationFailedException: HTTP operation
failed invoking http://0.0.0.0:8282/reportservice/incidents with statusCode:
407
at
org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:150)
at
org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:92)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at
org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
at
org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at
org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at
org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at
org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:41)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at
org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at
org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
at
org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
at
org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
at
org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
at
org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
at
org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at
org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at
org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at
org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
at
org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at
org.mortbay.jetty.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:230)
at
org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152)
at org.mortbay.jetty.Server.handle(Server.java:324)
at
org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:534)
at
org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:864)
at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:533)
at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:207)
at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:403)
at
org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:409)
at
org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:522)

Here is the content of the log

09:53:15,484 | INFO  | 7786...@qtp2-1   | Tracer   |
rg.apache.camel.processor.Logger   88 | 518e911d-e3d3-451f-a54b-6de2e8c2fd49

(route2) from(http://0.0.0.0:8181) -- setExchangePattern: InOut 


Re: camel-jetty and loadbalancing

2009-12-14 Thread Charles Moulliard
If I use this option, I get now :

org.apache.commons.httpclient.NoHttpResponseException: The server localhost
failed to respond
at
org.apache.commons.httpclient.HttpMethodBase.readStatusLine(HttpMethodBase.java:1976)
at
org.apache.commons.httpclient.HttpMethodBase.readResponse(HttpMethodBase.java:1735)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)

from the stacktrace of the client sending the HTTP request

Charles Moulliard
Senior Enterprise Architect
Apache Camel Committer

*
blog : http://cmoulliard.blogspot.com
twitter : http://twitter.com/cmoulliard
Linkedlin : http://www.linkedin.com/in/charlesmoulliard

Apache Camel Group :
http://www.linkedin.com/groups?home=gid=2447439trk=anet_ug_hm


On Mon, Dec 14, 2009 at 10:00 AM, Willem Jiang willem.ji...@gmail.comwrote:

 Hi Charles,

 Please check out this option for http producer.

 throwExceptionOnFailure  trueCamel 2.0: Option to disable
 throwing the HttpOperationFailedException in case of failed responses from
 the remote server. This allows you to get all responses regardles of the
 HTTP status code.

 [1] http://camel.apache.org/http.html

 Willem


 Charles Moulliard wrote:

 Using this option, I get the following error :

 org.apache.camel.component.http.HttpOperationFailedException: HTTP
 operation
 failed invoking http://0.0.0.0:8282/reportservice/incidents with
 statusCode:
 407
at

 org.apache.camel.component.http.HttpProducer.populateHttpOperationFailedException(HttpProducer.java:150)
at
 org.apache.camel.component.http.HttpProducer.process(HttpProducer.java:92)
at

 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:97)
at

 org.apache.camel.processor.SendProcessor$1.doInProducer(SendProcessor.java:95)
at
 org.apache.camel.impl.ProducerCache.doInProducer(ProducerCache.java:146)
at
 org.apache.camel.processor.SendProcessor.doProcess(SendProcessor.java:94)
at
 org.apache.camel.processor.SendProcessor.process(SendProcessor.java:82)
at

 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at

 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at

 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at

 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at

 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at

 org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
at

 org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
at

 org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
at

 org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at

 org.apache.camel.processor.loadbalancer.QueueLoadBalancer.process(QueueLoadBalancer.java:41)
at

 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at

 org.apache.camel.processor.DelegateProcessor.processNext(DelegateProcessor.java:53)
at

 org.apache.camel.processor.DelegateProcessor.proceed(DelegateProcessor.java:82)
at

 org.apache.camel.processor.interceptor.TraceInterceptor.process(TraceInterceptor.java:162)
at

 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at

 org.apache.camel.processor.RedeliveryErrorHandler.processExchange(RedeliveryErrorHandler.java:223)
at

 org.apache.camel.processor.RedeliveryErrorHandler.processErrorHandler(RedeliveryErrorHandler.java:153)
at

 org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:91)
at

 org.apache.camel.processor.DefaultErrorHandler.process(DefaultErrorHandler.java:49)
at
 org.apache.camel.processor.DefaultChannel.process(DefaultChannel.java:206)
at org.apache.camel.processor.Pipeline.process(Pipeline.java:74)
at

 org.apache.camel.processor.UnitOfWorkProcessor.processNext(UnitOfWorkProcessor.java:54)
at

 org.apache.camel.processor.DelegateProcessor.process(DelegateProcessor.java:48)
at

 org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:67)
at
 org.apache.camel.component.http.CamelServlet.service(CamelServlet.java:53)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
at
 org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:502)
at
 org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:363)
at
 org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766)
at

Re: Not possible to use onException and doTry()... doFinally() ?

2009-12-14 Thread Claus Ibsen
On Fri, Dec 11, 2009 at 11:21 PM, Dragisa Krsmanovic
dkrsmano...@plos.org wrote:
 In this route, although message, correctly, does not get to mock:end, it
 does not seem to go to mock:error either.


doTry .. doCatch .. doFinally does NOT use regular error handling.
Its in fact its own little error handler where you let its doCatch
handle that if you like.


 from(seda:start)
    .onException(Exception.class)
      .handled(true)
      .redeliveryDelay(10)
      .maximumRedeliveries(2)
      .retryAttemptedLogLevel(LoggingLevel.WARN)
      .retriesExhaustedLogLevel(LoggingLevel.ERROR)
      .to(mock:error)
    .end()
    .doTry()
      .to(bean:throwsException)
    .doFinally()
      .to(mock:finally)
    .end()
    .to(mock:end);

 In fact, if I used direct:start instead of seda, I would get the
 exception thrown back.

Yes of course since seda is async (like a mini JMS queue inside) where
as direct is sync (just like a local method call).



 --
 Dragisa Krsmanovic
 Java Developer
 Public Library of Science
 http://www.plos.org


 --
 This email is confidential to the intended recipient. If you have received it 
 in error, please notify the sender and delete it from your system. Any 
 unauthorized use, disclosure or copying is not permitted. The views or 
 opinions presented are solely those of the sender and do not necessarily 
 represent those of Public Library of Science unless otherwise specifically 
 stated. Please note that neither Public Library of Science nor any of its 
 agents accept any responsibility for any viruses that may be contained in 
 this e-mail or its attachments and it is your responsibility to scan the 
 e-mail and attachments (if any).





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Filename based on XPath result

2009-12-14 Thread Martin Gilday
Hi,

I have a StringMessage which contains and XML body.  I would like to use
a unique part of the body as the filename in conjunction with the file
component.  Is it possible to consume from JMS and send to file with the
filename the result of an XPath match?

Thanks,
Martin.


Re: Filename based on XPath result

2009-12-14 Thread Claus Ibsen
On Mon, Dec 14, 2009 at 11:55 AM, Martin Gilday martin.li...@imap.cc wrote:
 Hi,

 I have a StringMessage which contains and XML body.  I would like to use
 a unique part of the body as the filename in conjunction with the file
 component.  Is it possible to consume from JMS and send to file with the
 filename the result of an XPath match?


Yeah this question came up last week
http://old.nabble.com/File-Component%3A-File-name-from-body-data-ts26708582.html


 Thanks,
 Martin.




-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: exception in load-testing using DataSet component

2009-12-14 Thread Nick Chistyakov
Hello Willem and Clause!

Thank you for response.
I added:

mockEndpoint.await(1, TimeUnit.MINUTES);

and the test now runs fine :))

Best of the best regards,
Nick

On Mon, Dec 14, 2009 at 11:11 AM, Claus Ibsen claus.ib...@gmail.com wrote:

 On Mon, Dec 14, 2009 at 9:09 AM, Willem Jiang willem.ji...@gmail.com
 wrote:
  Hi,
 
  It looks like the exception is thrown when the camel context is stopping
 and
  your dataset is still sending the data.
 
  When you call assertMockEndpointsSatisfied(), camel will try to wait for
 the
  message for about 30 second.
 
  If send a large amount of message, you need to add some sleep time in
 your
  testPerformance() method, to let camel finish the DataSet sending.
 

 There is also a method on mock endpoint to set the sleep time.


  Willem
 
 
  Nick Chistyakov wrote:
 
  Hello to all,
 
  I found several examples that are using DataSet (SimpleDataSet) for load
  tests.
  So I wrote that simple test:
 
 
  package com.etna.sandbox;
 
  import javax.jms.ConnectionFactory;
  import javax.naming.Context;
  import org.apache.activemq.ActiveMQConnectionFactory;
  import org.apache.camel.builder.RouteBuilder;
  import org.apache.camel.component.dataset.SimpleDataSet;
  import org.apache.camel.component.jms.JmsComponent;
  import org.apache.camel.test.junit4.CamelTestSupport;
  import org.apache.camel.util.jndi.JndiContext;
  import org.junit.Test;
 
  /**
   *
   * @author nick
   */
  public class PerformanceTest extends CamelTestSupport {
 
 private static int MESSAGE_COUNT= 1;
 
 public static final String BROKER_URI   =
 tcp://localhost:61616;
 
 private static final String MOCK_OUT= mock:out;
 private static final String INPUT_QUEUE =
  activemq:queue:dummy-in;
 private static final String OUTPUT_QUEUE=
  activemq:queue:dummy-out;
 private static final String DATASET_NAME= foo;
 private static final String DATASET_URI = dataset: +
  DATASET_NAME;
 
 
 
 private SimpleDataSet dataSet = new SimpleDataSet(MESSAGE_COUNT);
 
 @Override
 protected Context createJndiContext() throws Exception {
 JndiContext jndiContext = new JndiContext();
 
 ConnectionFactory connectionFactory = new
  ActiveMQConnectionFactory(BROKER_URI);
 jndiContext.bind(jms,
  JmsComponent.jmsComponentAutoAcknowledge(connectionFactory));
 
 dataSet.setReportCount(100);
 jndiContext.bind(DATASET_NAME, dataSet);
 
 return jndiContext;
 }
 
 @Override
 protected RouteBuilder createRouteBuilder() throws Exception {
 return new RouteBuilder() {
 public void configure() throws Exception {
 from(DATASET_URI ).to(INPUT_QUEUE);
 from(INPUT_QUEUE ).to(OUTPUT_QUEUE);
 from(OUTPUT_QUEUE).to(DATASET_URI);
 }
 };
 }
 
 @Test
 public void testPerformance() throws Exception {
 assertMockEndpointsSatisfied();
 }
  }
 
 
 
 
  But I'm getting an exception if MESSAGE_COUNT is a big number ( 2000
 for
  example)
  The test output is bellow:
 
 
 
 
 
  [  main] DefaultCamelContextINFO
   Apache
  Camel 2.2-SNAPSHOT (CamelContext:camel-1) is starting
  [  main] DefaultCamelContextINFO
  JMX
  enabled. Using DefaultManagedLifecycleStrategy.
  [  main] dataset://foo  INFO
   Start:
  Endpoint[dataset://foo] expecting 1 messages
  [ ActiveMQ Task] FailoverTransport  INFO
   Successfully connected to tcp://localhost:61616
  [ ActiveMQ Task] FailoverTransport  INFO
   Successfully connected to tcp://localhost:61616
  [  main] DefaultCamelContextINFO
   Apache
  Camel 2.2-SNAPSHOT (CamelContext:camel-1) started
  [  main] MockEndpoint   INFO
   Asserting: Endpoint[dataset://foo] is satisfied
  [ ActiveMQ Task] FailoverTransport  INFO
   Successfully connected to tcp://localhost:61616
  [ ActiveMQ Task] FailoverTransport  INFO
   Successfully connected to tcp://localhost:61616
  [mel thread 0: DataSetComponent] dataset://foo  INFO
   Sent:
  100 messages so far. Last group took: 821 millis which is: 121.803
  messages
  per second. average: 121.803
  [aultMessageListenerContainer-1] dataset://foo  INFO
   Received: 100 messages so far. Last group took: 748 millis which is:
  133.69
  messages per second. average: 133.69
  [aultMessageListenerContainer-1] dataset://foo  INFO
   Received: 200 messages so far. Last group took: 805 millis which is:
  124.224 messages per second. average: 128.783
  [mel thread 0: DataSetComponent] dataset://foo  INFO
   Sent:
  200 messages so far. Last group took: 824 millis which is: 

RSS with proxy details

2009-12-14 Thread jpcook

Hello,

I am trying to use the RSS component with a proxy server but it doesn't
appear to support this via parameters or in an obvious way? I created a
similar patch for the http component a while ago but am surprised something
like this isn't supported via the RSS component?

Thanks
Jonathan
-- 
View this message in context: 
http://old.nabble.com/RSS-with-proxy-details-tp26779902p26779902.html
Sent from the Camel - Users mailing list archive at Nabble.com.



onException() silently ignored if after transacted()

2009-12-14 Thread Dragisa Krsmanovic
Here is me with more questions/bug report.

I've noticed that Camel can be very sensitive on order operators are
invoked in route builder.

For example, transacted() has to be after onException(). Otherwise,
onException() is completely ignored and message will just pass through
error handling code like it's the part of regular route. See example:


// Fails
from(direct:fails)
  .transacted()
  .onException(Exception.class)
.handled(true)
.useOriginalBody()
.redeliveryDelay(10)
.maximumRedeliveries(2)
.retryAttemptedLogLevel(LoggingLevel.WARN)
.retriesExhaustedLogLevel(LoggingLevel.ERROR)
.to(mock:error)
  .end()
  .to(mock:end);

// Ok
from(direct:ok)
  .onException(Exception.class)
.handled(true)
.useOriginalBody()
.redeliveryDelay(10)
.maximumRedeliveries(2)
.retryAttemptedLogLevel(LoggingLevel.WARN)
.retriesExhaustedLogLevel(LoggingLevel.ERROR)
.to(mock:error)
  .end()
  .transacted()
  .to(mock:end);



  // Test fails
  @Test
  @DirtiesContext
  public void testTransactionOnException() throws InterruptedException {

errorMock.expectedMessageCount(0);
endpoint.expectedMessageCount(1);

fails.sendBody(Hello World);

errorMock.assertIsSatisfied();
endpoint.assertIsSatisfied();
  }


Ideally, Camel should either allow onException() after transacted() or
throw an error if trying to set onException() after transacted(). To
silently ignore onException() seems to be most undesirable.

Cheers,

-- 
Dragisa Krsmanovic
Java Developer
Public Library of Science 
http://www.plos.org


--
This email is confidential to the intended recipient. If you have received it 
in error, please notify the sender and delete it from your system. Any 
unauthorized use, disclosure or copying is not permitted. The views or opinions 
presented are solely those of the sender and do not necessarily represent those 
of Public Library of Science unless otherwise specifically stated. Please note 
that neither Public Library of Science nor any of its agents accept any 
responsibility for any viruses that may be contained in this e-mail or its 
attachments and it is your responsibility to scan the e-mail and attachments 
(if any).



Re: onException() silently ignored if after transacted()

2009-12-14 Thread Claus Ibsen
Hi

Yeah we will in the future break up the DSL to have a route setup part
and then the regular part for the route flow.
The former should setup onException, transaction, onCompletion,
interceptors and what not, eg cross function stuff.
And the latter is for the route.

The problem is that its currently in the same level. However we didnt
want to do that just out of the blue as it will cause people having to
rearrange the existing routes.



On Mon, Dec 14, 2009 at 6:30 PM, Dragisa Krsmanovic
dkrsmano...@plos.org wrote:
 Here is me with more questions/bug report.

 I've noticed that Camel can be very sensitive on order operators are
 invoked in route builder.

 For example, transacted() has to be after onException(). Otherwise,
 onException() is completely ignored and message will just pass through
 error handling code like it's the part of regular route. See example:


 // Fails
 from(direct:fails)
  .transacted()
  .onException(Exception.class)
    .handled(true)
    .useOriginalBody()
    .redeliveryDelay(10)
    .maximumRedeliveries(2)
    .retryAttemptedLogLevel(LoggingLevel.WARN)
    .retriesExhaustedLogLevel(LoggingLevel.ERROR)
    .to(mock:error)
  .end()
  .to(mock:end);

 // Ok
 from(direct:ok)
  .onException(Exception.class)
    .handled(true)
    .useOriginalBody()
    .redeliveryDelay(10)
    .maximumRedeliveries(2)
    .retryAttemptedLogLevel(LoggingLevel.WARN)
    .retriesExhaustedLogLevel(LoggingLevel.ERROR)
    .to(mock:error)
  .end()
  .transacted()
  .to(mock:end);

 

  // Test fails
 �...@test
 �...@dirtiescontext
  public void testTransactionOnException() throws InterruptedException {

    errorMock.expectedMessageCount(0);
    endpoint.expectedMessageCount(1);

    fails.sendBody(Hello World);

    errorMock.assertIsSatisfied();
    endpoint.assertIsSatisfied();
  }


 Ideally, Camel should either allow onException() after transacted() or
 throw an error if trying to set onException() after transacted(). To
 silently ignore onException() seems to be most undesirable.

 Cheers,

 --
 Dragisa Krsmanovic
 Java Developer
 Public Library of Science
 http://www.plos.org


 --
 This email is confidential to the intended recipient. If you have received it 
 in error, please notify the sender and delete it from your system. Any 
 unauthorized use, disclosure or copying is not permitted. The views or 
 opinions presented are solely those of the sender and do not necessarily 
 represent those of Public Library of Science unless otherwise specifically 
 stated. Please note that neither Public Library of Science nor any of its 
 agents accept any responsibility for any viruses that may be contained in 
 this e-mail or its attachments and it is your responsibility to scan the 
 e-mail and attachments (if any).





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Help to understand xpath expression in camel routebuilder

2009-12-14 Thread Kenneth H

Hi,

I'm trying to udnerstand a camel example, but I'm stuck at a poit where
xpath is used. The builder is shown here:

public void configure() {
from(SERVICE_IN) // SERVICE_IN =
jbi:service:http://esbinaction.com/insurance/insuranceDSLRouter
.convertBodyTo(DOMSource.class) // Convert to DOM tree
.choice()

.when(xpath(//ins:TravelInsuranceRequest).namespace(ins,
http://dzone.com/insurance;))
.to(TRAVEL_OUT)

.when(xpath(//ins:CarInsuranceRequest).namespace(ins,
http://dzone.com/insurance;))
.to(LUXURY_CAR_OUT, BUDGET_CAR_OUT)
.otherwise()
.to(FAILURE_OUT);
}

My problem is the when: what exactly does:

when(xpath(//ins:TravelInsuranceRequest).namespace(ins,
http://dzone.com/insurance;))

mean? 

Can anybody help me?

Kind regards,
Kenneth H
-- 
View this message in context: 
http://old.nabble.com/Help-to-understand-xpath-expression-in-camel-routebuilder-tp26779963p26779963.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: HTTPS authentication setup using camel-http

2009-12-14 Thread ychawla

Is it possible to do this same 'hookup' using the Spring DSL.  I am not sure
if it is possible to specify this in Spring:

HttpComponent httpComponent = (HttpComponent)
getContext().getComponent(http);
httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer()); 


bwhite wrote:
 
 Thanks for the info Willem, that's just what I needed.
 
 Here's a little more information for anyone who may end up following in my
 footsteps:
 
 Create a class that implements HttpClientConfigurer, and registers https
 protocol providing a keystore or truststore per Willem's example below.
 Then, from your camel route builder class you can hook it up like so:
 
 HttpComponent httpComponent = (HttpComponent)
 getContext().getComponent(http);
 httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer());
 
 Bryan
 
 
 willem.jiang wrote:
 
 
 If you just wan to specify the keystore and truststore you can do int in 
 your HttpClientConfigurer.
 
 Protocol authhttps = new Protocol(https,
 new AuthSSLProtocolSocketFactory(
 new URL(file:my.keystore), mypassword,
 new URL(file:my.truststore), mypassword), 443);
 Protocol.registerProtocol(https, authhttps);
 
 
 
 

-- 
View this message in context: 
http://old.nabble.com/Re%3A-HTTPS-authentication-setup-using-camel-http-tp26190394p26779969.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: Help to understand xpath expression in camel routebuilder

2009-12-14 Thread Jon Anstey
The xpath expression is going to be evaluated against the incoming message
body. So, if we have a message like:

?xml version=1.0 encoding=UTF-8?
TravelInsuranceRequest xmlns=http://dzone.com/insurance;
...
/TravelInsuranceRequest

the first when clause will evaluate to true since the xpath expression is
searching for any element like TravelInsuranceRequest. The namespace bit
tells Camel to search for TravelInsuranceRequest elements only in the
http://dzone.com/insurance namespace.

Does this help any?

On Mon, Dec 14, 2009 at 3:40 PM, Kenneth H phecda...@gmail.com wrote:


 Hi,

 I'm trying to udnerstand a camel example, but I'm stuck at a poit where
 xpath is used. The builder is shown here:

 public void configure() {
from(SERVICE_IN) // SERVICE_IN =
 jbi:service:http://esbinaction.com/insurance/insuranceDSLRouter
.convertBodyTo(DOMSource.class) // Convert to DOM
 tree
.choice()

  .when(xpath(//ins:TravelInsuranceRequest).namespace(ins,
 http://dzone.com/insurance;))
.to(TRAVEL_OUT)

  .when(xpath(//ins:CarInsuranceRequest).namespace(ins,
 http://dzone.com/insurance;))
.to(LUXURY_CAR_OUT, BUDGET_CAR_OUT)
.otherwise()
.to(FAILURE_OUT);
}

 My problem is the when: what exactly does:

 when(xpath(//ins:TravelInsuranceRequest).namespace(ins,
 http://dzone.com/insurance;))

 mean?

 Can anybody help me?

 Kind regards,
 Kenneth H
 --
 View this message in context:
 http://old.nabble.com/Help-to-understand-xpath-expression-in-camel-routebuilder-tp26779963p26779963.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com


Re: HTTPS authentication setup using camel-http

2009-12-14 Thread Claus Ibsen
On Mon, Dec 14, 2009 at 8:30 PM, ychawla premiergenerat...@yahoo.com wrote:

 Is it possible to do this same 'hookup' using the Spring DSL.  I am not sure
 if it is possible to specify this in Spring:

 HttpComponent httpComponent = (HttpComponent)
 getContext().getComponent(http);
 httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer());


Yeah see the  - Setting MaxConnectionsPerHost - example from this page
http://camel.apache.org/http



 bwhite wrote:

 Thanks for the info Willem, that's just what I needed.

 Here's a little more information for anyone who may end up following in my
 footsteps:

 Create a class that implements HttpClientConfigurer, and registers https
 protocol providing a keystore or truststore per Willem's example below.
 Then, from your camel route builder class you can hook it up like so:

 HttpComponent httpComponent = (HttpComponent)
 getContext().getComponent(http);
 httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer());

 Bryan


 willem.jiang wrote:


 If you just wan to specify the keystore and truststore you can do int in
 your HttpClientConfigurer.

 Protocol authhttps = new Protocol(https,
 new AuthSSLProtocolSocketFactory(
 new URL(file:my.keystore), mypassword,
 new URL(file:my.truststore), mypassword), 443);
 Protocol.registerProtocol(https, authhttps);





 --
 View this message in context: 
 http://old.nabble.com/Re%3A-HTTPS-authentication-setup-using-camel-http-tp26190394p26779969.html
 Sent from the Camel - Users mailing list archive at Nabble.com.





-- 
Claus Ibsen
Apache Camel Committer

Author of Camel in Action: http://www.manning.com/ibsen/
Open Source Integration: http://fusesource.com
Blog: http://davsclaus.blogspot.com/
Twitter: http://twitter.com/davsclaus


Re: recipientList onException redelivery

2009-12-14 Thread mcrive


Claus Ibsen-2 wrote:
 
 I have worked on this and committed a fix. Can you test it on your end?
 

Hi Claus,
sorry for the late reply but I just came to the office (I am traveling a
lot)
I am currently compiling latest revision and will test it soon.

Thanks,
Marco

-- 
View this message in context: 
http://old.nabble.com/recipientList-onException-redelivery-tp26726340p26779977.html
Sent from the Camel - Users mailing list archive at Nabble.com.



recipientList + aggregationStrategy, maximumRedeliveries exceeded

2009-12-14 Thread mcrive

I am using Camel 2.2 (rev 890454)

How is it possible to know if an exchange has exceeded the
maximumRedeliveries configured on the route by using aggregationStrategy and
if it hasn't how many redelivery have been attempted?

route sample:

from(direct:delivery.notification.test)
.onException(Exception.class).maximumRedeliveries(2).redeliverDelay(60L).handled(true).end()
.recipientList(header(recipientListHeader).tokenize(,))
.parallelProcessing().executorService(customThreadPoolExecutor)
.aggregationStrategy(new recipientAggregationStrategy())
.to(direct:chunk.completed);


-- 
View this message in context: 
http://old.nabble.com/recipientList-%2B-aggregationStrategy%2C-maximumRedeliveries-exceeded-tp26780214p26780214.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: HTTPS authentication setup using camel-http

2009-12-14 Thread ychawla

Hi Gang,
I added an update to the WIKI with some more info on doing this with Spring:
http://cwiki.apache.org/confluence/display/CAMEL/HTTP

I hope this is okay.  Here are the details:

If you are doing this using the Spring DSL, you can specify your
HttpClientConfigurer using the URI. For example:

bean id=myHttpClientConfigurer
 class=my.https.HttpClientConfigurer
/bean

to
uri=https://myhostname.com:443/myURL?httpClientConfigurerRef=myHttpClientConfigurer/
 

As long as you implement the HttpClientConfigurer and configure your
keystore and truststore as described above, it will work fine.



ychawla wrote:
 
 Is it possible to do this same 'hookup' using the Spring DSL.  I am not
 sure if it is possible to specify this in Spring:
 
 HttpComponent httpComponent = (HttpComponent)
 getContext().getComponent(http);
 httpComponent.setHttpClientConfigurer(new MyHttpClientConfigurer()); 
 
-- 
View this message in context: 
http://old.nabble.com/Re%3A-HTTPS-authentication-setup-using-camel-http-tp26190394p26780221.html
Sent from the Camel - Users mailing list archive at Nabble.com.



start/stop routes programmatically

2009-12-14 Thread boday

I see that Camel 2.1 now support starting/stopping routes via JMX/APIs.  But,
how do I identify routes properly at runtime...

For example, assume I have the following route...

from(activemq:queue1).to(activemq:queue2);
from(activemq:queue2).to(activemq:queue3);

They show up in JMX as route1 and route2.  The description/endpointURI
fields definitely help, but might be problematic to use when there are a lot
of routes.  

The same applies to finding a routes with Camel APIs.  I can get a list of
routes using this...

getContext().getRouteCollection().getRoutes()

I see that I can then call the following on a RouteDefinition to get to the
first endpoint name

routeDefinition.getInputs().get(0).getLabel()

I guess I could use this name to identify a route and then call
stop()/start() on it...but this seems like a very indirect approach to
identify it?  Am I missing something?

What I'd like to do is give a route an explicit name that can be referenced
later (in JMX/programmatically)...maybe the DescriptionDefinition class
could help, but am not sure how to use it...

something along these lines is what I'm looking for...

setRouteName(InboundRoute).from(activemq:queue1).to(activemq:queue2);
setRouteName(ProcessingRoute).from(activemq:queue2).to(activemq:queue3);

thanks in advance...






-
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.0
-- 
View this message in context: 
http://old.nabble.com/start-stop-routes-programmatically-tp26781725p26781725.html
Sent from the Camel - Users mailing list archive at Nabble.com.



Re: start/stop routes programmatically

2009-12-14 Thread Willem Jiang
Yes, supporting to set the route name would be very useful when you want 
manage the route states from JMS or API.


I just created a JIRA[1] for it.

[1] https://issues.apache.org/activemq/browse/CAMEL-2290

Willem

boday wrote:

I see that Camel 2.1 now support starting/stopping routes via JMX/APIs.  But,
how do I identify routes properly at runtime...

For example, assume I have the following route...

from(activemq:queue1).to(activemq:queue2);
from(activemq:queue2).to(activemq:queue3);

They show up in JMX as route1 and route2.  The description/endpointURI
fields definitely help, but might be problematic to use when there are a lot
of routes.  


The same applies to finding a routes with Camel APIs.  I can get a list of
routes using this...

getContext().getRouteCollection().getRoutes()

I see that I can then call the following on a RouteDefinition to get to the
first endpoint name

routeDefinition.getInputs().get(0).getLabel()

I guess I could use this name to identify a route and then call
stop()/start() on it...but this seems like a very indirect approach to
identify it?  Am I missing something?

What I'd like to do is give a route an explicit name that can be referenced
later (in JMX/programmatically)...maybe the DescriptionDefinition class
could help, but am not sure how to use it...

something along these lines is what I'm looking for...

setRouteName(InboundRoute).from(activemq:queue1).to(activemq:queue2);
setRouteName(ProcessingRoute).from(activemq:queue2).to(activemq:queue3);

thanks in advance...






-
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.0




Re: start/stop routes programmatically

2009-12-14 Thread Jon Anstey
You can set custom ids for each route like this:

from(activemq:queue1).id(InboundRoute).to(activemq:queue2);
from(activemq:queue2).id(ProcessingRoute).to(activemq:queue3);

in the Spring DSL you can just use standard id attributes like:

...
route id=InboundRoute
...

On Mon, Dec 14, 2009 at 9:45 PM, boday bo...@vektrel.com wrote:


 I see that Camel 2.1 now support starting/stopping routes via JMX/APIs.
  But,
 how do I identify routes properly at runtime...

 For example, assume I have the following route...

 from(activemq:queue1).to(activemq:queue2);
 from(activemq:queue2).to(activemq:queue3);

 They show up in JMX as route1 and route2.  The description/endpointURI
 fields definitely help, but might be problematic to use when there are a
 lot
 of routes.

 The same applies to finding a routes with Camel APIs.  I can get a list of
 routes using this...

 getContext().getRouteCollection().getRoutes()

 I see that I can then call the following on a RouteDefinition to get to the
 first endpoint name

 routeDefinition.getInputs().get(0).getLabel()

 I guess I could use this name to identify a route and then call
 stop()/start() on it...but this seems like a very indirect approach to
 identify it?  Am I missing something?

 What I'd like to do is give a route an explicit name that can be referenced
 later (in JMX/programmatically)...maybe the DescriptionDefinition class
 could help, but am not sure how to use it...

 something along these lines is what I'm looking for...

 setRouteName(InboundRoute).from(activemq:queue1).to(activemq:queue2);

 setRouteName(ProcessingRoute).from(activemq:queue2).to(activemq:queue3);

 thanks in advance...






 -
 Ben - Senior Consultant
 using SMX 3.3.1/Camel 2.0
 --
 View this message in context:
 http://old.nabble.com/start-stop-routes-programmatically-tp26781725p26781725.html
 Sent from the Camel - Users mailing list archive at Nabble.com.




-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com


Re: start/stop routes programmatically

2009-12-14 Thread Willem Jiang

Hi Jon,

After checking the code, I think the DSL should be
from(activemq:queue1).routeId(InboundRoute).to(activemq:queue2);
from(activemq:queue2).routeId(ProcessingRoute).to(activemq:queue3);

Willem

Jon Anstey wrote:

You can set custom ids for each route like this:

from(activemq:queue1).id(InboundRoute).to(activemq:queue2);
from(activemq:queue2).id(ProcessingRoute).to(activemq:queue3);

in the Spring DSL you can just use standard id attributes like:

...
route id=InboundRoute
...

On Mon, Dec 14, 2009 at 9:45 PM, boday bo...@vektrel.com wrote:


I see that Camel 2.1 now support starting/stopping routes via JMX/APIs.
 But,
how do I identify routes properly at runtime...

For example, assume I have the following route...

from(activemq:queue1).to(activemq:queue2);
from(activemq:queue2).to(activemq:queue3);

They show up in JMX as route1 and route2.  The description/endpointURI
fields definitely help, but might be problematic to use when there are a
lot
of routes.

The same applies to finding a routes with Camel APIs.  I can get a list of
routes using this...

getContext().getRouteCollection().getRoutes()

I see that I can then call the following on a RouteDefinition to get to the
first endpoint name

routeDefinition.getInputs().get(0).getLabel()

I guess I could use this name to identify a route and then call
stop()/start() on it...but this seems like a very indirect approach to
identify it?  Am I missing something?

What I'd like to do is give a route an explicit name that can be referenced
later (in JMX/programmatically)...maybe the DescriptionDefinition class
could help, but am not sure how to use it...

something along these lines is what I'm looking for...

setRouteName(InboundRoute).from(activemq:queue1).to(activemq:queue2);

setRouteName(ProcessingRoute).from(activemq:queue2).to(activemq:queue3);

thanks in advance...






-
Ben - Senior Consultant
using SMX 3.3.1/Camel 2.0
--
View this message in context:
http://old.nabble.com/start-stop-routes-programmatically-tp26781725p26781725.html
Sent from the Camel - Users mailing list archive at Nabble.com.









Re: start/stop routes programmatically

2009-12-14 Thread Jon Anstey
Ha! This must have changed since the last time I used it ;)

On Mon, Dec 14, 2009 at 11:15 PM, Willem Jiang willem.ji...@gmail.comwrote:

 Hi Jon,

 After checking the code, I think the DSL should be
 from(activemq:queue1).routeId(InboundRoute).to(activemq:queue2);
 from(activemq:queue2).routeId(ProcessingRoute).to(activemq:queue3);

 Willem


 Jon Anstey wrote:

 You can set custom ids for each route like this:

 from(activemq:queue1).id(InboundRoute).to(activemq:queue2);
 from(activemq:queue2).id(ProcessingRoute).to(activemq:queue3);

 in the Spring DSL you can just use standard id attributes like:

 ...
 route id=InboundRoute
 ...

 On Mon, Dec 14, 2009 at 9:45 PM, boday bo...@vektrel.com wrote:

  I see that Camel 2.1 now support starting/stopping routes via JMX/APIs.
  But,
 how do I identify routes properly at runtime...

 For example, assume I have the following route...

 from(activemq:queue1).to(activemq:queue2);
 from(activemq:queue2).to(activemq:queue3);

 They show up in JMX as route1 and route2.  The
 description/endpointURI
 fields definitely help, but might be problematic to use when there are a
 lot
 of routes.

 The same applies to finding a routes with Camel APIs.  I can get a list
 of
 routes using this...

 getContext().getRouteCollection().getRoutes()

 I see that I can then call the following on a RouteDefinition to get to
 the
 first endpoint name

 routeDefinition.getInputs().get(0).getLabel()

 I guess I could use this name to identify a route and then call
 stop()/start() on it...but this seems like a very indirect approach to
 identify it?  Am I missing something?

 What I'd like to do is give a route an explicit name that can be
 referenced
 later (in JMX/programmatically)...maybe the DescriptionDefinition class
 could help, but am not sure how to use it...

 something along these lines is what I'm looking for...


 setRouteName(InboundRoute).from(activemq:queue1).to(activemq:queue2);


 setRouteName(ProcessingRoute).from(activemq:queue2).to(activemq:queue3);

 thanks in advance...






 -
 Ben - Senior Consultant
 using SMX 3.3.1/Camel 2.0
 --
 View this message in context:

 http://old.nabble.com/start-stop-routes-programmatically-tp26781725p26781725.html
 Sent from the Camel - Users mailing list archive at Nabble.com.








-- 
Cheers,
Jon

Camel in Action: http://manning.com/ibsen
Blog: http://janstey.blogspot.com