public interface MqClient extends Closeable
| 限定符和类型 | 方法和说明 |
|---|---|
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)
异步发布消息
|
void |
subscribe(String topic,
String consumerGroup,
MqConsumeHandler consumerHandler)
订阅主题
|
void |
unpublish(String topic,
String tid)
取消发布
|
CompletableFuture<Boolean> |
unpublishAsync(String topic,
String tid)
取消发布
|
void |
unsubscribe(String topic,
String consumerGroup)
取消订阅主题
|
MqClient connect() throws IOException
IOExceptionvoid disconnect()
throws IOException
IOExceptionMqClient config(org.noear.socketd.transport.client.ClientConfigHandler configHandler)
MqClient autoAcknowledge(boolean auto)
auto - 自动(默认为 true)void subscribe(String topic, String consumerGroup, MqConsumeHandler consumerHandler) throws IOException
topic - 主题consumerGroup - 消费者组consumerHandler - 消费处理IOExceptionvoid unsubscribe(String topic, String consumerGroup) throws IOException
topic - 主题consumerGroup - 消费者组IOExceptionvoid publish(String topic, IMqMessage message) throws IOException
topic - 主题message - 消息IOExceptionCompletableFuture<Boolean> publishAsync(String topic, IMqMessage message) throws IOException
topic - 主题message - 消息IOExceptionvoid unpublish(String topic, String tid) throws IOException
topic - 主题tid - 事务idIOExceptionCompletableFuture<Boolean> unpublishAsync(String topic, String tid) throws IOException
topic - 主题tid - 事务idIOExceptionCopyright © 2023. All rights reserved.