Spring 与 JMS 和 DB 的集成和事务 [英] Spring Integration and Transaction with JMS and DB

查看:42
本文介绍了Spring 与 JMS 和 DB 的集成和事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 spring 集成通过 JMS 将信息发送到其他系统.目前在系统中我们有以下步骤:

I am using spring integration to send information to other systems via JMS. Currently in the system we have the following steps:

  1. 更新 oracle 数据库中的状态以显示已批准"
  2. 向外部系统发送 JMS 消息.
  3. 提交

一个.那么如果在 (2) 处发送 JMS 失败怎么办?我们如何知道并回滚数据库?湾如果 (3) 处的提交失败了怎么办?我们如何回滚?

a. So what if sending of JMS at (2) fails? How can we know and roll back DB? b. What if commit at (3) fails? How do we roll back?

代码或示例配置示例会有所帮助.

Code or sample config example would be helpful.

谢谢总经理

推荐答案

您可以使用 Spring 事务同步(由 Spring Integration 支持)同步两个事务;这提供了 Best Effort 1PC,如 Dr.Dave Syer 的 Javaworld 文章.如果需要绝对保证,可能需要使用XA.

You can use Spring Transaction Synchronization (supported by Spring Integration) to synchronize the two transactions; this provides Best Effort 1PC as discussed in Dr. Dave Syer's Javaworld Article. If you need absolute guarantee, you may need to use XA.

这篇关于Spring 与 JMS 和 DB 的集成和事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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