JMS回滚 [英] JMS rollback

查看:133
本文介绍了JMS回滚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个涉及发送JMS消息的过程. 该过程是交易的一部分. 如果事务的后半部分失败,即发送消息之前的部分之后,则我需要取消该消息. 我曾经想到过要以某种方式在消息上设置它一定时间内不被接收,如果我需要回滚,那么我可以去取消消息. 不知道消息传递,不知道这个想法是否可行. 还是有更好的主意? 谢谢

I have a process which involves sending a JMS message. The process is part of a transaction. If a later part of the transaction fails, a part that is after a previous part that sent the message, I need to cancel the message. One thought I had was to somehow set on the message that it is not to be picked up for a certain amount of time, and if I need to rollback, then I could go and cancel the message. Not knowing messaging, I do not know if the idea is possible. Or, is there a better idea? Thanks

推荐答案

您可以一起使用JMS和JTA(Java事务API)-

You can use JMS and JTA (Java Transaction API) together - see here. When doing that, the sending of a JMS message or the consumption of a received message actually happens atomically as part of the transaction commit.

这是什么意思?如果事务失败或回滚,则已发送"消息不会消失,也不会真正消耗任何已接收"消息.全部由您的JMS和JTA提供者为您处理.

What does this mean? If the transaction fails or is rolled back, the "sent" message doesn't go out and any "received" messages aren't really consumed. All handled for you by your JMS and JTA provider.

您需要使用支持JTA的JMS实现.听起来您已经在使用事务,因此可能需要做一些配置才能使其实现(大力挥手……).

You need to be using a JMS implementation that supports JTA. Sounds like you're already using transactions, so it might be a matter of doing some configuration to make it happen (waving hand vigorously...).

我有使用此软件的经验(带有BEA WebLogic Integration的BEA WebLogic 7).按照广告宣传进行工作-除非交易成功完成,否则外界"不会看到我尝试过的JMS东西的影响.

I've had experience using this (BEA WebLogic 7 w/ BEA WebLogic Integration). Worked as advertised -- "the outside world" saw no impact of JMS stuff I tried unless the transaction committed successfully.

这篇关于JMS回滚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆