JOTM can be used with any JMS (Java Message
Service) provider to gain advantage
of both message-oriented architecture and distributed
This example uses JORAM (http://www.objectweb.org/joram/) as its JMS provider.
All Ant commands are to be executed from the examples/jms/ directory of a JOTM distribution (examples won't work from JOTM source directory).
On one hand, SimpleSender sends 4 messages on a JMS queue:
On the other hand, SimpleReceiver receives 3 messages from the same JMS queue:
(SimpleReceiver does not receive the 3rd sent message because it has been rolled back.)
To compile the example, type
$ ant compile
$ export JOTM_HOME=<JOTM_distribution_directory>To run the example, type in $JOTM_HOME/lib/
$ rmiregistry -J-classpath -Jjotm.jar:jotm_jrmp_stubs.jar \ -J-Djava.security.policy=../config/java.policy &Then in $JOTM_HOME/lib/, type
$ java -classpath jotm.jar:jotm_jrmp_stubs.jar:../config/ \ org.objectweb.jotm.Main \ -u UserTransaction -m TransactionManager&(on one line)
And in the jms/ directory, type
$ ant run.jms
Since the client application of the jms example is a simple RMI/JRMP client, you've to use default protocol configuration for JOTM (i.e RMI/JRMP) in $JOTM_HOME/config/carol.properties file.
the output of the jms example should be somethnig like
$ ... $ $ [java] [SimpleJmsXa] lookup the TransactionManager. $ [java] [SimpleJmsXa] start the JMS server. $ [java] [SimpleJmsXa] JMS server started. $ [java] [SimpleJmsXa] create JMS objects, register them in JOTM and bind them. $ [java] [SimpleJmsXa] JMS objects available. $ [java] [SimpleJmsXa] start simple sender. $ [java] [SimpleSender] send : non transactional message $ [java] [SimpleSender] send : transactional message with commit $ [java] [SimpleSender] send : transactional message with rollback $ [java] [SimpleSender] send : LAST message $ [java] [SimpleJmsXa] start simple receiver. $ [java] [SimpleReceiver] received: non transactional message $ [java] [SimpleReceiver] received: transactional message with commit $ [java] [SimpleReceiver] received: LAST message $ [java] [SimpleJmsXa] JMS server stopped $ $ ...
If SimpleSender has effectively sent 4 messages and SimpleReceiver has effectively received only 3 messages, then the jms example is working!