开发者

MDB : dynamic selector

开发者 https://www.devze.com 2023-03-23 10:12 出处:网络
I have several servers running the same code but each hand开发者_Python百科ling specific messages (they are spread by geographical area and must should treat all messages related to their area)

I have several servers running the same code but each hand开发者_Python百科ling 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.


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:

  1. Write a different 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.
  2. Put each openejb-jar.xml in a separate directory directly inside the EAR file.
  3. Deploy the EAR with externally supplied geronimo-application.xml referring to a particular configuration with <alt-dd> element:
<module>
   <ejb>your_MDB.jar</ejb>
   <alt-dd>config1/openejb-jar.xml</alt-dd>
</module>
0

精彩评论

暂无评论...
验证码 换一张
取 消