public interface DamiBus<C,R>
| 限定符和类型 | 方法和说明 |
|---|---|
default void |
intercept(Interceptor<C,R> interceptor)
拦截
|
void |
intercept(int index,
Interceptor<C,R> interceptor)
拦截
|
void |
listen(String topic,
int index,
TopicListener<Payload<C,R>> listener)
监听
|
default void |
listen(String topic,
TopicListener<Payload<C,R>> listener)
监听
|
boolean |
send(String topic,
C content)
发送(不需要答复)
|
R |
sendAndRequest(String topic,
C content)
发送并请求(会等待响应)
|
boolean |
sendAndSubscribe(String topic,
C content,
Consumer<R> consumer)
发送并订阅
|
long |
timeout()
获取响应超时(单位:毫秒)
|
void |
unlisten(String topic,
TopicListener<Payload<C,R>> listener)
取消监听
|
long timeout()
void intercept(int index,
Interceptor<C,R> interceptor)
index - 顺序位interceptor - 拦截器default void intercept(Interceptor<C,R> interceptor)
interceptor - 拦截器R sendAndRequest(String topic, C content)
topic - 主题content - 内容boolean sendAndSubscribe(String topic, C content, Consumer<R> consumer)
topic - 主题content - 内容consumer - 消费者default void listen(String topic, TopicListener<Payload<C,R>> listener)
topic - 主题listener - 监听void listen(String topic, int index, TopicListener<Payload<C,R>> listener)
topic - 主题index - 顺序位listener - 监听void unlisten(String topic, TopicListener<Payload<C,R>> listener)
topic - 主题listener - 监听Copyright © 2023. All rights reserved.