Return-Path: Delivered-To: apmail-camel-users-archive@www.apache.org Received: (qmail 4285 invoked from network); 5 Jun 2009 06:34:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 5 Jun 2009 06:34:31 -0000 Received: (qmail 71491 invoked by uid 500); 5 Jun 2009 06:34:43 -0000 Delivered-To: apmail-camel-users-archive@camel.apache.org Received: (qmail 71454 invoked by uid 500); 5 Jun 2009 06:34:43 -0000 Mailing-List: contact users-help@camel.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@camel.apache.org Delivered-To: mailing list users@camel.apache.org Received: (qmail 71444 invoked by uid 99); 5 Jun 2009 06:34:42 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2009 06:34:42 +0000 X-ASF-Spam-Status: No, hits=3.5 required=10.0 tests=SPF_PASS,URIBL_BLACK X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of willem.jiang@gmail.com designates 209.85.198.246 as permitted sender) Received: from [209.85.198.246] (HELO rv-out-0708.google.com) (209.85.198.246) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 Jun 2009 06:34:31 +0000 Received: by rv-out-0708.google.com with SMTP id l33so53798rvb.56 for ; Thu, 04 Jun 2009 23:34:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=bZ6vdn8YUVPLlma7RrLMCFRBH0CcnFigRw2Hq4xjj0I=; b=oHcicks8aMGVV+scHaLxITkxgYwFgC5h+t9ugE8X3dzVZ8emyZpv5VMUFkiV5zj2ia NbYPw2ql4GuFs6KAtP244sDBxQi4r2lw1QHflw/PlIpSVAGOpz3tRDoksMShYlS1XqoY 2boBilyvxYATVw2DnPbbrWY3Z6Lo9mr++JpCU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=Lp7tPQ2mlAcNZXt8QaH0EZsZ+aJfOz9Dzqcth0fXr5BghLZJcfLL4QaQR2I3q+MoaL ju+P1wzIfXOM+/ww9HP4gsWehwh/A5KXjpu/LaWMPU+lCYCpPXFQ19rW+jEXpRQjGqUi vEvkqnyBiPSRlQJ6F28mTbQ9LaLWIUubCvQxg= Received: by 10.143.5.21 with SMTP id h21mr1094749wfi.293.1244183649306; Thu, 04 Jun 2009 23:34:09 -0700 (PDT) Received: from ?192.168.0.131? ([222.131.244.44]) by mx.google.com with ESMTPS id k2sm2448809rvb.8.2009.06.04.23.34.07 (version=TLSv1/SSLv3 cipher=RC4-MD5); Thu, 04 Jun 2009 23:34:08 -0700 (PDT) Message-ID: <4A28BC58.2090103@gmail.com> Date: Fri, 05 Jun 2009 14:34:00 +0800 From: Willem Jiang User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: users@camel.apache.org Subject: Re: Set timeout of an http endpoint References: <4A27381F.7050601@gmail.com> <5380c69c0906040222i5e7f5a9ah2a1412f8b995d678@mail.gmail.com> <5380c69c0906040827g40ff75c7v3d35c2fd40d207d5@mail.gmail.com> In-Reply-To: <5380c69c0906040827g40ff75c7v3d35c2fd40d207d5@mail.gmail.com> X-Enigmail-Version: 0.95.7 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Hi, I merged the test to Camel 1.x branch, the test looks good. Can you try to use the latest released Camel 1.6.1? Willem Claus Ibsen wrote: > Hi > > I created a unit test with the tineout. > > You can check it out by this link: > http://svn.apache.org/viewvc?view=rev&revision=781775 > > It uses Camel trunk however. But see if that works for your version of Camel. > > > > On Thu, Jun 4, 2009 at 5:06 PM, LeRoy Michel wrote: >> Hi, >> I confirm that the SO_TIMEOUT is the right property to set for timeout >> connection. The code below works with http client API : >> --------- >> HttpClient client = new HttpClient(); >> PostMethod method = new PostMethod("http://localhost:8080/MyResource"); >> client.getParams().setParameter(HttpMethodParams.SO_TIMEOUT, 100); >> try { >> StringRequestEntity entity= new StringRequestEntity("this >> timeout works!", "text/xml; charset=UTF-8", "UTF-8"); >> method.setRequestEntity(entity); >> // Execute the method. >> int statusCode = client.executeMethod(method); >> >> } catch (Exception e) { >> e.printStackTrace(); >> } finally { >> // Release the connection. >> method.releaseConnection(); >> } >> ---------- >> >> The same variable "soTimeout" in the Camel URI is not taken into >> account within camel http component. >> >> Can you help >> >> Thanks >> LeRoy >> >> >> >> On 6/4/09, Claus Ibsen wrote: >>> Hi >>> >>> Try getting the timeout to work directly using HTTP client API. Then >>> you know which settings work. >>> >>> Then setting the same option with the Camel URI should do the same. >>> But maybe there is a gremlin in the code. >>> >>> >>> >>> On Thu, Jun 4, 2009 at 10:11 AM, LeRoy Michel >>> wrote: >>>> Hi, >>>> >>>> I've tested http request with the following URI : >>>> >>>> " >>>> http://localhost:8080/myResource?httpClient.soTimeout=10&httpClient.connectionManagerTimeout=20 >>>> " >>>> >>>> Even if I change the value of httpClient.soTimeout and >>>> httpClient.connectionManagerTimeout parameters, the response time of >>>> server >>>> doesn't change. >>>> >>>> Is there any other way to set the timeout of an HTTP connection? >>>> >>>> Thanks for help. >>>> LeRoy >>>> >>>> >>>> On Thu, Jun 4, 2009 at 4:57 AM, Willem Jiang >>>> wrote: >>>> >>>>> Hi, >>>>> >>>>> The last one which sets the httpClient's parameter in the URI should >>>>> work. >>>>> I checked the HttpClientParams java doc, there is no properties of >>>>> connectionTimeout, I think you need to try to use >>>>> connectionManagerTimeout instead of connectionTimeout. >>>>> >>>>> BTW, In Camel 2.0, we have the parameter validation, you will get the >>>>> ResolveEndpointFailedException if the parameter name is wrong. >>>>> >>>>> Willem >>>>> >>>>> LeRoy Michel wrote: >>>>>> Hi, >>>>>> >>>>>> I would like to set the timeout of an http connection using camel http >>>>>> component. >>>>>> I read the the Camel http guide (http://camel.apache.org/http.html) and >>>>> I've >>>>>> tried the following but it doesn't work: >>>>>> >>>>>> public void process(Exchange exchange) throws Exception { >>>>>> >>>>>> Map headers = >>>>>> exchange.getIn().getHeaders(); >>>>>> headers.put(HttpProducer.QUERY, >>>>>> "httpClient.soTimeout=150&httpClient.connectionTimeout=150"); >>>>>> template.sendBodyAndHeaders("http://myserver:8080", >>>>> exchange, >>>>>> headers); >>>>>> } >>>>>> >>>>>> I've also tried the following : >>>>>> >>>>>> public void process(Exchange exchange) throws Exception { >>>>>> template.send(" >>>>>> >>>>> http://myserver:8080?httpClient.soTimeout=150&httpClient.connectionTimeout=150 >>>>> ", >>>>>> exchange) >>>>>> } >>>>>> >>>>>> Can you show me how I set the timeout of the HTTP connection in Camel >>>>>> 1.x >>>>>> >>>>>> Thanks >>>>>> Leroy >>>>>> >>>>> >>> >>> >>> -- >>> Claus Ibsen >>> Apache Camel Committer >>> >>> Open Source Integration: http://fusesource.com >>> Blog: http://davsclaus.blogspot.com/ >>> Twitter: http://twitter.com/davsclaus >>> > > >