Dynamic I/O timeout on API proxies or Message Processors

Can someone please let me know how to configure the backend timeout properties dynamically instead of hardcoding ?

<TargetEndpoint name="default">
  <HTTPTargetConnection>
    <URL>https://mocktarget.apigee.net/json</URL>
    <Properties>
      <Property name="io.timeout.millis">120000</Property>
    </Properties>
  </HTTPTargetConnection>
</TargetEndpoint>


<ServiceCallout name="Service-Callout-1">
    <DisplayName>ServiceCallout-1</DisplayName>
    <Timeout>120000</Timeout>
    <HTTPTargetConnection>
        <Properties/>
        <URL>https://mocktarget.apigee.net/json</URL>
    </HTTPTargetConnection>
</ServiceCallout>

0 7 298
7 REPLIES 7

You cannot do that. It's not possible in Apigee.

What problem are you trying to solve?

Trying to find a solution to put in KVM or in some configuration based on the proxy instead of hardcoding.

few set of proxies would have common timeouts, few have different. so use some configuration instead of configuring in each and every API proxy.

I see. 
And what would adjusting the timeout do for you? I guess you are aware that Apigee has a maximum timeout of around 60s. 
So if you have a service that handles requests in "greater than 60s" then adjusting the timeout on the Apigee side won't help.  Apigee will still time out.  60s is the maximum.  

You can only adjust downward from there.  Which is the reason for my question - what are you trying to solve?  Usually adjusting the timeout DOWNward is done in order to relieve pressure on the aPIgee side, in the case of an intermittently misbehaving upstream system.  The scenario where it helps is, if the upstream system USUALLY replies within 1-2s, but sometimes it takes 60+ seconds, and then fails. By adjusting the timeout downward on the Apigee side, we can tell Apigee "just stop waiting if you haven't got success within 15 seconds, because it probably won't respond successfully anyway."  

There is no way to tell Apigee, "wait for 3 minutes."  

So if the problem you are trying to solve is, some of your systems reply in 3 minutes or 5 minutes, then... adjusting the timeout on the Apigee side won't help you. 

 

I certainly understand but why we need to hardcode, we can provide that in KVM or shared config file.

I cannot answer the why part. All I can tell you is that it's not possible to load these values dynamically. 

I have 4 environments, dev, test, sit, performance. Every system will have a different timeout, And all the code is promoted through CI-CD. I cannot modify code every time i am deploying to a different environment. So there should be a feasibility to fetch timeout from KVM, either environment scope or api scope.

These values cannot be set dynamically at runtime. Docs for ServiceCallout policy pointing to this information.

Here are couple of workarounds you can evaluate:
1.
If the environments are fixed and the timeouts are fixed, you can define multiple TargetEndpoints/ServiceCallout policies one for each environment with the corresponding timeout values. You can use conditional flows to pick one of the TargetEndpoint/ServiceCallout and the conditional values can come from KVM.

2.
Since you mentioned CI-CD that pushes to each the proxy bundles to these environments, you can manipulate the XML for timeouts in TargetEndpoints/ServiceCallouts before the bundle creation based on the environment you are targeting the deployment to.

Hope one of the above helps.
Thanks.