001/** 002 * Copyright (c) 2015-2022, Michael Yang 杨福海 (fuhai999@gmail.com). 003 * <p> 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * <p> 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * <p> 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package io.jboot.components.rpc.annotation; 017 018import java.lang.annotation.*; 019 020@Inherited 021@Retention(RetentionPolicy.RUNTIME) 022@Target({ElementType.TYPE, ElementType.FIELD}) 023public @interface RPCInject { 024 025 026 /** 027 * Service version, default value is empty string 028 */ 029 String version() default ""; 030 031 /** 032 * Service group, default value is empty string 033 */ 034 String group() default ""; 035 036 /** 037 * Service target URL for direct invocation, if this is specified, then registry center takes no effect. 038 */ 039 String url() default ""; 040 041 042 /** 043 * Whether to enable generic invocation, default value is false 044 */ 045 boolean generic() default false; 046 047 048 /** 049 * Check if service provider is available during boot up, default value is true 050 */ 051 boolean check() default true; 052 053 054 /** 055 * Service invocation retry times 056 * 057 * see Constants#DEFAULT_RETRIES 058 */ 059 int retries() default 2; 060 061 062 /** 063 * Load balance strategy, legal values include: random, roundrobin, leastactive 064 * 065 * see Constants#DEFAULT_LOADBALANCE 066 */ 067 String loadbalance() default "random"; 068 069 /** 070 * Whether to enable async invocation, default value is false 071 */ 072 boolean async() default false; 073 074 /** 075 * Maximum active requests allowed, default value is 0 076 */ 077 int actives() default 0; 078 079 080 /** 081 * Timeout value for service invocation, default value is 0 082 */ 083 int timeout() default 0; 084 085 /** 086 * Application associated name 087 */ 088 String application() default ""; 089 090 /** 091 * Module associated name 092 */ 093 String module() default ""; 094 095 096 /** 097 * Consumer associated name 098 */ 099 String consumer() default ""; 100 101 /** 102 * Monitor associated name 103 */ 104 String monitor() default ""; 105 106 /** 107 * Registry associated name 108 */ 109 String[] registry() default {}; 110 111 /** 112 * The communication protocol of Dubbo Service 113 * 114 * @return the default value is "" 115 * @since 2.6.6 116 */ 117 String protocol() default ""; 118 119 /** 120 * Service tag name 121 */ 122 String tag() default ""; 123 124 /** 125 * The id 126 * 127 * @return default value is empty 128 * @since 2.7.3 129 */ 130 String id() default ""; 131 132}