Our system (EJB2.1) is deployed in a clustered environment (WAS Network Deployment 6.1), as the attached image illustrated:
1. Same ear file is deployed to two nodes which is on different physical machine.
2. The web server distribute the incoming HTTP request to different node.
3. For every node, the war file and EJB are within one JVM and web layer access EJB via local interfaces.
The requirement is that the servlet needs to handle the file uploading request, write the file into some local temp directory, then send a message to MDB, MDB in turn process the file asynchronously. Obviously for this case the message procuded by the servlet in one Node should only be consumed by the MDB in same node, coz the MDB in the other node will not be able to find the file if it consumes the message.
To achieve this, I'm thing creating JMS queue with different name in different nodes. WAS ND 6.1 does allow create queue at server level rather than cluster level so this should be OK. And for the JMS producer it's not a problem either as we can make the queue JNDI name as a parameter and set to different values in different node. However I don't know how to configure the deployment descriptor for this case. Can I just specify a logic name of the destination in the deployment descriptor, and then on different WAS node maps the same logic name to different queue name?
I'm going to give this a try but it will take a while to setup a WAS network deployment environment. If anybody has experience on this, or have better idea to achieve this please let me know. Thank you.
In WebSphere 6.1 the queue connection factory, queue and activation spec can all be configured at server level rather than cluster level, and the jdni names can all be same. I just created a simple servlet (as JMS producer) + a MDB (as the JMS consumer) and tested it in a WebSphere network deployment environment, and everything works as expeted, i.e. the JMS producer and consumer will only access the server-scope JMS queue. If I stop the messaging engine in one server, the messages in the queue of the server will be hold but not consumed by the MDB on the other server.