gpt4 book ai didi

java - 在单个事务中发送多个 jms 消息

转载 作者:行者123 更新时间:2023-12-02 11:27:09 25 4
gpt4 key购买 nike

而不是在事务中发送单个消息:

jmsTemplate.convertAndSend(message);

How can I send multiple jms messages in a single transaction?

Is there an example I can loot at?

最佳答案

在调用模板之前启动事务

@Transactional
public void doSends() {
template.convertAndSend(...)
...
template.convertAndSend(...)
}

当方法退出时事务提交。请参阅有关事务的 Spring 文档。

或者,使用模板的 execute() 方法之一并在回调中执行发送。

关于java - 在单个事务中发送多个 jms 消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49537875/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com