In the previous chapter we discussed the fundamental concepts of JMS.We discussed the various messaging domains also. The coming chapters will be discussing programming samples. Before looking into the examples , we need to set up the development environment for running the examples.Ase we discussed earlier there should be one JMS Provider for using the JMS API in our applications. Application servers are bundled with JMS Providers.For example JBoss Application servers are bundled with either JBossMQ or HornetQ.
In this tutorial we are using OpenJMS as service provider.
Before configuring OpenJMS , if we should have JDK and Eclipse.Java EE can be downloaded from here. Eclipse IDE can be downloaded from here.
Configuring Open JMS
Step1.Download OpenJMS from the OpenJMS page.
Step2.Extract the archive to some folder.
Step3. Create environment variable OPENJMS_HOME . In my machine, I extracted the openjms-0.7.7-beta-1.zip to C drive. So my OPENJMS_HOME is C:\openjms-0.7.7-beta-1.
Step4. Ensure that the JAVA_HOME environment variable is set properly. In my machine it is C:\Program Files\Java\jdk1.7.0\jre.
Step5.Now the Open JMS is ready in our machine.Now we need to start it . For that run the command prompt(cmd). Then execute these commands.
If everything is fine a window will be opened . Which contains the ports for accepting connections.
So the OpenJMS server is started.
Step 6. Find the existing administered objects.ConnectionFactories and Destinations are administered objects.The pre-configured administered objects can be found in the openjms.xml file in the config directory of OPENJMS_HOME.We will be using queue1,topic1,ConnectionFactory etc in our coming examples. Administered objects can be accessed by JNDIlook up.
Step6.Open eclipse workspace and start a dynamic web project.
Step7. Copy the following jar files from OPENJMS_HOME/lib. And paste them in WebContent/WEB-INF/lib of our newly created project.
Now the setup is ready.We can do our developments in src directory of our newly created project.
If we need to shutdown the openJms ant any time simply use shutdown script from %OPENJMS_HOME%/bin
Point to Point Messaging domain in JMS
Publish/Subscribe Messaging domain JMS
Synchronous message consumption in JMS