shenyu-plugin-tarsorg.apache.shenyu.plugin.tars.TarsPlugin<dependency> <groupId>org.apache.shenyu</groupId> <artifactId>shenyu-spring-boot-starter-client-tars</artifactId> <version>${shenyu.version}</version> </dependency>
shenyu: register: registerType: http #zookeeper #etcd #nacos #consul serverLists: http://localhost:9095 #localhost:2181 #http://localhost:2379 #localhost:8848 props: username: admin password: 123456 client: tars: props: contextPath: /tars appName: tars port: 21715 host: 192.168.41.103 # client IP
@ShenyuTarsService and @ShenyuTarsClient and annotation to the interface.@TarsServant("HelloObj") @ShenyuTarsService(serviceName = "ShenyuExampleServer.ShenyuExampleApp.HelloObj") public class HelloServantImpl implements HelloServant { @Override @ShenyuTarsClient("/hello") public String hello(final int no, final String name) { return String.format("hello no=%s, name=%s, time=%s", no, name, System.currentTimeMillis()); } }
tars set Status enabled.multiSelectorHandle:Set to enable multiple selector processing, multiple selector processing services can be configured in the selector list.multiRuleHandle:Set to multiple rules processing, configure multiple processing rules in the rule list, it is recommended to configure as single rule.threadpool:There are five types of business thread pools: fixed, eager, cached, limited and shared. The first 4 types correspond to the thread pools officially provided by dubbo. Let's talk about shared, as its name implies, all proxy plugins share a shared thread pool, the advantage of this is that it can reduce the number of thread pools, thereby reducing memory and improving resource utilization.corethreads:The number of core threads in the business thread pool.threads:The maximum number of threads in the business thread pool.queues:The length of the blocking queue of the business thread pool, 0 means unbounded blocking queue.Flow needs to be matched by selector.
Automatically configure the selectors with the @ShenyuTarsClient annotation.
After the traffic has been successfully matched by the selector, it will enter the rules for the final traffic matching.
Automatically configure the rules with the @ShenyuTarsClient annotation.
When the
Tarsapplication client accesses theApache ShenYugateway, it will be automatically registered, and can be viewed in theshenyu-adminbackend management system's basic configuration-->metadata management, eachTarsinterface method, will correspond to a metadata.
AppName: specifies the name of the application to which the metadata belongs.
MethodName: the name of the method to call.
Path: http request path.
PathDescribe: the description of the path is easy to view.
ParamsType: the parameters are separated by commas (,) in the order of interface parameter types.
RpcExpand: other configurations of the Tars interface, which support the JSON format.
examples:{"loadbalance":"hash","retries":3,"timeout":-1}
loadbalance:Load balancing policy, currently supports roundRobin, random and hash.retries:Number of retries to call client timeout failures.timeout:Calling the client's timeout time.Interface: The fully qualified class name of the Tars interface.
RpcType:Auto-registration defaults to Tars.
ShenYu Admin.Shenyu Bootstrap.tars set Status enabled, And adjust the registry configuration as needed.shenyu-admin --> BasicConfig --> Plugin --> tars set Status disable.