JMS Tutorial-Configuring Open JMS

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.

cd %OPENJMS_HOME%\bin

startup

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.

1)spice-jndikit-1.2.jar

2)openjms-tools-0.7.7-beta-1.jar

3)openjms-net-0.7.7-beta-1.jar

4)openjms-common-0.7.7-beta-1.jar

5)openjms-0.7.7-beta-1.jar

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

See also:

JNDI Tutorial

JMS Tutorial

JMS example

Sending ObjectMessage in JMS

 Messaging Domains

Point to Point Messaging domain in JMS

Publish/Subscribe Messaging domain JMS

Message consumption

Synchronous message consumption in JMS

Asynchronous message consumption in JMS