public class ConsumerService extends Object
| Modifier and Type | Class and Description |
|---|---|
class |
ConsumerService.MockProxy |
| Constructor and Description |
|---|
ConsumerService() |
| Modifier and Type | Method and Description |
|---|---|
List<String> |
addresses()
Deprecated.
|
ConsumerService |
callbackMethod(String methodName,
Object listener)
增加一个通过callback方式调用的方法
|
void |
cancelAllMock()
取消所有方法的mock
|
void |
cancelMock(List<Method> methods) |
void |
cancelMock(Method method)
传入需要取消mock的Method对象
|
ConsumerService |
futureMethod(String methodName)
增加一个通过future方式调用的方法
|
ConsumerService |
generic() |
Object |
genericInvoke(GenericMethod method) |
Object |
getMockService()
获取针对服务接口的Mock对象,可以直接进行调用
|
ConsumerService |
group(String group)
设置要提供的HSF服务的组别
|
boolean |
isConsumed() |
ConsumerService |
methodTimeout(String methodName,
int timeout)
针对某个方法设置单独的超时时间
|
void |
mock(List<Method> methods,
Object expectValue)
传入需要mock的Method对象的List和返回值,在调用这个方法的时候会返回对应的expectValue
|
void |
mock(Method method,
Object expectValue)
传入需要mock的Method对象和返回值,在调用这个方法的时候会返回对应的expectValue
|
ConsumerService |
newConsumer() |
ConsumerService |
service(String service)
设置要提供的HSF服务名
|
Object |
subscribe()
获取消费服务的接口,可以进行强制转换。
|
void |
sync()
Deprecated.
|
ConsumerService |
targetIp(String ip)
指定IP调用
|
ConsumerService |
timeout(int timeout)
统一设置所有服务的超时时间ͳ
|
ConsumerService |
version(String version)
设置要提供的HSF服务的版本号
|
public ConsumerService newConsumer()
public ConsumerService service(String service)
service - HSF服务名public ConsumerService version(String version)
version - public ConsumerService group(String group)
group - public ConsumerService generic()
public Object genericInvoke(GenericMethod method) throws Exception
method - GenericMethodExceptionpublic ConsumerService timeout(int timeout)
timeout - 超时时间public ConsumerService methodTimeout(String methodName, int timeout)
methodName - 方法名timeout - 对应方法的超时时间public Object subscribe()
public Object getMockService()
public void mock(Method method, Object expectValue)
method - expectValue - public void mock(List<Method> methods, Object expectValue)
methods - expectValue - public void cancelMock(Method method)
method - public void cancelAllMock()
@Deprecated public void sync() throws Exception
Exceptionpublic ConsumerService targetIp(String ip) throws Exception
ip - 指定的IPException@Deprecated public List<String> addresses() throws Exception
Exceptionpublic boolean isConsumed()
public ConsumerService futureMethod(String methodName)
methodName - public ConsumerService callbackMethod(String methodName, Object listener)
methodName - listener - HSF回调的listener,要求必须实现HSFResponseCallback接口。Copyright © 2017. All rights reserved.