You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by muell01 <ro...@hp.com> on 2015/01/30 16:42:41 UTC

Jetty as a producer for a Rest Call

A follow up to my previous post:

I use the controlbus to pause and resume this Rest/pull which will throw
exceptions until the message inflight has cleared. This lasts for 5 minutes
until it's forced to by the timeout.

<timer 1 time>
<loop a billion times>
<to
uri="jetty:http://api.application.com:80/v1/pull?throwExceptionOnFailure=false&amp;id={{stream.id}}&amp;api_key={{api_key}}&amp;username={{username}}"/>

I've noticed in Hawtio that Jetty maintains a state of 1 message "inflight"
at all times. 

Is this the nature of Async Jetty?

Is there a way to prevent this?
and/or Is there a way to reduce the amount of time it takes for Jetty to
pause (currently 5 minutes)

Thanks

Rob



--
View this message in context: http://camel.465427.n5.nabble.com/Jetty-as-a-producer-for-a-Rest-Call-tp5762262.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Jetty as a producer for a Rest Call

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Sounds like the remote http server does not respond and therefore the
message is inflight waiting for the response.

There is a timeout option you can tweak to force a timeout to be hit
sooner so the message is not so inflight so long time.

Take a look at the jetty documentation.

Also you can configure the graceful shutdown timeout of Camel


On Sat, Jan 31, 2015 at 8:00 PM, muell01 <ro...@hp.com> wrote:
> Using camel 2.12 w/o the doTry block (and using a loop) I get a non
> fluctuating '1' in flight message. when stopping the route after deploying
> as a .war into eap6, it would take the full 5 minutes for a graceful
> shutdown.
>
> I also relearned how to use the Timer. limiting the period to 1s allows the
> route to complete w/o violating the REST contract.
>
> <from
> uri="timer://jettyTimer?fixedRate=true&amp;period=1000&amp;repeatCount=0"/>
>
> <doTry>
>         <to
> uri="jetty:http://api.application.com/v1/pull?httpClient.timeout=30000&amp;enableJmx=true&amp;throwExceptionOnFailure=false&amp;id={{streamId}}&amp;api_key={{api_key}}&amp;username={{username}}"/>
>         <doCatch>
>                <exception>java.net.ConnectException</exception>
>                 <log message="*** inside Exception :: ${exception.message} "
> loggingLevel="ERROR"/>
>         </doCatch>
> </doTry>
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Jetty-as-a-producer-for-a-Rest-Call-tp5762262p5762284.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
hawtio: http://hawt.io/
fabric8: http://fabric8.io/

Re: Jetty as a producer for a Rest Call

Posted by muell01 <ro...@hp.com>.
Using camel 2.12 w/o the doTry block (and using a loop) I get a non
fluctuating '1' in flight message. when stopping the route after deploying
as a .war into eap6, it would take the full 5 minutes for a graceful
shutdown.

I also relearned how to use the Timer. limiting the period to 1s allows the
route to complete w/o violating the REST contract.

<from
uri="timer://jettyTimer?fixedRate=true&amp;period=1000&amp;repeatCount=0"/>
		
<doTry>
	<to
uri="jetty:http://api.application.com/v1/pull?httpClient.timeout=30000&amp;enableJmx=true&amp;throwExceptionOnFailure=false&amp;id={{streamId}}&amp;api_key={{api_key}}&amp;username={{username}}"/>	
	<doCatch> 
	       <exception>java.net.ConnectException</exception>
	        <log message="*** inside Exception :: ${exception.message} "
loggingLevel="ERROR"/>
	</doCatch>
</doTry>



--
View this message in context: http://camel.465427.n5.nabble.com/Jetty-as-a-producer-for-a-Rest-Call-tp5762262p5762284.html
Sent from the Camel - Users mailing list archive at Nabble.com.