JMS using GlassFish MQ Bootcamp

Skip to end of metadata
Go to start of metadata

Intro

OpenMQ is one of the subprojects of GlassFish and servers as both the JMS reference implementation as well as a production-quality implementation fully integrated with GlassFish. It is also usable in standalone mode (check the Message Queue 4.5 Technical Overview for details).

This page contains material from the GlassFish MQ bootcamp to get your feet wet and hands on the technology. It covers the following topics :

  1. OpenMQ basics
  2. Compile simple java applications to send and receive messages via the JMS API
  3. Compile and package a simple MDB application which receives a message from a JMS destination and sends a message to another JMS destination
  4. How to configure a GlassFish instance
  5. How to configure a GlassFish cluster

Raw material is available from this link.

If you have questions about OpenMQ, GlassFish or this material, please consider using the GlassFish Forum or USERS mailing list.

JMS Bootcamp slides

(click to open PDF)

JMS Bootcamp hands-on-lab

  • List of commands to be used for both labs (you can follow these, or read the instructions following)

Setup

  • Install GlassFish Server. Download latest GlassFish 3.x bundle from http://glassfish.java.net/public/downloadsindex.htm.
  • Compile the applications and place the binaries in the test directory OR Download the above mentioned test bundle, "test.zip" and unzip it in the test directory

Link to the Applications used in the Demo

  • Message-Driven Bean : GenericMDB.java
  • JMS Sender : Sender.java
  • JMS Receiver : Receiver.java
  • test.zip : test.zip Archive Containing the Source Code and Binary for the MDB and the JMS Clients. Use the test.zip if you don't want to compile the applications yourself.

Instructions to Compile the Applications

  • set CLASSPATH to $GLASSFISH_HOME/lib/javaee.jar:$MQ_HOME/lib/imq.jar:$MQ_HOME/lib/jms.jar:.

Compile MDB

  1. javac GenericMDB.java
  2. jar cvf ejb-jar-ic.jar GenericMDB.class
  3. jar cvf simplemdb.ear ejb-jar-ic.jar

Compile JMS Sender/Receiver

  1. javac Sender.java Receiver.java
  2. Copy the simplemdb.ear, Sender.class and Receiver.class to the test directory.

Instructions for Running the Demo

In class labs

Labs for later

Labels:
None
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.

Sign up or Log in to add a comment or watch this page.


The individuals who post here are part of the extended Oracle community and they might not be employed or in any way formally affiliated with Oracle. The opinions expressed here are their own, are not necessarily reviewed in advance by anyone but the individual authors, and neither Oracle nor any other party necessarily agrees with them.