wso2 - WSO2 API Manager - 使用动态端点进行负载平衡
问题描述
我有一个使用动态端点的 API。现在我希望它也能做负载平衡。我知道如何使用元素来做到这一点,但是在 APIM 中使用动态端点时,您只能操作“To”标头。
以下是用于设置端点的中介序列。我希望能够在两台服务器之间进行负载平衡,而不是在每种情况下只处理一个端点。
有什么想法吗?
谢谢。
<?xml version="1.0" encoding="UTF-8"?>
<sequence name="inSequence_clientEquipmentsAPI_1_2_STG" trace="disable" xmlns="http://ws.apache.org/ns/synapse">
<!-- check for healthcheck operation -->
<filter xpath="get-property('To')='/etc/equipments/client/1.0/healthCheck'">
<!-- if healthCheck, directs to healthCheck API (EI)-->
<then>
<property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
<header name="To" value="http://10.220.160.36:8290/healthCheck/clientEquipments"/>
</then>
<!-- else direct to regular clientEquipment API (EI)-->
<else>
<property name="newContext" expression="substring-after(get-property('To'),'/etc')"/>
<header name="To" expression="fn:concat('http://10.220.160.36:8290', $ctx:newContext)"/>
</else>
</filter>
</sequence>
解决方案
推荐阅读
- amazon-web-services - 如何通过 Cognito 用户池授权令牌识别用户?
- dask - Dask read_csv 是否支持 http 网络请求?
- python - 如何创建一个numpy数组来描述三角形的顶点?
- ajax - 在 componentDidMount 内的 API 调用之后的 setState
- oracle - 每当 Oracle PL/SQL 中出现 SQL WARNINGS 时,如何在 sqlplus 中回滚和退出?
- laravel - Laravel:合并两个查询构建器
- c++ - 强制使用 C++17 枚举无效值
- python - 恢复这三个字段的价值 Odoo 10
- java - 带有任一 List 的 Spring RequestBody