{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • General /
avatar image
2
Question by MSaichuk · Jun 01, 2016 at 04:23 PM · 2.2k Views javascripttargetendpointtarget servertargetserver

Target Endpoint/Server callout

I need to make a callout to Target Endpoint or Target Server in one of my flows and apply load balancing rules. Is there a way to do this using javascript or any other policy?

Comment
Add comment Show 6
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Anil Sagar @ Google ♦♦   · Jun 01, 2016 at 06:01 PM 1
Link

@MSaichuk , Welcome to Apigee Community,

Just need small clarification, would you like to do load balancing on target endpoints (backend servers) so that you can route traffic to different target servers ? If yes, Please see @Sai Saran Vaidyanathan answer. Find more about same here.

Would you like to do load balancing of service callouts policy initiated target endpoints ? I am not sure about that. It (Service Callout policy) uses same XML element ("HTTPTargetConnection") to configure endpoint. @Sai Saran Vaidyanathan , It will be interesting to find out.

avatar image Sai Saran Vaidyanathan ♦ Anil Sagar @ Google ♦♦   · Jun 01, 2016 at 06:24 PM 0
Link

@Anil Sagar - Looks like you can call target servers within Service Callout policy. I tested it using a simple proxy. Have updated the answer below to include both solutions.

We should update the policy docs in that case - @Floyd Jones, @wwitman

avatar image Anil Sagar @ Google ♦♦ Sai Saran Vaidyanathan ♦   · Jun 02, 2016 at 05:35 AM 0
Link

Awesome, Thank you for confirming @Sai Saran Vaidyanathan

avatar image jonesfloyd ♦♦ Sai Saran Vaidyanathan ♦ · Jun 02, 2016 at 04:23 PM 1
Link

Short term, I added <LoadBalancer> in the element reference of Service Callout to at least show it as an option. This is a great use case to document better, and @wwitman is going to put something together. Thanks, @Sai Saran Vaidyanathan!

Show more comments

Close

1 Answer

  • Sort: 
avatar image
6
Best Answer

Answer by Sai Saran Vaidyanathan   · Jun 01, 2016 at 04:51 PM

Hi @MSaichuk

Welcome to Apigee Community !!!

Please refer to the Service Callout policy for example:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<ServiceCallout async="false" continueOnError="false" enabled="true" name="service-callout">
    <DisplayName>service-callout</DisplayName>
    <Properties/>
    <Request clearPayload="true" variable="myRequest">
        <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
    </Request>
    <Response>myResponse</Response>
    <HTTPTargetConnection>
        <LoadBalancer>
            <Algorithm>RoundRobin</Algorithm>
            <Server name="httpbin"/>
            <Server name="yahoo"/>
        </LoadBalancer>
        <Path>/get</Path>
    </HTTPTargetConnection>
</ServiceCallout>

If you don't want to use Service Callout as mentioned above, you can achieve the same thing by defining a separate TargetEndpoint for that flow. Within the proxy endpoint, you can create a Route Rule to call that TargetEndpoint

<!-- Route rule for other target -->
<RouteRule name="second-target-endpoint">
    <Condition>(proxy.pathsuffix MatchesPath "/other")</Condition> <!-- /other is just an example here -->
    <TargetEndpoint>second-target-endpoint</TargetEndpoint>
</RouteRule>

<!-- Default -->
<RouteRule name="default">
    <TargetEndpoint>default</TargetEndpoint>
</RouteRule>

NOTE: Make sure the default route rule is placed at the end in the proxy end point

And inside the second-target-endpoint configuration, you can use the Target Servers configured with load balancer

<HTTPTargetConnection>
        <LoadBalancer>
            <Algorithm>RoundRobin</Algorithm>
            <Server name="Target1"/>
            <Server name="Target2"/>
        </LoadBalancer>
    </HTTPTargetConnection>

Hope this helps ! Please reach out if you still have any questions.


screen-shot-2016-06-01-at-94435-am.png (55.4 kB)
Comment
Add comment Show 2 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MSaichuk · Jun 02, 2016 at 09:00 AM 0
Link

Hello @Sai Saran Vaidyanathan.

Thanks for your answer! I think I've messed up with the question a little bit so I would like to clarify if I can make callout(reuse) to already configured Target Endpoint so if I need to add few servers - I can add them in one common place. Also I need to process Target Endpoint response data as part of my flows, so I think I can't achieve it by using RouteRules only. Using screenshot you provided, I need process response data from target endpoint "second-target-endpoint" callout as part of Proxy Endpoint default PostFlow.

The option that came to my mind I can try to create Proxy Endpoint within the same API Proxy that passes requests directly to the Target Endpoint and then make a callout to it using LocalTargetConnection.

avatar image Anil Sagar @ Google ♦♦ MSaichuk   · Jun 02, 2016 at 09:09 AM 1
Link

@MSaichuk , You can create a different API proxy with a target endpoint which includes multiple target servers for load balancing. You can call this API Proxy (Reusable Proxy) using Proxy Chaining concept using LocalTargetConnection from any other API Proxy. Hope it helps.

Follow this Question

Answers Answers and Comments

30 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

503 service unavailable error 1 Answer

Change Target URL while using target server configuration 3 Answers

An issue with Extended ascii characters when using node and apigee. 1 Answer

context.getVariable() is not working to extract a query param using node.js in Apigee. 1 Answer

Unable to read LookUpCache cache-hit variable inside JavaScript. 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges