How to set dynamic LoadBalancer for HTTPTargetConnection in APIGEE?

568 views Asked by At

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?

1

There are 1 answers

0
Prakash On

Configure Target Server in APIGEE using same name with different environment like Test, Stage and Prod.

Mention target server name in load balancer, It will take appropriate value based on the environment.

<LoadBalancer>  <Server name="Test_Target_Server"/> </LoadBalancer>