2

为了使持久性有意义,如果部署 MDB 的应用服务器与 JMS 提供程序(服务器)分离,那么如果应用服务器关闭并稍后重新启动,则可以向 MDB 发送它拥有的消息应用服务器关闭时错过了?

4

3 回答 3

2

但是,如果服务器从未接受过消息(因为它也关闭了),那么客户端就不会认为一切正常,因此不会有任何消息被神秘地遗漏。

更实际的是,持久性属性确实假设了多个远程客户端正在侦听的单个主题。如果您的设置是这样的,您已经在不同的远程服务器上为一个主题设置了多个侦听器,我想您不会问这个问题。因此,我假设您将 MDB 全部部署在单个服务器上。

在这种情况下,分离 JMS 提供程序可以提高您的健壮性,因为仅运行此提供程序的服务器可能具有较低的崩溃风险(更小的更专用的系统,尤其是没有您自己的代码 = 不太可能崩溃)并且可以用作缓冲区对于那些必须重新启动应用程序服务器的情况。另一方面,随着每台服务器的增加,其中至少有一个崩溃的可能性会增加,并且您在某处发生配置错误的可能性也会增加。这是你必须做出自己的权衡。

于 2012-11-01T09:06:40.133 回答
0

我会说是的。一种选择是独立部署 HornetQ:

http://docs.jboss.org/hornetq/2.2.5.Final/user-manual/en/html/architecture.html#d0e636

这样你就不需要部署一个功能齐全的 JBoss 服务器,通过减少你的主机规格来节省一些钱。HornetQ 在独立模式下的内存占用可能非常低。

如果拆分 jms 代理和 MDB 客户端不是一个选项,我曾经这样做的方式是在客户端中开发一个缓存来保存未发送的消息,这样如果服务器关闭,它就会存储消息,直到 JBoss 再次启动。

于 2011-08-02T13:39:16.943 回答
0

The durability property is more intended for those situations where the client thinks everything is okay since the server's topic has accepted the message, but then it can not actually be delivered to all intended recipients, since one or more of them were down.

But if the server never accepted the message (because it too was down) the client can not think everything is okay and so no messages will be mysteriously missed.

More practically though, the durability property indeed assumes a single topic to which multiple remote clients are listening. If your setup is such that you already had multiple listeners on different remote servers for a topic, I guess you wouldn't be asking this question. So I assume you have your MDB(s) all deployed on a single server.

In that case, separating the JMS provider could improve your robustness, as the server running just this provider might have a lower risk to crash (smaller more dedicated system, especially without your own code = less likely to crash) and could function as a buffer for those situations where you have to restart your application server. On the other hand, with each server you add the chance that at least one of them crashes increases and the possibility that you make a configuration error somewhere increases as well. This is a tradeoff you have to make your self.

于 2011-08-02T19:11:22.267 回答