Search in sources :

Example 6 with ExpressionSelector

use of com.alibaba.nacos.api.selector.ExpressionSelector in project nacos by alibaba.

the class NacosNamingMaintainService method createService.

@Override
public void createService(String serviceName, String groupName, float protectThreshold, String expression) throws NacosException {
    Service service = new Service();
    service.setName(serviceName);
    service.setGroupName(groupName);
    service.setProtectThreshold(protectThreshold);
    ExpressionSelector selector = new ExpressionSelector();
    selector.setExpression(expression);
    createService(service, selector);
}
Also used : ExpressionSelector(com.alibaba.nacos.api.selector.ExpressionSelector) NamingMaintainService(com.alibaba.nacos.api.naming.NamingMaintainService) Service(com.alibaba.nacos.api.naming.pojo.Service) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService)

Aggregations

ExpressionSelector (com.alibaba.nacos.api.selector.ExpressionSelector)6 Test (org.junit.Test)4 Service (com.alibaba.nacos.api.naming.pojo.Service)3 HashMap (java.util.HashMap)3 NamingMaintainService (com.alibaba.nacos.api.naming.NamingMaintainService)2 ServiceInfoHolder (com.alibaba.nacos.client.naming.cache.ServiceInfoHolder)2 InstancesChangeNotifier (com.alibaba.nacos.client.naming.event.InstancesChangeNotifier)2 Properties (java.util.Properties)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 NacosException (com.alibaba.nacos.api.exception.NacosException)1 NamingService (com.alibaba.nacos.api.naming.NamingService)1 Instance (com.alibaba.nacos.api.naming.pojo.Instance)1 ListView (com.alibaba.nacos.api.naming.pojo.ListView)1 AbstractSelector (com.alibaba.nacos.api.selector.AbstractSelector)1 NoneSelector (com.alibaba.nacos.api.selector.NoneSelector)1 NamingGrpcClientProxy (com.alibaba.nacos.client.naming.remote.gprc.NamingGrpcClientProxy)1 TypeReference (com.fasterxml.jackson.core.type.TypeReference)1 JsonNode (com.fasterxml.jackson.databind.JsonNode)1 Field (java.lang.reflect.Field)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1