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 :
- OpenMQ basics
- Compile simple java applications to send and receive messages via the JMS API
- Compile and package a simple MDB application which receives a message from a JMS destination and sends a message to another JMS destination
- How to configure a GlassFish instance
- How to configure a GlassFish cluster
Raw material is available from this link.
- List of commands to be used for both labs (you can follow these, or read the instructions following)
- 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
- 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.
- set CLASSPATH to $GLASSFISH_HOME/lib/javaee.jar:$MQ_HOME/lib/imq.jar:$MQ_HOME/lib/jms.jar:.
- javac GenericMDB.java
- jar cvf ejb-jar-ic.jar GenericMDB.class
- jar cvf simplemdb.ear ejb-jar-ic.jar
- javac Sender.java Receiver.java
- Copy the simplemdb.ear, Sender.class and Receiver.class to the test directory.
- GlassFish Single Instance (with MQ Broker in the Default Embedded Mode)
- GlassFish Conventional Cluster (MQ Broker in Default Embedded Mode) – You can try this BASH script, but make sure to edit it and change the gf_home: gf_home=/cygdrive/c/glassfish3
- Abbreviated Outline for configuration using the GlassFish Admin GUI