Home > Documentation > Developing > Tutorials > Developing Web applications > Accessing JMS in Web applications |
This application is a simple JMS application wherein a user sends information to the administrator for upgrade. As we go through the tutorial we will try to understand the basics of Servlets and JMS.
To run this tutorial, as a minimum you will be required to have installed the following prerequisite software:
Geronimo version 2.1.x, Java 1.5 runtime, and Eclipse Ganymede are used in this tutorial but other versions can be used instead (e.g., Geronimo version 2.2, Java 1.6, Eclipse Europa)
Details on installing eclipse are provided in the Development environment section. This tutorial is organized in the following sections:
In simple terms a Connection Factory is an object which is used by a client to connect to a Service provider. In our case we will be using Active MQ as the provider. A Destination is an object which is used by client to provide the target to messages produced and source of the messages to be consumed. In our case the target is going to be a queue.
Let us see how we can use the administrative console to create a Connection Factory and Message Destination.
For this tutorial you should start the server and launch the administrative console outside of Eclipse (due to limitations with the Eclipse web browser)
UserServlet.java
:
index.jsp
. Select Next.index.jsp
:
Modify the geronimo-web.xml deployment plan as shown below:
The deployment plan has been modified to include active-mq dependencies and resource references for queue TestQueue and Connection Factory Test Connection Factory. You may have to update version number of each dependency to comply with the Geronimo version you are using.
<sys:dependency> – Defines the dependency of the application on ActiveMQ.
<nam:resource-ref> – This tag is basically used to define connections that can be JDBC Connection, Java Mail connection or JMS Connection Factory. In our case we are using it for JMS Connection Factory.
<nam:resource-env-ref> – This tag is basically used to define a resource. In our case we have defind the message destination that is the TestQueue.
Bookmark this on Delicious Digg this | Privacy Policy - Copyright © 2003-2011, The Apache Software Foundation, Licensed under ASL 2.0. |