public class MqClientDefault extends Object implements MqClientInternal
| 限定符和类型 | 字段和说明 |
|---|---|
protected boolean |
autoAcknowledge |
protected ExecutorService |
consumeExecutor |
protected MqConsumeHandler |
listenHandler |
protected MqTransactionCheckback |
transactionCheckback |
| 构造器和说明 |
|---|
MqClientDefault(String[] urls) |
MqClientDefault(String[] urls,
MqClientListener clientListener) |
| 限定符和类型 | 方法和说明 |
|---|---|
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()
断开连接
|
protected String |
diversionOrNull(String fullTopic,
MqMessage message) |
protected MqSubscription |
getSubscription(String fullTopic,
String consumerGroup) |
protected Collection<MqSubscription> |
getSubscriptionAll() |
protected int |
getSubscriptionSize() |
void |
listen(MqConsumeHandler listenHandler)
监听
|
String |
name()
名字(即,默认消费者组)
|
MqClient |
nameAs(String name)
名字取为(即,默认消费者组)
|
String |
namespace()
命名空间
|
MqClient |
namespaceAs(String namespace)
命名空间
|
MqTransaction |
newTransaction()
创建事务
|
void |
publish(String topic,
MqMessage message)
同步发布消息
|
void |
publish2(String tmid,
List<String> keyAry,
boolean isRollback)
发布二次提交
|
CompletableFuture<Boolean> |
publishAsync(String topic,
MqMessage message)
发布消息
|
void |
reply(org.noear.socketd.transport.core.Session session,
org.noear.socketd.transport.core.Message from,
MqMessageReceivedImpl message,
boolean isOk,
org.noear.socketd.transport.core.Entity entity)
消费答复
|
org.noear.socketd.transport.stream.RequestStream |
send(MqMessage message,
String toName,
long timeout)
发送
|
void |
subscribe(String topic,
String consumerGroup,
boolean autoAck,
MqConsumeHandler consumerHandler)
订阅主题
|
MqClient |
transactionCheckback(MqTransactionCheckback transactionCheckback)
事务回查
|
void |
unpublish(String topic,
String key)
取消发布
|
CompletableFuture<Boolean> |
unpublishAsync(String topic,
String key)
取消发布
|
void |
unsubscribe(String topic,
String consumerGroup)
取消订阅主题
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsend, subscribe, subscribe, unsubscribeprotected MqTransactionCheckback transactionCheckback
protected MqConsumeHandler listenHandler
protected ExecutorService consumeExecutor
protected boolean autoAcknowledge
public MqClientDefault(String[] urls)
public MqClientDefault(String[] urls, MqClientListener clientListener)
public MqClient namespaceAs(String namespace)
MqClientnamespaceAs 在接口中 MqClientpublic MqClient connect() throws IOException
MqClientconnect 在接口中 MqClientIOExceptionpublic void disconnect()
throws IOException
MqClientdisconnect 在接口中 MqClientIOExceptionpublic MqClient config(org.noear.socketd.transport.client.ClientConfigHandler configHandler)
MqClientpublic MqClient consumeExecutor(ExecutorService consumeExecutor)
MqClientconsumeExecutor 在接口中 MqClientpublic MqClient autoAcknowledge(boolean auto)
autoAcknowledge 在接口中 MqClientauto - 自动(默认为 true)public boolean autoAcknowledge()
MqClientautoAcknowledge 在接口中 MqClientpublic CompletableFuture<String> call(String apiName, String apiToken, String topic, String consumerGroup) throws IOException
MqClientcall 在接口中 MqClientIOExceptionpublic void subscribe(String topic, String consumerGroup, boolean autoAck, MqConsumeHandler consumerHandler) throws IOException
subscribe 在接口中 MqClienttopic - 主题consumerGroup - 消费者组consumerHandler - 消费处理autoAck - 是否自动回执IOExceptionpublic void unsubscribe(String topic, String consumerGroup) throws IOException
MqClientunsubscribe 在接口中 MqClienttopic - 主题consumerGroup - 消费者组IOExceptionpublic void publish(String topic, MqMessage message) throws IOException
MqClientpublish 在接口中 MqClienttopic - 主题message - 消息IOExceptionpublic CompletableFuture<Boolean> publishAsync(String topic, MqMessage message) throws IOException
publishAsync 在接口中 MqClienttopic - 主题message - 消息IOExceptionpublic void unpublish(String topic, String key) throws IOException
MqClientunpublish 在接口中 MqClienttopic - 主题key - 消息主键IOExceptionpublic CompletableFuture<Boolean> unpublishAsync(String topic, String key) throws IOException
MqClientunpublishAsync 在接口中 MqClienttopic - 主题key - 消息主键IOExceptionpublic void listen(MqConsumeHandler listenHandler)
MqClientpublic org.noear.socketd.transport.stream.RequestStream send(MqMessage message, String toName, long timeout) throws IOException
MqClientsend 在接口中 MqClientmessage - 消息toName - 发送目标名字timeout - 超时(单位毫秒)IOExceptionpublic MqClient transactionCheckback(MqTransactionCheckback transactionCheckback)
transactionCheckback 在接口中 MqClienttransactionCheckback - 事务回查处理public MqTransaction newTransaction()
newTransaction 在接口中 MqClientpublic void publish2(String tmid, List<String> keyAry, boolean isRollback) throws IOException
publish2 在接口中 MqClientInternaltmid - 事务管理idkeyAry - 消息主键集合isRollback - 是否回滚IOExceptionpublic void reply(org.noear.socketd.transport.core.Session session,
org.noear.socketd.transport.core.Message from,
MqMessageReceivedImpl message,
boolean isOk,
org.noear.socketd.transport.core.Entity entity)
throws IOException
reply 在接口中 MqClientInternalsession - 会话from - 来源消息message - 收到的消息isOk - 回执entity - 实体IOExceptionprotected MqSubscription getSubscription(String fullTopic, String consumerGroup)
protected Collection<MqSubscription> getSubscriptionAll()
protected int getSubscriptionSize()
Copyright © 2024. All rights reserved.