pom.xml in the application's root directory to add dependencyManagement for polaris-java:<dependencyManagement><dependencies><dependency><groupId>com.tencent.polaris</groupId><artifactId>polaris-dependencies</artifactId><version>${version}</version><type>pom</type><scope>import</scope></dependency></dependencies></dependencyManagement>
<dependencies><dependency><groupId>com.tencent.polaris</groupId><artifactId>polaris-all</artifactId></dependency></dependencies>
global:serverConnectors:- id: polarisprotocol: grpcaddresses:# The IP address needs to be replaced with the client access IP address of the North Star engine you created.- 127.0.0.1:8091# Description: Configuration related to monitoring and log data reportingstatReporter:# Description: Whether to Enable Reportingenable: trueplugin:prometheus:type: push# Description: Configure the pushgateway IP address, effective only when type == push# The IP address needs to be replaced with the client access IP address of the North Star engine you created.address: 127.0.0.1:9091# Description: Set the execution interval for pushing metric data to pushgateway# Range: [1s:...], Default value: 10spushInterval: 10s
import com.tencent.polaris.ratelimit.factory.LimitAPIFactory;public static void main(String[] args) throws Exception {LimitAPI limitAPI = LimitAPIFactory.createLimitAPI();}
QuotaRequest quotaRequest = new QuotaRequest();// Configure rate limiting service information: set namespace informationquotaRequest.setNamespace(String namespace);// Configure rate limiting service information: specify service name informationquotaRequest.setService(String service);// Set the method information for this invocationquotaRequest.setMethod(String method);// Set the request TagquotaRequest.setArguments(Set<Argument> arguments)// Set the request quota quantity to be requestedquotaRequest.setCount(1);
QuotaResponse resp = limitAPI.getQuota(registerRequest);
Was this page helpful?
You can also Contact sales or Submit a Ticket for help.
Help us improve! Rate your documentation experience in 5 mins.
Feedback