发帖    主题    评论    推荐    标签    作者    订阅    查搜    注册   登陆   关注
 
面向对象 设计模式 领域驱动设计 企业架构 框架 开发教程 微服务 大数据 扩展性 并发编程 事件驱动 分布式 SOA
1 2 3 4 ... 10 下一页 Go 10

dx帮忙::跨异构平台的分布式事务处理.

2003-06-07 14:58
赞助商链接

小妹初来贵地,还希望各位dx多多指教!
现有一个问题想请教大家:
我的应用服务器WSAD5.0和jboss4.0.0
DBMS:oracle9i和db2.
现在的想实现的功能是websphere中调用一个ejb,实现从oracle中取出100$,然后调用jboss上部署的一个

ejb,实现把100$放到db2中.
这个过程不用RMI/IIOP来做,而是想通过一个分布式事务处理,两阶段提交来完成.
而导师让我用基于jca的理论来做一个适配器来实现.也就是这个适配器要能够实现分布式事务处理.
jboss的专家曾经建议我要在jboss中添加一些jboss的远程框架的mbean,然后实现分布式调用,他的建议如

下:
To propagate the websphere transaction to jboss, you will need to write your own transaction manager

service mbean that provides the websphere transaction manager instead of creating a jboss

transaction manager. You will need to make sure your mbean is installed before you do any jndi

lookups of jboss ejbs. From the client side jboss framework installed when you look up an ejb in jndi,

the TransactionInterceptor and the DTXAResourceInterceptor need to get the transaction manager

from an mbean. For normal clients this mbean is the jboss TransactionManagerService mbean.You

need to make sure there is an mbean server running in websphere, either one that IBM provides or by

using the JBoss one set up by the
org.jboss.system.client.Client class, and install a different
TransactionManagerService mbean that supplies the ibm transaction
manager.Study how remote ejb invocation works. Basically the proxy constructs an Invocation object

which has various context information added to it, and then is sent to the server. There are actually 2

styles of Invocation object: the ejb Invocation gets put into a remoting InvocationRequest object. Your

adapter has to do the same thing. You need to add transaction information and security information.

Look at what the TransactionInterceptor and DTXAResourceInterceptor do, along
with the EjbToRemotingAdapter.
但是我jca开发和jmx,和跨平台分布式事务处理方面没有什么经验,所以请各位dx给小妹出出主意,时间很紧迫.您如果有相似的经验或者是在这方面有些经验,还望不吝赐教!

.谢谢啦!!

2003-06-07 20:37

你要详细分析一下你的应用,Java的东西太多,不能搞太复杂。

我简单说一下,你的应用属于有状态的应用,需要在某地保存一下取出的$100,是美金?这就是有状态。

有状态解决方案有多个:
1. cookie解决,这个方案的好处是J2EE平台可以多个,他们都认识cookie,这是theServerSide.com采取的一个办法
2. Http session, 在分布式环境中,你可以考虑使用同种WEB容器,然后再分别调用不同的EJB容器.
3. statefull session bean,这适合同种EJB容器,不太适合你。

还有可以采取持久化persistence方案,这其中又有多种方案可以选择。

还有JMS,使用JMS来传送的数据,在不同平台间是可以的。

如果你想把架构搞得好看一点,JMS是推荐,如果你想迅速解决问题:
cookie和Http session值得一试验。

至于使用JCA,我个人认为对于你这个应用是大炮轰蚊子,如果你有一套EAI,花精力去做JCA是值得,否则,象这样深入平台的工作少做,因为你以前是在用J2EE平台容器(就是用也够麻烦的),你现在则要去学会平台容器的制造原理(头能不大吗?)

2003-06-08 11:25

Hi Dx,
You have picked a very interesting topic, though I can't see much value of it in real world and I don't have an answer for it, but it's good for brain exercise.
I think the key to your problem is XA, you need a single, distributed transaction across heterogenous systems. first let's take a look how you do the same action in a single/homogenous system.
you need call two ejbs from client, ejb does not need to be stateful but they must be in same transaction context. use UserTransaction and controlled it from client, that's no brainer. agree?
Now you want the second ejb lives in different system, the transaction manager from second one defintely need be attached or delegate control to first(primary) one. The suggestion you got from that expert basically is let jboss become another managed resource of websphere, so you pass the transaction context in second ejb call become recognized as it's still managed by same transaction manager.

Communicate with MBean remotely thru RMI is trivial once you figure out how to write that mbean, I believe you just have to dig into the websphere integration doc as any vendor who want to integrated with it would do the same thing. e.g Sonic MQ to websphere.

JCA maybe a wrong term here as it already carry a well known meaning, but you do need a implementation in similar pattern to work with another external resource, except it's being managed instead of managing position.

Now go back to the original point of usefulness, I never seen people want to get into trouble of scenario that you are pursuing, ( it's nice to stay in school ;-) )I do see people need to contact another app server from one server, actually I have done transaction routing myself but that's more like a nested/chain mode transaction usage, think about calling third party jms from ejb is a case as well.

Even you manage to make the simply case work as wanted,what happen when you do more things? let's assume you need to send a message(of course, within same tran), thought tran context maybe propogated thru threadlocal, but how can you sure the connection you get from JMS will be associated with that "remote" transaction manager? it may have problem even with XA jdbc connection, of course, this whole depends on jboss implementation.

You are using jboss 4 ? good luck. recently I can't resist the temptation to try out joss3.21, guess what, my topas server broken in many places, it took me almost a half day to figure out the places that's not compatible.

Brain machine is slowing down, so stop here.

$0.02
-Jevang

2003-06-09 09:00

谢谢二位仁兄的指教:
说实话,我现在还是一名学生,在公司实习,因为实习期要到了,而这个困扰我的问题还没有得到解决.或者像您说的,现在还没有一个清晰的思路:(
看来用JCA是不必要了,通过查资料,我也是这么认为,可是导师的意思是让我用jca原理做一个adapter,实现连接.
如果不用jca的话,那像您说的用jms应该如何来做?如何保证数据的一致和正确性呢?也是进行二阶段提交吗?那还要不要用到Mbean?
能提供一下这方面的资料或者例子吗?在线等待!
谢谢!

2003-06-09 09:22

JMS is the not solution to your problem, it's simply a reliable way to convey data, in your case a simple ejb call will do the same thing. If I understand you correctly, you need a 2pc on top of was and jboss. you can deliver a msg in transaction mode but the jms server in jboss still use its own TX manager.

10Go 1 2 3 4 ... 10 下一页

赞助商链接

赞助商链接

返回顶部

移动版 关于本站 使用帮助 联系管理员 最佳分辨率1366x768
OpenSource JIVEJDON Powered by JdonFramework Code © 2002-20 jdon.com