Does a standard put/get from a XA JMS session.  Uses bean managed
transactions.


Like Sample1, requires the following administered objects to be available
from the JNDI namespace:

jms/Samples/QCF1
jms/Samples/Q1

These can be created by passing the following script to JMSAdmin

====== cut here ======

# Example script to insert administered objects for samples into a
# JNDI namespace.
# Ensure that JMSAdmin.config has been correctly configured to access the
# appropriate namespace, and then apply this script using the command
# JMSAdmin < admin.scp

# create the jms subcontext. If the subcontext already exists the def
# command will generate an "unable to create context" error which may
# be safely ignored.
def ctx(jms)
chg ctx(jms)

# create a samples subcontext
def ctx(Samples)
chg ctx(Samples)

# create a WebSphere specific queue connection factory
# This uses all the default settings which map to the default queue manager.
# A non-default queue manager can be specified using the qmgr(name) property.
def wsqcf(QCF1)

# create a Queue. The default queue can be replaced with an alternative local
# queue of your choice.
def q(Q1) queue(SYSTEM.DEFAULT.LOCAL.QUEUE)

# display the current context to provide feedback
dis ctx

# exit
end

====== cut here ======

The putMessage method will connect to the queue manager defined by
'jms/Samples/QCF1' and put a message to 'jms/Samples/Q1'.
The getMessage method will connect to the queue manager defined by
'jms/Samples/QCF1' and get a message from 'jms/Samples/Q1'.


The bean must be deployed with the TX_BEAN_MANAGED attribute set for the
getMessage and putMessage methods. See the WebSphere documentation for
details on building and deploying EJBs.

Whilst running the bean it is useful to monitor the stdout log from the
app'server, as it outputs a number of messages describing its activity.

A simple client program is provided to invoke the bean (Sample2Client.java),
along with a bat file to simplify running it. The bat file will need
modification for the location of the WebSphere installation, and the name
of the deployed jar file (DeployedjmsSample2.jar by default).

The client program takes a single parameter which is a string to be put
in the test message output from the EJB.

Here is an example output from the client program:

$ runClient.bat "A test message"

c:\jbk\mqjava\common\jms\com\ibm\mq\jms\wsae\samples\sample2>java -classpath .;c:\Websphere\Appserver\deployedEJBs\DeployedjmsSample2.jar;c:\Websphere\Appserver\jdk\jre\lib\rt.jar;c:\Websphere\Appserver\lib\ejs.jar;c:\Websphere\Appserver\lib\ujc.jar;c:\Websphere\Appserver\lib\iioptools.jar;c:\Websphere\Appserver\lib\servlet.jar;c:\Websphere\Appserver\lib\jms.jar Sample2Client "A test message"
calling Sample2 EJB with string 'A test message'
calling putMessage
calling getMessage
got message 'A test message'
done

And here is the corresponding output from the app'servers stdout:

Sample2EJB.ejbCreate()
request to put message 'A test message'
getting UserTransaction
ut.begin
sending message
ut.commit
done
Sample2EJB.ejbRemove()
Sample2EJB.ejbCreate()
request to get message 'ID:414d51206361726468752e716d31202060afd13912200000'
getting UserTransaction
ut.begin
getting message
body is >A test message<
closing receiver
closing connection
ut.commit
done
Sample2EJB.ejbRemove()
