T - the type parameterpublic class ConsumerConfig<T> extends AbstractInterfaceConfig<T,ConsumerConfig<T>> implements Serializable
| 限定符和类型 | 字段和说明 |
|---|---|
protected String |
addressHolder
地址管理器
|
protected int |
addressWait
等待地址获取时间(毫秒),-1表示等到拿到地址位置
|
protected String |
bootstrap
启动器
|
protected boolean |
check
是否强依赖(即没有服务节点就启动失败,注意此参数可能和lazy冲突,开启check后lazy自动失效)
|
protected String |
cluster
集群处理,默认是failover
|
protected int |
concurrents
接口下每方法的最大可并行执行请求数,配置-1关闭并发过滤器,等于0表示开启过滤但是不限制
|
protected String |
connectionHolder
The ConnectionHolder 连接管理器
|
protected int |
connectionNum
长连接个数,不是所有的框架都支持一个地址多个长连接
|
protected int |
connectTimeout
连接超时时间
|
protected String |
directUrl
直连调用地址
|
protected int |
disconnectTimeout
关闭超时时间(如果还有请求,会等待请求结束或者超时)
|
protected boolean |
generic
是否泛化调用
|
protected int |
heartbeatPeriod
Consumer给Provider发心跳的间隔
|
protected boolean |
inJVM
是否jvm内部调用(provider和consumer配置在同一个jvm内,则走本地jvm内部,不走远程)
|
protected String |
invokeType
是否异步调用
|
protected boolean |
lazy
是否延迟建立长连接(第一次调用时新建,注意此参数可能和check冲突,开启check后lazy自动失效)
|
protected String |
loadBalancer
负载均衡
|
protected List<ConsumerStateListener> |
onAvailable
客户端状态变化监听器实例,状态可用和不可以时触发
|
protected List<ChannelListener> |
onConnect
连接事件监听器实例,连接或者断开时触发
|
protected SofaResponseCallback |
onReturn
返回值之前的listener,处理结果或者异常
|
protected String |
protocol
调用的协议
|
protected int |
reconnectPeriod
Consumer给Provider重连的间隔
|
protected int |
repeatedReferLimit
同一个服务(接口协议uniqueId相同)的最大引用次数,防止由于代码bug导致重复引用,每次引用都会生成一个代理类对象,-1表示不检查
|
protected int |
retries
The Retries.
|
protected List<String> |
router
路由配置别名
|
protected List<Router> |
routerRef
路由规则引用,多个用英文逗号隔开。
|
protected boolean |
sticky
粘滞连接,一个断开才选下一个
change transport when current is disconnected
|
protected int |
timeout
客户端调用超时时间(毫秒)
|
application, cache, cacheRef, compress, configListener, configValueCache, filter, filterRef, group, interfaceId, methods, mock, mockRef, parameters, proxy, proxyClass, register, registry, serialization, subscribe, uniqueId, validation, version| 构造器和说明 |
|---|
ConsumerConfig() |
| 限定符和类型 | 方法和说明 |
|---|---|
String |
buildKey()
Build key.
|
String |
getAddressHolder()
Gets address holder.
|
int |
getAddressWait()
Gets address wait.
|
String |
getBootstrap()
Gets bootstrap.
|
String |
getCluster()
Gets cluster.
|
int |
getConcurrents()
Gets concurrents.
|
String |
getConnectionHolder()
Gets connection holder.
|
int |
getConnectionNum()
Gets connectionNum.
|
int |
getConnectTimeout()
Gets connect timeout.
|
ConsumerBootstrap<T> |
getConsumerBootstrap()
得到服务消费这启动器
|
String |
getDirectUrl()
Gets directUrl.
|
int |
getDisconnectTimeout()
Gets disconnect timeout.
|
int |
getHeartbeatPeriod()
Gets heartbeatPeriod.
|
String |
getInvokeType()
Gets invoke type.
|
String |
getLoadBalancer()
Gets load balancer.
|
String |
getMethodInvokeType(String methodName)
Gets time out.
|
SofaResponseCallback |
getMethodOnreturn(String methodName)
得到方法名对应的自定义参数列表
|
int |
getMethodRetries(String methodName)
得到方法的重试次数,默认接口配置
|
int |
getMethodTimeout(String methodName)
Gets time out.
|
List<ConsumerStateListener> |
getOnAvailable()
Gets on available.
|
List<ChannelListener> |
getOnConnect()
Gets on connect.
|
SofaResponseCallback |
getOnReturn()
Gets on return.
|
String |
getProtocol()
Gets protocol.
|
ProviderInfoListener |
getProviderInfoListener()
Gets provider info listener.
|
Class<?> |
getProxyClass()
Gets proxy class.
|
int |
getReconnectPeriod()
Gets reconnectPeriod.
|
int |
getRepeatedReferLimit()
Gets max proxy count.
|
int |
getRetries()
Gets retries.
|
List<String> |
getRouter()
Gets router.
|
List<Router> |
getRouterRef()
Gets routerRef.
|
int |
getTimeout()
Gets timeout.
|
boolean |
hasConcurrents()
是否有并发控制需求,有就打开过滤器
配置-1关闭并发过滤器,等于0表示开启过滤但是不限制
|
boolean |
hasTimeout()
是否有超时配置
|
boolean |
isCheck()
Is check boolean.
|
boolean |
isGeneric()
Is generic boolean.
|
boolean |
isInJVM()
Is in jvm boolean.
|
boolean |
isLazy()
Is lazy boolean.
|
boolean |
isSticky()
Is sticky boolean.
|
T |
refer()
引用服务
|
ConsumerConfig |
setAddressHolder(String addressHolder)
Sets address holder.
|
ConsumerConfig<T> |
setAddressWait(int addressWait)
Sets address wait.
|
ConsumerConfig<T> |
setBootstrap(String bootstrap)
Sets bootstrap.
|
ConsumerConfig<T> |
setCheck(boolean check)
Sets check.
|
ConsumerConfig<T> |
setCluster(String cluster)
Sets cluster.
|
ConsumerConfig<T> |
setConcurrents(int concurrents)
Sets concurrents.
|
ConsumerConfig<T> |
setConnectionHolder(String connectionHolder)
Sets connection holder.
|
ConsumerConfig<T> |
setConnectionNum(int connectionNum)
Sets connectionNum.
|
ConsumerConfig<T> |
setConnectTimeout(int connectTimeout)
Sets connect timeout.
|
ConsumerConfig<T> |
setDirectUrl(String directUrl)
Sets directUrl.
|
ConsumerConfig<T> |
setDisconnectTimeout(int disconnectTimeout)
Sets disconnect timeout.
|
ConsumerConfig<T> |
setGeneric(boolean generic)
Sets generic.
|
ConsumerConfig<T> |
setHeartbeatPeriod(int heartbeatPeriod)
Sets heartbeatPeriod.
|
ConsumerConfig<T> |
setInJVM(boolean inJVM)
Sets in jvm.
|
ConsumerConfig<T> |
setInvokeType(String invokeType)
Sets invoke type.
|
ConsumerConfig<T> |
setLazy(boolean lazy)
Sets lazy.
|
ConsumerConfig<T> |
setLoadBalancer(String loadBalancer)
Sets load balancer.
|
ConsumerConfig<T> |
setOnAvailable(List<ConsumerStateListener> onAvailable)
Sets on available.
|
ConsumerConfig<T> |
setOnConnect(List<ChannelListener> onConnect)
Sets on connect.
|
ConsumerConfig<T> |
setOnReturn(SofaResponseCallback onReturn)
Sets on return.
|
ConsumerConfig<T> |
setProtocol(String protocol)
Sets protocol.
|
ConsumerConfig<T> |
setProviderInfoListener(ProviderInfoListener providerInfoListener)
Sets provider info listener.
|
ConsumerConfig<T> |
setReconnectPeriod(int reconnectPeriod)
Sets reconnectPeriod.
|
ConsumerConfig<T> |
setRepeatedReferLimit(int repeatedReferLimit)
Sets max proxy count.
|
ConsumerConfig<T> |
setRetries(int retries)
Sets retries.
|
ConsumerConfig |
setRouter(List<String> router)
Sets router.
|
ConsumerConfig<T> |
setRouterRef(List<Router> routerRef)
Sets routerRef.
|
ConsumerConfig<T> |
setSerialization(String serialization)
Sets serialization.
|
ConsumerConfig<T> |
setSticky(boolean sticky)
Sets sticky.
|
ConsumerConfig<T> |
setTimeout(int timeout)
Sets timeout.
|
void |
unRefer()
取消引用服务
|
getApplication, getAppName, getCacheRef, getCompress, getConfigListener, getConfigValueCache, getConfigValueCache, getFilter, getFilterRef, getGroup, getInterfaceId, getMethodConfigValue, getMethodConfigValue, getMethods, getMockRef, getParameter, getParameters, getProxy, getRegistry, getSerialization, getUniqueId, getVersion, hasCache, hasToken, hasValidation, isCache, isMock, isRegister, isSubscribe, isValidation, queryAttribute, setApplication, setCache, setCacheRef, setCompress, setConfigListener, setFilter, setFilterRef, setGroup, setInterfaceId, setMethods, setMethods, setMock, setMockRef, setParameter, setParameters, setProxy, setRegister, setRegistry, setRegistry, setSubscribe, setUniqueId, setValidation, setVersion, updateAttributecastThis, getId, setIdprotected String protocol
protected String directUrl
protected boolean generic
protected String invokeType
protected int connectTimeout
protected int disconnectTimeout
protected String cluster
protected String connectionHolder
protected String addressHolder
protected String loadBalancer
protected boolean lazy
checkprotected boolean sticky
protected boolean inJVM
protected boolean check
lazyprotected int connectionNum
protected int heartbeatPeriod
protected int reconnectPeriod
protected transient SofaResponseCallback onReturn
@Unstable protected transient List<ChannelListener> onConnect
@Unstable protected transient List<ConsumerStateListener> onAvailable
protected String bootstrap
protected int addressWait
protected int repeatedReferLimit
protected int timeout
protected int retries
protected int concurrents
public String buildKey()
buildKey 在类中 AbstractInterfaceConfig<T,ConsumerConfig<T>>public Class<?> getProxyClass()
getProxyClass 在类中 AbstractInterfaceConfig<T,ConsumerConfig<T>>public String getProtocol()
public ConsumerConfig<T> setProtocol(String protocol)
protocol - the protocolpublic String getDirectUrl()
public ConsumerConfig<T> setDirectUrl(String directUrl)
directUrl - the directUrlpublic boolean isGeneric()
public ConsumerConfig<T> setGeneric(boolean generic)
generic - the genericpublic String getInvokeType()
public ConsumerConfig<T> setInvokeType(String invokeType)
invokeType - the invoke typepublic int getConnectTimeout()
public ConsumerConfig<T> setConnectTimeout(int connectTimeout)
connectTimeout - the connect timeoutpublic int getDisconnectTimeout()
public ConsumerConfig<T> setDisconnectTimeout(int disconnectTimeout)
disconnectTimeout - the disconnect timeoutpublic String getCluster()
public ConsumerConfig<T> setCluster(String cluster)
cluster - the clusterpublic int getRetries()
public ConsumerConfig<T> setRetries(int retries)
retries - the retriespublic String getConnectionHolder()
public ConsumerConfig<T> setConnectionHolder(String connectionHolder)
connectionHolder - the connection holderpublic String getAddressHolder()
public ConsumerConfig setAddressHolder(String addressHolder)
addressHolder - the address holderpublic String getLoadBalancer()
public ConsumerConfig<T> setLoadBalancer(String loadBalancer)
loadBalancer - the load balancerpublic boolean isLazy()
public ConsumerConfig<T> setLazy(boolean lazy)
lazy - the lazypublic boolean isSticky()
public ConsumerConfig<T> setSticky(boolean sticky)
sticky - the stickypublic boolean isInJVM()
public ConsumerConfig<T> setInJVM(boolean inJVM)
inJVM - the in jvmpublic boolean isCheck()
public ConsumerConfig<T> setCheck(boolean check)
check - the checkpublic int getConnectionNum()
public ConsumerConfig<T> setConnectionNum(int connectionNum)
connectionNum - the connectionNumpublic int getHeartbeatPeriod()
public ConsumerConfig<T> setHeartbeatPeriod(int heartbeatPeriod)
heartbeatPeriod - the heartbeatPeriodpublic int getReconnectPeriod()
public ConsumerConfig<T> setReconnectPeriod(int reconnectPeriod)
reconnectPeriod - the reconnectPeriodpublic ConsumerConfig setRouter(List<String> router)
router - the routerpublic ConsumerConfig<T> setRouterRef(List<Router> routerRef)
routerRef - the routerRefpublic SofaResponseCallback getOnReturn()
public ConsumerConfig<T> setOnReturn(SofaResponseCallback onReturn)
onReturn - the on returnpublic List<ChannelListener> getOnConnect()
public ConsumerConfig<T> setOnConnect(List<ChannelListener> onConnect)
onConnect - the on connectpublic List<ConsumerStateListener> getOnAvailable()
public ConsumerConfig<T> setOnAvailable(List<ConsumerStateListener> onAvailable)
onAvailable - the on availablepublic int getTimeout()
public ConsumerConfig<T> setTimeout(int timeout)
timeout - the timeoutpublic int getConcurrents()
public ConsumerConfig<T> setConcurrents(int concurrents)
concurrents - the concurrentspublic String getBootstrap()
public ConsumerConfig<T> setBootstrap(String bootstrap)
bootstrap - the bootstrappublic int getAddressWait()
public ConsumerConfig<T> setAddressWait(int addressWait)
addressWait - the address waitpublic int getRepeatedReferLimit()
public ConsumerConfig<T> setRepeatedReferLimit(int repeatedReferLimit)
repeatedReferLimit - the max proxy countpublic boolean hasTimeout()
AbstractInterfaceConfighasTimeout 在类中 AbstractInterfaceConfig<T,ConsumerConfig<T>>public boolean hasConcurrents()
hasConcurrents 在类中 AbstractInterfaceConfig<T,ConsumerConfig<T>>public int getMethodRetries(String methodName)
methodName - 方法名public int getMethodTimeout(String methodName)
methodName - the method namepublic SofaResponseCallback getMethodOnreturn(String methodName)
methodName - 方法名,不支持重载public String getMethodInvokeType(String methodName)
methodName - the method namepublic T refer()
public void unRefer()
public ConsumerBootstrap<T> getConsumerBootstrap()
public ConsumerConfig<T> setSerialization(String serialization)
setSerialization 在类中 AbstractInterfaceConfig<T,ConsumerConfig<T>>serialization - the serializationpublic ProviderInfoListener getProviderInfoListener()
public ConsumerConfig<T> setProviderInfoListener(ProviderInfoListener providerInfoListener)
providerInfoListener - the provider info listenerCopyright © 2008–2018 The Ant Financial. All rights reserved.