本文整理汇总了Java中org.apache.rocketmq.common.message.MessageClientIDSetter类的典型用法代码示例。如果您正苦于以下问题:Java MessageClientIDSetter类的具体用法?Java MessageClientIDSetter怎么用?Java MessageClientIDSetter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MessageClientIDSetter类属于org.apache.rocketmq.common.message包,在下文中一共展示了MessageClientIDSetter类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: batch
import org.apache.rocketmq.common.message.MessageClientIDSetter; //导入依赖的package包/类
private MessageBatch batch(Collection<Message> msgs) throws MQClientException {
MessageBatch msgBatch;
try {
msgBatch = MessageBatch.generateFromList(msgs);
for (Message message : msgBatch) {
Validators.checkMessage(message, this);
MessageClientIDSetter.setUniqID(message);
}
msgBatch.setBody(msgBatch.encode());
} catch (Exception e) {
throw new MQClientException("Failed to initiate the MessageBatch", e);
}
return msgBatch;
}
示例2: queryMessageByUniqKey
import org.apache.rocketmq.common.message.MessageClientIDSetter; //导入依赖的package包/类
public MessageExt queryMessageByUniqKey(String topic, String uniqKey) throws InterruptedException, MQClientException {
QueryResult qr = this.queryMessage(topic, uniqKey, 32,
MessageClientIDSetter.getNearlyTimeFromID(uniqKey).getTime() - 1000, Long.MAX_VALUE, true);
if (qr != null && qr.getMessageList() != null && qr.getMessageList().size() > 0) {
return qr.getMessageList().get(0);
} else {
return null;
}
}
示例3: queryMessageByUniqKey
import org.apache.rocketmq.common.message.MessageClientIDSetter; //导入依赖的package包/类
public MessageExt queryMessageByUniqKey(String topic,
String uniqKey) throws InterruptedException, MQClientException {
QueryResult qr = this.queryMessage(topic, uniqKey, 32,
MessageClientIDSetter.getNearlyTimeFromID(uniqKey).getTime() - 1000, Long.MAX_VALUE, true);
if (qr != null && qr.getMessageList() != null && qr.getMessageList().size() > 0) {
return qr.getMessageList().get(0);
} else {
return null;
}
}