Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to set the connection timeout value as a variable instead of a number?

On Apigee on-premise, I have a mission to set connection timeout value as a variable.

 

If I set the values of 'connect.timeout.millis' or 'io.timeout.millis' property as a number, they works fine.

But If I set the value of them as a variable instead of number, API Proxy does not work anymore.

 

I've searched for some logs and found that there's an error logs in message processor like below.

 

2021-07-19 18:22:03,709  qtp1995952705-158 ERROR REST - ExceptionMapper.toResponse() : Error occurred : Configuration failure: Caused by: java.lang.NumberFormatException: For input string: "{TimeLimit}"
        at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        at java.lang.Long.parseLong(Long.java:589)
        at java.lang.Long.parseLong(Long.java:631)
        at com.apigee.messaging.adaptors.http.configuration.HTTPServiceDetails.newClient(HTTPServiceDetails.java:102)
        more...

        com.apigee.entities.AbstractConfigurator.wrap(AbstractConfigurator.java:334)
        com.apigee.entities.AbstractConfigurator.add(AbstractConfigurator.java:516)
        com.apigee.messaging.runtime.TargetEndpoint.addProperties(TargetEndpoint.java:118)
        com.apigee.messaging.runtime.TargetEndpoint.handleAdd(TargetEndpoint.java:70)

        Caused by For input string: "{TimeLimit}"
        java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
        java.lang.Long.parseLong(Long.java:589)
        java.lang.Long.parseLong(Long.java:631)
        com.apigee.messaging.adaptors.http.configuration.HTTPServiceDetails.newClient(HTTPServiceDetails.java:102)

 

 

 

And, below is my target endpoint xml:

 

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="default">
    <Description/>
    <FaultRules/>
    <PreFlow name="PreFlow">
        <Request/>
        <Response/>
    </PreFlow>
    <PostFlow name="PostFlow">
        <Request/>
        <Response/>
    </PostFlow>
    <Flows/>
    <HTTPTargetConnection>
        <Properties>
            <Property name="connect.timeout.millis">5000</Property>
            <Property name="io.timeout.millis">5000</Property>
<!--
            <Property name="connect.timeout.millis">{TimeLimit}</Property>
            <Property name="io.timeout.millis">{TimeLimit}</Property>
-->
        </Properties>
        <URL>https://httpbin.org/</URL>
    </HTTPTargetConnection>
</TargetEndpoint>

 

 

Is there any way to set the connection timeout value as a variable instead of a number?

0 4 1,137
4 REPLIES 4