You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by bcokee <b_...@yahoo.com> on 2011/04/05 13:27:02 UTC

Re: Setting Http-conduit using spring configuration file

Hi Dan,

 I'm also interested in knowing how to set a timeout per operation. At the
moment I only
 know how to apply timeout per service.


Daniel  Kulp wrote:
> 
> 
>> 
>> 2. is it possibale to set the timeout per operation basis?
> 
> Not in config, no.   In code, before making the call, you can grab the 
> HttpConduit and modify settings right before the call.  
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://dankulp.com/blog
> 


Just to clarify my use case. Suppose we have a service like below:

public interface SomePortType
{

       public   SomeRS  operation1RQ( ... ) ;
       public   SomeRS  operation2RQ( ... ) ;
       public   SomeRS  operation3RQ( ... ) ;     
    
}
 
  I want to set different receive timeouts for each operation ( e.g. 5 sec,
10 sec. , 15 sec. respectively)
  Could you please give more hints as to how  this can be achieved? 
  What settings of the conduit should be modified ?
  Is one HttpConduit enough or  one conduit per operation ?

 Regards,
 Berns


--
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p4283714.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 07 April 2011 12:09:47 AM bcokee wrote:
> Hi Dan,
> 
>  I tried the interceptor like you said and it seems to work. Just have the
> ff. concerns:
> 
> 1. Is HttpConduit shared by all clients ? Like if I set a timeout like
> below, will it overwrite the timeout setting of other clients accessing
> same endpoint ?
> 
>    HTTPClientPolicy httpPolicy = createHttpPolicy();
>    HTTPConduit conduit = getHTTPConduit(client);
>    conduit.setClient(httpPolicy);
>    conduit.getClient().setReceiveTimeout(receiveTimeoutInMillis);

No.  The conduit is per client proxy.   If you share a single client proxy on 
multi-threads, that will be an issue.  But for a single proxy, that is fine.

> 
> 
> 2. Using the interceptor, if I apply a timeout using
> msg.put(Message.RECEIVE_TIMEOUT, ..)  on one operation, will it overwrite
> the timeout for other operations of the service ? Is this approach thread
> safe?

The msg is per request.   Anything set there doesn't affect anything else.

Dan

 
> I want each operation to have separate timeout values.
> 
> Thanks,
> Berns
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configur
> ation-file-tp2644363p4287702.html Sent from the cxf-user mailing list
> archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com

Re: Setting Http-conduit using spring configuration file

Posted by mtuli <ma...@hotmail.com>.
Which interceptor i have to write for this ?

--
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p4648334.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by bcokee <b_...@yahoo.com>.
Hi Dan,

 I tried the interceptor like you said and it seems to work. Just have the
ff. concerns:

1. Is HttpConduit shared by all clients ? Like if I set a timeout like
below, will it overwrite the timeout setting of other clients accessing same
endpoint ?

   HTTPClientPolicy httpPolicy = createHttpPolicy();
   HTTPConduit conduit = getHTTPConduit(client);
   conduit.setClient(httpPolicy);
   conduit.getClient().setReceiveTimeout(receiveTimeoutInMillis);


2. Using the interceptor, if I apply a timeout using
msg.put(Message.RECEIVE_TIMEOUT, ..)  on one operation, will it overwrite
the timeout for other operations of the service ? Is this approach thread
safe?

I want each operation to have separate timeout values.

Thanks,
Berns


--
View this message in context: http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configuration-file-tp2644363p4287702.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: Setting Http-conduit using spring configuration file

Posted by Daniel Kulp <dk...@apache.org>.
On Tuesday 05 April 2011 7:27:02 AM bcokee wrote:
> Hi Dan,
> 
>  I'm also interested in knowing how to set a timeout per operation. At the
> moment I only
>  know how to apply timeout per service.

The only way to do it is by modifying the HTTPConduit prior to the individual 
call to the operation on the client (and realizing that that would not be 
thread safe) or installing an interceptor early in the out chain that would 
grab the operation and do something similar.   The interceptor could just do 
something like:

msg.getExchange().getBindingOperationInfo()

to get the operation.  Then look up the timeouts you need for that, and then 
do:

msg.put(Message.CONNECTION_TIMEOUT, ..)
msg.put(Message.RECEIVE_TIMEOUT, ..)


Dan



> 
> Daniel  Kulp wrote:
> >> 2. is it possibale to set the timeout per operation basis?
> > 
> > Not in config, no.   In code, before making the call, you can grab the
> > HttpConduit and modify settings right before the call.
> 
> Just to clarify my use case. Suppose we have a service like below:
> 
> public interface SomePortType
> {
> 
>        public   SomeRS  operation1RQ( ... ) ;
>        public   SomeRS  operation2RQ( ... ) ;
>        public   SomeRS  operation3RQ( ... ) ;
> 
> }
> 
>   I want to set different receive timeouts for each operation ( e.g. 5 sec,
> 10 sec. , 15 sec. respectively)
>   Could you please give more hints as to how  this can be achieved?
>   What settings of the conduit should be modified ?
>   Is one HttpConduit enough or  one conduit per operation ?
> 
>  Regards,
>  Berns
> 
> 
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Setting-Http-conduit-using-spring-configur
> ation-file-tp2644363p4283714.html Sent from the cxf-user mailing list
> archive at Nabble.com.

-- 
Daniel Kulp
dkulp@apache.org
http://dankulp.com/blog
Talend - http://www.talend.com