Yeah right, indeed what Claus has proposed is much easier to implement and
also elegant thanks to the "route-advice" facility in Camel.  Indeed on Page
182 of the Book there's an exact matching example for your use case:

@Test
public void testSimulateErrorUsingInterceptors() throws Exception {
   RouteDefinition route = context.getRouteDefinitions().get(0);

   route.adviceWith(context, new RouteBuilder() {

      public void configure() throws Exception { 
       interceptSendToEndpoint("http://*";).skipSendToOriginalEndpoint()
      .process(new SimulateHttpErrorProcessor());

   }

});

Most probably once again I should go through the Chapter 6 and read it more
carefully a second time :-)

Babak


Claus Ibsen-2 wrote
> For testing purpose you can take a look at
> http://camel.apache.org/testing
> 
> And for example use advice with to intercept and skip sending to http
> endpoints, where you can detour and throw your own exceptions to
> simulate the erorr
> http://camel.apache.org/advicewith.html
> 
> If you have a copy of Camel in Action, then check chapter 6, its all
> about testing. And section 6.3 about simulating errors.
> 
> On Tue, May 28, 2013 at 6:17 PM, kalyan <

> register.kalyan@

> > wrote:
>> Hello,
>>
>> I have tried "httpClient.connectionManagerTimeout" in the following way.
>>
>> from("servlet:///test")
>>    .process(new MyProcessor())
>>
>> .to("http://
> <ipaddress-not-existing>
> :8080/context??bridgeEndpoint=true&httpClient.connectionManagerTimeout=1")
>>
>> From this I expected it to timeout immediately. However, Camel sends the
>> request and waits for the response for more than 30 seconds.
>>
>> Why is the above example not working ?
>>
>> Also, how do I simulate a "Connection Timeout" using camel (need it for a
>> testcase).
>>
>> Thanks in advance.
>>
>> -Kalyan
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://camel.465427.n5.nabble.com/Problem-with-httpClient-connectionManagerTimeout-on-Camel-2-10-4-tp5733367.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: 

> cibsen@

> Web: http://fusesource.com
> Twitter: davsclaus
> Blog: http://davsclaus.com
> Author of Camel in Action: http://www.manning.com/ibsen





--
View this message in context: 
http://camel.465427.n5.nabble.com/Problem-with-httpClient-connectionManagerTimeout-on-Camel-2-10-4-tp5733367p5733389.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to