在C ++和Java之间传播Oracle事务 [英] Propagation of Oracle Transactions Between C++ and Java

查看:135
本文介绍了在C ++和Java之间传播Oracle事务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个现有的C ++应用程序,我们将逐步用新的基于Java的系统取而代之。在我们完全重新实现Java中的所有内容之前,我们希望C ++和Java必须相互通信(RMI,SOAP,消息等等 - 我们还没有决定)。



<现在我的经理认为我们需要Java和C ++方参与同一个Oracle DB事务。这与通常的分布式事务问题有关,但不同于单个进程协调2个事务性资源,例如DB和消息队列。



I从性能和稳定性的角度来看,从跨进程传播事务是一个糟糕的想法,但我仍然会被要求提供解决方案。



我是熟悉XA事务并且我已经完成了JBoss事务管理器的一些工作,但是我的谷歌搜索在两个进程之间传播XA事务没有任何好处。



我们在Java端使用Spring,他们的文档明确声明他们没有提供任何有关事务传播的帮助。



我们不打算使用传统的Java EE服务器(例如:IBM Websphere),它可能支持传播(不是我可以找到任何明确的文档)。



任何关于解决方案的帮助或指针都非常重要ppreciated。

解决方案

Laurent Schneider博客上的一个示例,它使用Oracle内部的DBMS_XA包来允许多个会话在同一个事务中工作。因此,有可能让Java和C ++会话参与同一事务,而无需任何其他协调器。



或者,您可以考虑使用Workspace Manager。它最初设计用于支持极长时间运行的事务(即为拟议的开发操作大量空间数据)。从本质上讲,您可以创建一个工作区,在您的情况下,它大致相当于一个命名的事务。 Java和C ++代码都可以进入该工作空间(来自不同的会话),并且两者都可以在该工作空间中操作和提交数据。当事务完成后,您可以将工作区合并到LIVE工作区,这相当于在正常事务中执行提交。



另一方面,我我们非常同意您的初步评估,即从性能,稳定性,简单性和维护的角度来看,协调进程之间的事务很可能是个坏主意。另一方面,它可能是合法的业务需求,这取决于C ++代码将如何被淘汰(即,是否有可能以事务可以是Java或C ++的方式替换代码)


We have an existing C++ application that we are going to gradually replace with a new Java-based system. Until we have completely reimplemented everything in Java we expect the C++ and Java to have to communicate with each other (RMI, SOAP, messaging, etc - we haven't decided).

Now my manager thinks we'll need the Java and C++ sides to participate in the same Oracle DB transaction. This is related to, but different from the usual distrbuted transaction problem of having a single process co-ordinate 2 transactional resources, such as a DB and a message queue.

I think propagating a transaction across processes is a terrible idea from a performance and stability point-of-view, but I am still going to be asked for a solution.

I am familiar with XA transactions and I've done some work with the JBoss Transaction Manager, but my googling hasn't turned up anything good on propagating an XA transaction between 2 processes.

We are using Spring on the Java side and their documentation explicitly states they do not provide any help with transaction propagation.

We are not planning on using a traditional Java EE server (for example: IBM Websphere), which may have support for propagation (not that I can find any definitive documentation).

Any help or pointers on solutions is greatly appreciated.

解决方案

There is an example on Laurent Schneider's blog of using the DBMS_XA package inside Oracle to permit multiple sessions to work in the same transaction. So it would be possible to have Java and C++ sessions participating in the same transaction without needing any sort of additional coordinator.

Alternately, you might consider using Workspace Manager. That was originally designed to support extremely long-running transactions (i.e. manipulating lots of spatial data for a proposed development). Essentially, you can create a workspace, which in your case would be roughly equivalent to a named transaction. Both the Java and C++ code could enter that workspace (from separate sessions) and both could manipulate and commit data in that workspace. When the transaction was complete, you could then merge the workspace to the LIVE workspace, which is equivalent to doing a commit in a normal transaction.

On the other hand, I would strongly agree with your initial assessment that coordinating transactions between processes is very likely to be a bad idea from a performance, stability, simplicity, and maintenance standpoint. On the other hand, it may well be a legitimate business requirement depending on how the C++ code is going to be retired (i.e. whether it is possible to replace code in such a way that transactions can be either exclusively Java or exclusively C++)

这篇关于在C ++和Java之间传播Oracle事务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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