Skip to content

Commit 9bf2af3

Browse files
committed
feat: TxMsgKit 添加没有事务的消息发送方法
1 parent 15a81e6 commit 9bf2af3

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

  • common/plugin/mq/src/main/java/com/github/cadecode/uniboot/common/plugin/mq/util

common/plugin/mq/src/main/java/com/github/cadecode/uniboot/common/plugin/mq/util/TxMsgKit.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,23 @@ public class TxMsgKit {
2525

2626
private final AbstractTxMsgHandler txMsgTaskHandler;
2727

28+
/**
29+
* 发送事务消息
30+
* 需要事务
31+
*
32+
* @param txMsg 事务消息
33+
*/
2834
public void sendTx(BaseTxMsg txMsg) {
2935
sendTx(txMsg, null);
3036
}
3137

38+
/**
39+
* 发送事务消息
40+
* 需要事务
41+
*
42+
* @param txMsg 事务消息
43+
* @param msgOption 消息配置
44+
*/
3245
public void sendTx(BaseTxMsg txMsg, MsgOption msgOption) {
3346
MsgOption currOption = txMsgProperties.createMsgOption(msgOption);
3447
txMsgTaskHandler.checkBeforeSend(txMsg, currOption);
@@ -54,4 +67,18 @@ public void afterCompletion(int status) {
5467
}
5568
});
5669
}
70+
71+
/**
72+
* 发送事务消息
73+
* 不检查是否存在事务
74+
*
75+
* @param txMsg 事务消息
76+
* @param msgOption 消息配置
77+
*/
78+
public void sendWithoutTx(BaseTxMsg txMsg, MsgOption msgOption) {
79+
MsgOption currOption = txMsgProperties.createMsgOption(msgOption);
80+
txMsgTaskHandler.checkBeforeSend(txMsg, currOption);
81+
txMsgTaskHandler.saveBeforeRegister(txMsg, currOption);
82+
txMsgTaskHandler.sendCommitted(txMsg, currOption);
83+
}
5784
}

0 commit comments

Comments
 (0)