Search in sources :

Example 21 with GatewayFlowRule

use of com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule in project XHuiCloud by sindaZeng.

the class GatewayFlowRuleEntity method toGatewayFlowRule.

public GatewayFlowRule toGatewayFlowRule() {
    GatewayFlowRule rule = new GatewayFlowRule();
    rule.setResource(resource);
    rule.setResourceMode(resourceMode);
    rule.setGrade(grade);
    rule.setCount(count);
    rule.setIntervalSec(calIntervalSec(interval, intervalUnit));
    rule.setControlBehavior(controlBehavior);
    if (burst != null) {
        rule.setBurst(burst);
    }
    if (maxQueueingTimeoutMs != null) {
        rule.setMaxQueueingTimeoutMs(maxQueueingTimeoutMs);
    }
    if (paramItem != null) {
        GatewayParamFlowItem ruleItem = new GatewayParamFlowItem();
        rule.setParamItem(ruleItem);
        ruleItem.setParseStrategy(paramItem.getParseStrategy());
        ruleItem.setFieldName(paramItem.getFieldName());
        ruleItem.setPattern(paramItem.getPattern());
        if (paramItem.getMatchStrategy() != null) {
            ruleItem.setMatchStrategy(paramItem.getMatchStrategy());
        }
    }
    return rule;
}
Also used : GatewayParamFlowItem(com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem) GatewayFlowRule(com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule)

Aggregations

GatewayFlowRule (com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayFlowRule)21 GatewayParamFlowItem (com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayParamFlowItem)15 HashSet (java.util.HashSet)11 Test (org.junit.Test)6 ApiDefinition (com.alibaba.csp.sentinel.adapter.gateway.common.api.ApiDefinition)2 DegradeRule (com.alibaba.csp.sentinel.slots.block.degrade.DegradeRule)2 HashMap (java.util.HashMap)2 ServerWebExchange (org.springframework.web.server.ServerWebExchange)2 AsyncEntry (com.alibaba.csp.sentinel.AsyncEntry)1 SentinelGatewayConstants (com.alibaba.csp.sentinel.adapter.gateway.common.SentinelGatewayConstants)1 GatewayApiDefinitionManager (com.alibaba.csp.sentinel.adapter.gateway.common.api.GatewayApiDefinitionManager)1 GatewayParamParser (com.alibaba.csp.sentinel.adapter.gateway.common.param.GatewayParamParser)1 GatewayRuleManager (com.alibaba.csp.sentinel.adapter.gateway.common.rule.GatewayRuleManager)1 RuleConstant (com.alibaba.csp.sentinel.slots.block.RuleConstant)1 Listener (com.alibaba.nacos.api.config.listener.Listener)1 DoorGoodConfig (com.hummer.doorgod.service.domain.configuration.DoorGoodConfig)1 InetAddress (java.net.InetAddress)1 InetSocketAddress (java.net.InetSocketAddress)1 Map (java.util.Map)1 Set (java.util.Set)1