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)
发送(不需要答复)
|
default R |
sendAndRequest(String topic,
C content)
发送并请求(会等待响应)
|
R |
sendAndRequest(String topic,
C content,
long timeout)
发送并请求(会等待响应)
|
boolean |
sendAndSubscribe(String topic,
C content,
Consumer<R> consumer)
发送并订阅
|
void |
unlisten(String topic)
取消监听(主题下的所有监听)
|
void |
unlisten(String topic,
TopicListener<Payload<C,R>> listener)
取消监听
|
void intercept(int index,
Interceptor<C,R> interceptor)
index - 顺序位interceptor - 拦截器default void intercept(Interceptor<C,R> interceptor)
interceptor - 拦截器default R sendAndRequest(String topic, C content)
topic - 主题content - 内容R sendAndRequest(String topic, C content, long timeout)
topic - 主题content - 内容timeout - 超时(毫秒)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 - 监听void unlisten(String topic)
topic - 主题Copyright © 2024. All rights reserved.