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

How to set dynamic LoadBalancer for HTTPTargetConnection Target Server in APIGEE?

I want to have a different server for my APIGEE load balancer Based on an if/else condition.

This is my current config that works a single server name (non dynamic):

<HTTPTargetConnection>
    <Properties>
        <Property name="response.streaming.enabled">true</Property>
    </Properties>
    <LoadBalancer>
        <Server name="test1"/>
    </LoadBalancer>
    <Path>{pathSuffix}</Path>
</HTTPTargetConnection>

I'm trying to make the <Server name="test1"/> dynamically change based on an if condition:

Something Like:

<HTTPTargetConnection>
    <Properties>
        <Property name="response.streaming.enabled">true</Property>
    </Properties>
    <LoadBalancer>
        <Condition>reroute = "FALSE"</Condition>
        <Server name="test1"/>
    </LoadBalancer>
    <LoadBalancer>
        <Condition>reroute = "TRUE"</Condition>
        <Server name="test2"/>
    </LoadBalancer>
    <Path>{pathSuffix}</Path>
</HTTPTargetConnection>

But it is not working. How can I have dynamically change the Server name here? or is there any other recommended way to do this?

0 1 748
1 REPLY 1