本文整理了Java中org.apache.rocketmq.common.message.Message.getTransactionId()
方法的一些代码示例,展示了Message.getTransactionId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.getTransactionId()
方法的具体详情如下:
包路径:org.apache.rocketmq.common.message.Message
类名称:Message
方法名:getTransactionId
暂无
代码示例来源:origin: apache/rocketmq
@Override
public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
int value = transactionIndex.getAndIncrement();
int status = value % 3;
localTrans.put(msg.getTransactionId(), status);
return LocalTransactionState.UNKNOW;
}
代码示例来源:origin: javahongxi/whatsmars
@Override
public LocalTransactionState executeLocalTransaction(Message msg, Object arg) {
int value = transactionIndex.getAndIncrement();
int status = value % 3;
localTrans.put(msg.getTransactionId(), status);
// return UNKOWN is just for test
return LocalTransactionState.UNKNOW;
}
代码示例来源:origin: maihaoche/rocketmq-spring-boot-starter
public SendResult sendMessageInTransaction(Message msg, Object arg) throws MQException {
try {
SendResult sendResult = transactionProducer.sendMessageInTransaction(msg, arg);
if(sendResult.getSendStatus() != SendStatus.SEND_OK) {
log.error("事务消息发送失败,topic : {}, msgObj {}", msg.getTopic(), msg);
throw new MQException("事务消息发送失败,topic :" + msg.getTopic() + ", status :" + sendResult.getSendStatus());
}
log.info("发送事务消息成功,事务id: {}", msg.getTransactionId());
return sendResult;
} catch (Exception e) {
log.error("事务消息发送失败,topic : {}, msgObj {}", msg.getTopic(), msg);
throw new MQException("事务消息发送失败,topic :" + msg.getTopic() + ",e:" + e.getMessage());
}
}
代码示例来源:origin: org.apache.rocketmq/rocketmq-spring-boot
public static org.springframework.messaging.Message convertToSpringMessage(
org.apache.rocketmq.common.message.Message message) {
org.springframework.messaging.Message retMessage =
MessageBuilder.withPayload(message.getBody()).
setHeader(RocketMQHeaders.KEYS, message.getKeys()).
setHeader(RocketMQHeaders.TAGS, message.getTags()).
setHeader(RocketMQHeaders.TOPIC, message.getTopic()).
setHeader(RocketMQHeaders.FLAG, message.getFlag()).
setHeader(RocketMQHeaders.TRANSACTION_ID, message.getTransactionId()).
setHeader(RocketMQHeaders.PROPERTIES, message.getProperties()).
build();
return retMessage;
}
内容来源于网络,如有侵权,请联系作者删除!