MDB:动态选择器
我有几个服务器运行相同的代码,但每个服务器都处理特定的消息(它们按地理区域传播,并且必须处理与其区域相关的所有消息)
我认为使用单个队列和消息选择器来过滤不同的消息。
问题是:如何编写 Java 代码和部署计划,以便根据配置文件、应用程序服务器的配置(Geronimo 2.2)动态配置选择器。
目标是在所有服务器上部署相同的 EAR。
谢谢。
I have several servers running the same code but each handling specific messages (they are spread by geographical area and must should treat all messages related to their area)
I thought to use a single queue and a message selector to filter the different message.
The question is: how to write Java code and deployment plan so that the selector is configured dynamically, based on a config file, the config of application server ( Geronimo 2.2)
The goal is to have the same EAR deployed on all servers.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对于您想要实现的目标,Java 代码不需要不同,而是部署计划应该从一台服务器更改为另一台服务器。
要在所有服务器上部署相同的 EAR,我会这样处理:
openejb-jar.xml
— 每个 MDB 配置都具有相同的 MDB (已定义
,但具有不同的消息选择器。openejb-jar.xml
直接放在 EAR 文件内的单独目录中。geronimo-application.xml
来部署 EAR,该geronimo-application.xml
引用带有
元素的特定配置:For what you want to achieve, Java code does not need to be different, it's the deployment plan that should change from one server to the other.
To have the same EAR deployed on all servers, I'd approach it like this:
openejb-jar.xml
for every MDB configuration you want — each would have the same MDB (<enterprise-beans><message-driven>
defined, but with different message selectors.openejb-jar.xml
in a separate directory directly inside the EAR file.geronimo-application.xml
referring to a particular configuration with<alt-dd>
element: