Outline for running JMS cluster demonstration via GlassFish Admininstration UI
1. Start the domain: asadmin start-domain (window start menu, or use your favorite command shell)
2. Create the cluster and instances
In a browser, open http://localhost:4848/common/index.jsf (Sorry, don't try this with Firefox 4)
Click the cluster icon in the left menu area
Click the New Cluster button
Select the Instances tab
Create three instances: instance1, instance2, and instance3
(This will create three instances -- with JMS ports at 27676, 27677, 27678)
Navigate back to the top level Cluster icon (in left menu)
Check the box for cluster1, then click Start
You may need to wait a bit, but after this completes, you should see all three instances in the running state
3. Create the JMS Resources
Click the JMS Resources item (left menu)
Select Connection Factories
Create a new connection factory: outboundQueueFactory, type: javax.jms.QConnectionFactory. Add Cluster1 as a target, then click OK.
Create two new Queue destionations in the JMS Destinations section:
enter outboundQueue in both the JNDI name and as the Physical Destination name. Select: javax.jms.queue as the type. Add Cluster1 to the target list. Then click OK.
do the same, but name it inboundQueue
(Note case is important for all of these.)
(If you browse around, you'll see that no resources are created yet because these are, by default, autocreated destinations)
4. Deploy the MDB
Click Applications
Click Deploy and use the file browser to select the simplemdb.ear package you created for the single instance demo, we did earlier
Add Cluster1 as a target resource
Then click OK at the top
(Now, if you check the JMS monitor resources, you'll notice that inboundQueue will be created and it should have three receivers listening on it.)
5. Send and receive some messages
If you are using Netbeans, you will need to modify the JMS port, depending upon which instance you want to use. Check the instance configuration to ensure
the above ports are correct. In Netbeans, select the Receiver project, then, from the Run menu, select: Set Project Configuration -> Customize.
In the VM Options: entry, add "-DimqBrokerHostPort=27678" (or whatever port you found when checking the configuration.)
Run the receiver by clicking on the Run button in the top menu-bar.
Next, set the JMS port for the Sender project, using the sam method -- choose an appropriate port number (e.g. 27676).
Run the Sender by clicking on the Run button.
In the Receiver output window, you should see messages being consumed.
If not, try troubleshooting your setup.
6. Clean up
To undeploy the application, in the UI -- click Applications, check the box for simpleMDB and click "Undeploy"
in the JMSResources, select Destination Resources -- check both inbound and outbound queue destinations and click Delete
Still in JMS Resources, select Connection Factories -- check the outboundConnectionFactor and click Delete
Navigate back up to the cluster
Check the box next to cluster1 and click Stop. Verify that all the instances now show stopped status
Click on cluster1, then view the Instances tab
Click the boxes next to each instance, then click Delete.
Navigate back to the top Clusters
Check the box next to cluster1 and click on Delete
Stop the domain, using the analog to the way you started it (command line, start menu, etc.)