這是一個4MB/s
政策。
@Plan:name('carbon.super_app_BandwidthPolicy')
@Plan:description('ExecutionPlan for app_BandwidthPolicy')
@Import('org.wso2.throttle.processed.request.stream:1.0.0')
define stream RequestStream (messageID string, appKey string, appTier string, subscriptionKey string, apiKey string, apiTier string, subscriptionTier string, resourceKey string, resourceTier string, userId string, apiContext string, apiVersion string, appTenant string, apiTenant string, appId string, apiName string, propertiesMap string);
@Export('org.wso2.throttle.globalThrottle.stream:1.0.0')
define stream GlobalThrottleStream (throttleKey string, isThrottled bool, expiryTimeStamp long);
FROM RequestStream
SELECT messageID, (appTenant == 'carbon.super' and appTier == 'BandwidthPolicy') AS isEligible, appKey AS throttleKey, propertiesMap
INSERT INTO EligibilityStream;
FROM EligibilityStream[isEligible==true]#throttler:timeBatch(1 min, 0)
select throttleKey, (sum(cast(map:get(propertiesMap,'messageSize'),'long')) >= 4194304) as isThrottled, expiryTimeStamp group by throttleKey
INSERT ALL EVENTS into ResultStream;
from ResultStream#throttler:emitOnStateChange(throttleKey, isThrottled)
select *
insert into GlobalThrottleStream;
來源
2016-09-29 11:56:14
Bee
您是否使用默認高級遏制? – Bee
在發佈API時,我已經設置了這個... 高級限制策略:我已經選擇了「應用於API級別」,並從下拉菜單中將該值設置爲「Unlimited」。 – siddhesh
如果您正確創建了新的訂閱策略(每分鐘20個),它應該按預期進行調節。你可以在'wso2am-2.0.0/repository/deployment/server/executionplans'中發佈相應的策略文件嗎? – Bee