RE: Migration from Async 4.1.3 to HttpClient 5

2018-10-20 Thread Joan Balagueró
Ok, I understand whtat you mean. Since this is a non-blocking model when we 
send the request the thread is released, so I simply have to count the time 
passed from I send the response until the 'responseReceived' method is invoked, 
and if this time has been exceeded just throw an exception (and avoid read the 
response body content).

Thanks,
Joan.

-Mensaje original-
De: Oleg Kalnichevski [mailto:ol...@apache.org] 
Enviado el: sábado, 20 de octubre de 2018 18:17
Para: HttpClient User Discussion
Asunto: Re: Migration from Async 4.1.3 to HttpClient 5

On Fri, 2018-10-19 at 21:07 +0200, Joan Balagueró wrote:
> Hello Oleg,
> 
> I think it's a bit more complicated ... Let me explain it:
> 
> - we have a pool with a response timeout of 15s
> - this pool is shared by 2 webservices, ws1 and ws2. Ws1 uses the 
> pool's response timeout, but ws2 uses its own response timeout of 10s.
> - the webservice ws2 has 2 methods, m1 and m2, m1 uses the ws2 timeout 
> but m2 uses its own response timeout of 12s.
> - and finally the method m2 is used by 2 clients, c1 and c2. c1 is a 
> very good client so his response timeout is 20s, and c2 is very bad so 
> he only has a 3s response timeout.
> 
> When we set the response timeout at request level, we do this:
> 
> /**
>   * This method sets the 'responseTimeout' to this http method.
>   * 
>   * @paramRequestBuilder  the 'RequestBuilder'
> object
>   * @paramresponseTimeout the response timeout
> to apply
>   * @return   none
>  */
>  private void setTimeout(RequestBuilder rb)  {
>   // 1. If the client has a timeout (clientResponseTimeout != -1), 
> then set this value
>   // 2. If the client has no timeout but the method has, then set this 
> value.
>   // 3. If the method has no timeout but the api has, then set this 
> value.
>   // 4. Otherwise set the pool's response timeout.
>   int clientResponseTimeout =
> this.objClient.getResponseTimeout(this.objCall.getId());
>   int responseTimeout =  (clientResponseTimeout != -1 ?
> clientResponseTimeout : (this.objCall.getResponseTimeout() != -1 ?
> this.objCall.getResponseTimeout() :
> (this.objInterface.getResponseTimeout() != -1 ?
> this.objInterface.getResponseTimeout() :
> this.objHttp.getResponseTimeout())) );
>  
> rb.setConfig(RequestConfig.copy(this.objHttp.getRequestConfig()).setS
> ocketTimeout(responseTimeout).build());
>  }
> 
> And that's my problem now. Do you think this can be solved in any way 
> using http5?
> 

I must admit I do not understand the reason for doing all that in the first 
place. I also do not understand what exactly you mean by response timeout. Max 
waiting time until a response head is received?  

Oleg


-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org




-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



RE: Migration from Async 4.1.3 to HttpClient 5

2018-10-20 Thread Joan Balagueró
Hi Oleg,

I must admit I do not understand the reason for doing all that in the first 
place.
--> It doesn't matter, it's important for B2B integrations in tourism sector, 
but that's another story.

 I also do not understand what exactly you mean by response timeout. Max 
waiting time until a response head is received?  
--> Yes, if we have a response timeout of 15s this is the maximum time our app 
will wait for getting a response from the application servers once the request 
has been sent. And yes, this is when response headers start to arrive (and read 
on 'responseReceived' method).

Thanks,

Joan. 


-Mensaje original-
De: Oleg Kalnichevski [mailto:ol...@apache.org] 
Enviado el: sábado, 20 de octubre de 2018 18:17
Para: HttpClient User Discussion
Asunto: Re: Migration from Async 4.1.3 to HttpClient 5

On Fri, 2018-10-19 at 21:07 +0200, Joan Balagueró wrote:
> Hello Oleg,
> 
> I think it's a bit more complicated ... Let me explain it:
> 
> - we have a pool with a response timeout of 15s
> - this pool is shared by 2 webservices, ws1 and ws2. Ws1 uses the 
> pool's response timeout, but ws2 uses its own response timeout of 10s.
> - the webservice ws2 has 2 methods, m1 and m2, m1 uses the ws2 timeout 
> but m2 uses its own response timeout of 12s.
> - and finally the method m2 is used by 2 clients, c1 and c2. c1 is a 
> very good client so his response timeout is 20s, and c2 is very bad so 
> he only has a 3s response timeout.
> 
> When we set the response timeout at request level, we do this:
> 
> /**
>   * This method sets the 'responseTimeout' to this http method.
>   * 
>   * @paramRequestBuilder  the 'RequestBuilder'
> object
>   * @paramresponseTimeout the response timeout
> to apply
>   * @return   none
>  */
>  private void setTimeout(RequestBuilder rb)  {
>   // 1. If the client has a timeout (clientResponseTimeout != -1), 
> then set this value
>   // 2. If the client has no timeout but the method has, then set this 
> value.
>   // 3. If the method has no timeout but the api has, then set this 
> value.
>   // 4. Otherwise set the pool's response timeout.
>   int clientResponseTimeout =
> this.objClient.getResponseTimeout(this.objCall.getId());
>   int responseTimeout =  (clientResponseTimeout != -1 ?
> clientResponseTimeout : (this.objCall.getResponseTimeout() != -1 ?
> this.objCall.getResponseTimeout() :
> (this.objInterface.getResponseTimeout() != -1 ?
> this.objInterface.getResponseTimeout() :
> this.objHttp.getResponseTimeout())) );
>  
> rb.setConfig(RequestConfig.copy(this.objHttp.getRequestConfig()).setS
> ocketTimeout(responseTimeout).build());
>  }
> 
> And that's my problem now. Do you think this can be solved in any way 
> using http5?
> 


Oleg


-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org




-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org



Re: Migration from Async 4.1.3 to HttpClient 5

2018-10-20 Thread Oleg Kalnichevski
On Fri, 2018-10-19 at 21:07 +0200, Joan Balagueró wrote:
> Hello Oleg,
> 
> I think it's a bit more complicated ... Let me explain it:
> 
> - we have a pool with a response timeout of 15s
> - this pool is shared by 2 webservices, ws1 and ws2. Ws1 uses the
> pool's response timeout, but ws2 uses its own response timeout of
> 10s.
> - the webservice ws2 has 2 methods, m1 and m2, m1 uses the ws2
> timeout but m2 uses its own response timeout of 12s.
> - and finally the method m2 is used by 2 clients, c1 and c2. c1 is a
> very good client so his response timeout is 20s, and c2 is very bad
> so he only has a 3s response timeout.
> 
> When we set the response timeout at request level, we do this:
> 
> /**
>   * This method sets the 'responseTimeout' to this http method.
>   * 
>   * @paramRequestBuilder  the 'RequestBuilder'
> object
>   * @paramresponseTimeout the response timeout
> to apply
>   * @return   none
>  */
>  private void setTimeout(RequestBuilder rb)
>  {
>   // 1. If the client has a timeout (clientResponseTimeout != -1),
> then set this value
>   // 2. If the client has no timeout but the method has, then set
> this value.
>   // 3. If the method has no timeout but the api has, then set this
> value.
>   // 4. Otherwise set the pool's response timeout.
>   int clientResponseTimeout =
> this.objClient.getResponseTimeout(this.objCall.getId());
>   int responseTimeout =  (clientResponseTimeout != -1 ?
> clientResponseTimeout : (this.objCall.getResponseTimeout() != -1 ?
> this.objCall.getResponseTimeout() :
> (this.objInterface.getResponseTimeout() != -1 ?
> this.objInterface.getResponseTimeout() :
> this.objHttp.getResponseTimeout())) );
>  
> rb.setConfig(RequestConfig.copy(this.objHttp.getRequestConfig()).setS
> ocketTimeout(responseTimeout).build());
>  }
> 
> And that's my problem now. Do you think this can be solved in any way
> using http5?
> 

I must admit I do not understand the reason for doing all that in the
first place. I also do not understand what exactly you mean by response
timeout. Max waiting time until a response head is received?  

Oleg


-
To unsubscribe, e-mail: httpclient-users-unsubscr...@hc.apache.org
For additional commands, e-mail: httpclient-users-h...@hc.apache.org