public interface MqClient
| 限定符和类型 | 方法和说明 |
|---|---|
MqClient |
autoAcknowledge(boolean auto)
自动回执
|
MqClient |
config(org.noear.socketd.transport.client.ClientConfigHandler configHandler)
客户端配置
|
MqClient |
connect()
连接
|
void |
disconnect()
断开连接
|
void |
publish(String topic,
IMqMessage message)
同步发布消息
|
CompletableFuture<Boolean> |
publishAsync(String topic,
IMqMessage message)
异步发布消息
|
MqClient |
publishRetryTimes(int times)
发布重试
|
void |
subscribe(String topic,
String consumer,
MqConsumeHandler consumerHandler)
订阅主题
|
void |
unsubscribe(String topic,
String consumer)
取消订阅主题
|
MqClient connect() throws IOException
IOExceptionvoid disconnect()
throws IOException
IOExceptionMqClient config(org.noear.socketd.transport.client.ClientConfigHandler configHandler)
MqClient autoAcknowledge(boolean auto)
auto - 自动(默认为 true)MqClient publishRetryTimes(int times)
times - 次数(默认为 0)void subscribe(String topic, String consumer, MqConsumeHandler consumerHandler) throws IOException
topic - 主题consumer - 消费者(实例 ip 或 集群 name)consumerHandler - 消费处理IOExceptionvoid unsubscribe(String topic, String consumer) throws IOException
topic - 主题consumer - 消费者(实例 ip 或 集群 name)IOExceptionvoid publish(String topic, IMqMessage message) throws IOException
topic - 主题message - 消息IOExceptionCompletableFuture<Boolean> publishAsync(String topic, IMqMessage message) throws IOException
topic - 主题message - 消息IOExceptionCopyright © 2023. All rights reserved.