简体   繁体   English

JBoss消息传递和XA事务:JMS消息丢失

[英]JBoss messaging and XA transactions: JMS messages are lost

I make some tests of distributed JMS and I am currently stuck with the following issue. 我对分布式JMS进行了一些测试,目前我遇到了以下问题。

I have two servers. 我有两台服务器。 The first one is JBoss 5.1 with JBoss Messaging 1.4.3, and the second one is JBoss 5.1 with two MDBs. 第一个是带有JBoss Messaging 1.4.3的JBoss 5.1,第二个是带有两个MDB的JBoss 5.1。 One MDB is routing messages from queue A to B. The other is doing the opposite - routing from B to A. So the sum of the messages on the queues A and B should be constant. 一个MDB将消息从队列A路由到B.另一个是相反的 - 从B到A的路由。因此队列A和B上的消息总和应该是常量。 And it is as long as I shut down the servers properly. 只要我正确关闭服务器就可以了。

But if I crash the process of one of the servers (using kill -9 ), I can observe message loss (not many but visible). 但是如果我崩溃其中一个服务器的进程(使用kill -9 ),我可以观察到消息丢失(不是很多但是可见)。 I don't understand why. 我不明白为什么。 It seems like it isn't using XA after all. 毕竟它似乎没有使用XA。

I tried HSQLDB and Oracle as a persistence on JBM server, but the effect is the same. 我尝试使用HSQLDB和Oracle作为JBM服务器上的持久性,但效果是一样的。

I use JmsXA as ConnectionFactory . 我使用JmsXA作为ConnectionFactory

Any ideas what is going on? 有什么想法发生了什么?

As I understand your question, you are attempting to coordinate XA transactions across multiple servers (JVMs) which requires that your servers be configured with JTS, and JBoss servers are typically configured for JTA only by default. 据我所知,您正在尝试协调跨多个服务器(JVM)的XA事务,这需要您的服务器配置JTS,并且JBoss服务器通常仅默认配置为JTA。 Just to make sure we're talking the same versions here, when I eyeball my console log on starting JBoss AS 5.1, it reports the following JBossTS version: 为了确保我们在这里谈论相同的版本,当我看到我的控制台登录启动JBoss AS 5.1时,它会报告以下JBossTS版本:

08:46:59,678 INFO [TransactionManagerService] JBossTS Transaction Service ( JTA version - tag: JBOSSTS_4_6_1_GA_CP07 ) 08:46:59,678 INFO [TransactionManagerService] JBossTS事务服务( JTA版本 - 标签: JBOSSTS_4_6_1_GA_CP07

Assuming that's in the same general vicinity of the version you are running, you should review all the docs contained in the JBossTS documentation available in this download: jbossts-full-4.6.1.GA.zip . 假设它与您运行的版本位于相同的附近,您应该查看此下载中提供的JBossTS文档中包含的所有文档: jbossts-full-4.6.1.GA.zip Specifically, look at the PDF titled JBossTS 4.6.0 Server Integration Guide , which amongst other things defines the different personalities of the Arjuna Transaction Manager as: 具体来说,请查看标题为JBossTS 4.6.0服务器集成指南的PDF,其中包括将Arjuna事务管理器的不同个性定义为:

JBossTS consists of a transaction engine, ArjunaCore, with multiple 'personalities' layered around it. JBossTS由一个事务引擎ArjunaCore组成,周围有多个“个性”。

JBossTS JTA provides a JTA 1.1 compliant transaction manager for Java Enterprise Edition applications. JBossTS JTA为Java Enterprise Edition应用程序提供了一个符合JTA 1.1的事务管理器。 Transaction scope is limited to a single JVM. 事务范围仅限于单个JVM。 This is suitable for use in applications that do not require transaction context propagation on business method calls between JVMs. 这适用于在JVM之间的业务方法调用上不需要事务上下文传播的应用程序。 For example, deployments in which only a single application server instance is used or where several such instances are used for load balancing only, with no transactional communication between them. 例如,仅使用单个应用程序服务器实例的部署或仅使用多个此类实例进行负载平衡的部署,它们之间没有事务通信。

JBossTS JTS provides CORBA based distributed transaction management that may be driven either though JTS native API or though the JTA interfaces. JBossTS JTS提供基于CORBA的分布式事务管理,可以通过JTS本机API或通过JTA接口来驱动。 It is suitable for situations in which transaction context must span multiple JVMs, such as a Java EE application deployed on an application server cluster, or where interoperability is required for transactional business method calls between heterogeneous Java application servers, or Java and legacy applications written in another language with CORBA bindings. 它适用于事务上下文必须跨越多个JVM的情况,例如部署在应用程序服务器集群上的Java EE应用程序,或者异构Java应用程序服务器之间的事务性业务方法调用,或者编写的Java和遗留应用程序需要互操作性的情况。另一种使用CORBA绑定的语言。

and also asserts: 并断言:

For transaction use cases involving multiple JVMs, JBossTS JTS is required. 对于涉及多个JVM的事务用例,需要JBossTS JTS。

Also take a look at this proviso regarding JBoss Messaging XA Configuration . 另请参阅有关JBoss Messaging XA配置的此附带条款。 Make sure to follow the configuration directions outlined in the JTA docs in the section titled JBoss Messaging XA Recovery Configuration . 确保遵循标题为JBoss Messaging XA Recovery Configuration的JTA文档中概述的配置说明。

That document provides a decent summary of what you need to do, but the details of installation and configuration of a standalone JBossTS instance are in the document titled JBoss Transactions 4.6.0 Installation Guide , while the replacement of the AS 5.1 JTA transaction services with JTS services is outlined in a document in the AS 5.1 distro itself in <jboss-home>\\docs\\examples\\transactions\\README.txt 该文档提供了您需要做的事情的合理摘要,但是独立JBossTS实例的安装和配置的详细信息在标题为JBoss Transactions 4.6.0安装指南的文档中,而用JTS替换AS 5.1 JTA事务服务在<jboss-home> \\ docs \\ examples \\ transactions \\ README.txt中的AS 5.1发行版本的文档中概述了服务


Having said all that, if there is any way you can implement your solution using one server, I suspect you will find that the preferable way to go. 说了这么多,如果有任何方法可以使用一台服务器实现您的解决方案,我怀疑您会发现最好的方法。

Cheers. 干杯。

//Nicholas //尼古拉斯

PS Once you have JTS correctly installed, the console log will display something like this on startup: PS正确安装JTS后,控制台日志将在启动时显示如下内容:

09:41:03,558 INFO [TransactionManagerService] JBossTS Transaction Service (**JTS version - tag:JBOSSTS_4_6_1_GA_CP07)** 09:41:03,558 INFO [TransactionManagerService] JBossTS交易服务(** JTS版本 - 标签:JBOSSTS_4_6_1_GA_CP07)**

After some research(streched in time) I found out that XA recovery is not properly configured and the messages are not reachable because global transaction is never finished. 经过一些研究(及时拉伸)后,我发现未正确配置XA恢复,并且无法访问消息,因为全局事务永远不会完成。 It was pointed in Nicholas answer, so thanks a lot. 尼古拉斯回答了这一点,所以非常感谢。 http://docs.jboss.org/jbossmessaging/docs/userguide-1.4.0.SP3/html_single/index.html#recovery http://docs.jboss.org/jbossmessaging/docs/userguide-1.4.0.SP3/html_single/index.html#recovery

A XA enabled Connection Factory alone will not guarantee transactionality. 仅启用XA的连接工厂不保证事务性。 Both sender and receiver should declare that they are using transactions, shown in this Java EE 6 document about Container-managed transactions docs . 发送方和接收方都应声明它们正在使用事务,如本Java EE 6文档中所示,该文档涉及容器管理的事务文档

Also, make sure your messages are sent persistent. 此外,请确保您的邮件是持久发送的。 I would recommend some trace/debug logging of the transaction manager to make sure your transactions are committed correctly when they should. 我建议事务管理器的一些跟踪/调试日志记录,以确保您的事务在应该的时候正确提交。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM