The OpenJMS code examples demonstrate how to write simple applications
using JMS.
The sources of these examples are located under the
examples/basic/ directory.
Name | Description |
---|---|
Sender.java | Sends messages to a destination |
Receiver.java | Synchronously receives messages from a destination |
Listener.java | Asynchronously receives messages from a destination |
DurableSubscriber.java | Durable topic subscriber |
Browser.java | Browses a queue |
Helper scripts are provided to compile the examples with the appropriate classpath. To run these, open a command prompt and type:
Windows
cd %OPENJMS_HOME%\examples\basic build
Unix
cd $OPENJMS_HOME/examples/basic build.sh
Helper scripts are also provided to run the examples. To run these, open a command prompt and type:
Windows
run <classname>
Unix
run.sh <classname>
The examples connect to the OpenJMS server using properties specified in an application resource file named jndi.properties:
# # JNDI configuration file used by the OpenJMS examples # # java.naming.provider.url=tcp://localhost:3035 java.naming.factory.initial=org.exolab.jms.jndi.InitialContextFactory
This can be customised to change the connector the examples use to connect to the server.