Using Multiple Paths in the Target endpoints - loading to AWX

Within a Target Endpoint I would like to specify multiple paths. In my use case, the backend server is an automation system. If I run many automation requests for one API (one template) then those requests are in series. To improve this, I was thinking of having 4 exact same plays, different names "searchtemplate-1" to "searchtemplate-4". The idea is that if I have multiple requests, I can load them across 4 paths, resulting in 4 of the same plays running concurrently.

Any recommendations would be helpful. But note that this is not server load balancing.

Using the below config all that happendis the last one searchtemplate-4 is selected for my ten rapid API GET Requests. What I would like is they would be selected in series per GEt request.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<TargetEndpoint name="search_store">
    <Description/>
    <FaultRules/>
    <PreFlow name="PreFlow">
    </PreFlow>
    <PostFlow name="PostFlow">
    </PostFlow>
    <Flows/>
    <HTTPTargetConnection>
        <LoadBalancer>
            <Server name="automation-host-1"/>
            <Server name="automation-host-2">
                <IsFallback>true</IsFallback>
            </Server>
        </LoadBalancer>
        <SSLInfo>
            <Enabled>true</Enabled>
        </SSLInfo>
        <Properties>
            <Property name="GET.override.method">POST</Property>
        </Properties>
        <Path>/api/v2/job_templates/{hostenv}-searchtemplate-1/launch/</Path>
        <Path>/api/v2/job_templates/{hostenv}-searchtemplate-2/launch/</Path>
        <Path>/api/v2/job_templates/{hostenv}-searchtemplate-3/launch/</Path>
        <Path>/api/v2/job_templates/{hostenv}-searchtemplate-4/launch/</Path>
        <HealthMonitor>
            <IsEnabled>true</IsEnabled>
            <IntervalInSec>5</IntervalInSec>
            <TCPMonitor>
                <ConnectTimeoutInSec>10</ConnectTimeoutInSec>
            </TCPMonitor>
        </HealthMonitor>
    </HTTPTargetConnection>
</TargetEndpoint>
 
0 2 829
2 REPLIES 2

The idea is that if I have multiple requests, I can load them across 4 paths, resulting in 4 of the same plays running concurrently.

There is no way to configure Apigee so that 4 concurrent requests go out through TargetEndpoint of a single API proxy. The suggested configuration of yours, that includes four distinct Path elements, is not valid.

The basic design of Apigee is as an HTTP proxy. That means, one request comes in, one request goes out. We sometimes use the phrase "northbound" for the "request comes in" part, and "southbound" for the "request goes out" part. One in, one out. For the northbound edge, you configure the ProxyEndpoint. For the southbound, you configure the TargetEndpoint. You can configure multiple distinct ProxyEndpoints and TargetEndpoints in a proxy bundle, and you can configure your ProxyEndpoint to dynamically choose a TargetEndpoint. but, at runtime, Apigee will choose exactly one TargetEndpoint. One request in, one request out.

It sounds like you want One in, four out. The TargetEndpoint entity won't let you do that.

There is a way to send multiple concurrent requests from an Apigee proxy. The JavaScript callout includes an httpClient, and you can configure that thing to send multiple calls. This is distinct from the TargetEndpoint. The general model in Apigee is:

  • one request comes in, Apigee hands it to a proxy endpoint
  • The proxy endpoint executes a series of "policies", possibly modifying the request (injecting headers, changing payload, etc).
  • The proxy endpoint then optionally routes the request to a TargetEndpoint
  • The targetEndpoint executes a series of zero or more policies on the request, possibly modifying it further.
  • The TargetEndpoint sends the (possibly modified) request to the backend (upstream) system
  • The upstream system sends the response back to Apigee.
  • The TargetEndpoint executes a series of zero or more policies on the response, possibly modifying the response.
  • control returns to the ProxyEndpoint
  • The ProxyEndpoint executes a series of zero or more policies on the response, possibly modifying the response.
  • Apigee sends the (possibly modified) response to the client

Anywhere there are "policies" in the flow, you can insert a JavaScript policy, and within that JS policy you could invoke multiple parallel systems.

Here's a related question on the topic of parallel calls.

But Maybe you DO want one request in, and one request out. But on the request out, you want the path to vary, to be different with each successive request.

I don't think you can do that with a TargetServer, either.

It's possible for you to configure a proxy to randomly select a path from a list of 4. But designing the proxy to always follow the sequence 1,2,3,4,1,2,3,4,1,2,3,4... would be difficult. It would require transactional synchronization across a distributed set of servers and that's not something Apigee does. If you want a random selection, you can look here.

Not applicable

Multiple paths in a target server configuration is not allowed.

You can put a variable reference in the path and in your target flow you can set a path using a javascript policy as per your conditions requirement.