public interface MqClient extends Closeable
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
autoAcknowledge()
自动回执
|
MqClient |
autoAcknowledge(boolean auto)
自动回执
|
CompletableFuture<String> |
call(String apiName,
String apiToken,
String topic,
String consumerGroup)
接口调用
|
MqClient |
config(org.noear.socketd.transport.client.ClientConfigHandler configHandler)
客户端配置
|
MqClient |
connect()
连接
|
MqClient |
consumeExecutor(ExecutorService consumeExecutor)
消费执行器
|
void |
disconnect()
断开连接
|
void |
listen(MqConsumeHandler listenHandler)
监听
|
String |
name()
名字
|
MqClient |
nameAs(String name)
名字取为
|
MqTransaction |
newTransaction()
新建事务
|
void |
publish(String topic,
MqMessage message)
同步发布消息
|
CompletableFuture<Boolean> |
publishAsync(String topic,
MqMessage message)
异步发布消息
|
default org.noear.socketd.transport.stream.RequestStream |
send(MqMessage message,
String toName)
发送
|
org.noear.socketd.transport.stream.RequestStream |
send(MqMessage message,
String toName,
long timeout)
发送
|
default void |
subscribe(String topic,
MqConsumeHandler consumerHandler)
订阅主题
|
void |
subscribe(String topic,
String consumerGroup,
boolean autoAck,
MqConsumeHandler consumerHandler)
订阅主题
|
default void |
subscribe(String topic,
String consumerGroup,
MqConsumeHandler consumerHandler)
订阅主题
|
MqClient |
transactionCheckback(MqTransactionCheckback transactionCheckback)
事务回查
|
void |
unpublish(String topic,
String tid)
取消发布
|
CompletableFuture<Boolean> |
unpublishAsync(String topic,
String tid)
取消发布
|
default void |
unsubscribe(String topic)
取消订阅主题
|
void |
unsubscribe(String topic,
String consumerGroup)
取消订阅主题
|
String name()
MqClient connect() throws IOException
IOExceptionvoid disconnect()
throws IOException
IOExceptionMqClient config(org.noear.socketd.transport.client.ClientConfigHandler configHandler)
MqClient consumeExecutor(ExecutorService consumeExecutor)
MqClient autoAcknowledge(boolean auto)
auto - 自动(默认为 true)boolean autoAcknowledge()
CompletableFuture<String> call(String apiName, String apiToken, String topic, String consumerGroup) throws IOException
IOExceptionvoid subscribe(String topic, String consumerGroup, boolean autoAck, MqConsumeHandler consumerHandler) throws IOException
topic - 主题consumerGroup - 消费者组autoAck - 是否自动回执consumerHandler - 消费处理IOExceptiondefault void subscribe(String topic, String consumerGroup, MqConsumeHandler consumerHandler) throws IOException
topic - 主题consumerGroup - 消费者组consumerHandler - 消费处理IOExceptiondefault void subscribe(String topic, MqConsumeHandler consumerHandler) throws IOException
topic - 主题consumerHandler - 消费处理IOExceptionvoid unsubscribe(String topic, String consumerGroup) throws IOException
topic - 主题consumerGroup - 消费者组IOExceptiondefault void unsubscribe(String topic) throws IOException
topic - 主题IOExceptionvoid publish(String topic, MqMessage message) throws IOException
topic - 主题message - 消息IOExceptionCompletableFuture<Boolean> publishAsync(String topic, MqMessage 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 - 跟踪idIOExceptionvoid listen(MqConsumeHandler listenHandler)
listenHandler - 监听处理org.noear.socketd.transport.stream.RequestStream send(MqMessage message, String toName, long timeout) throws IOException
message - 消息toName - 发送目标名字timeout - 超时(单位毫秒)IOExceptiondefault org.noear.socketd.transport.stream.RequestStream send(MqMessage message, String toName) throws IOException
message - 消息toName - 发送目标名字IOExceptionMqClient transactionCheckback(MqTransactionCheckback transactionCheckback)
transactionCheckback - 事务回查处理MqTransaction newTransaction()
Copyright © 2024. All rights reserved.