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:
- 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. - Put each
openejb-jar.xml
in a separate directory directly inside the EAR file. - 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>
精彩评论