This example is a MDB which receives text messages from queue "sample2-input", prints it to System.out and forwards the message to "sample2-output". You will find the output in Glassfish's server.log. Use the SwiftMQ Explorer to view the resulting messages in "sample2-output".
After download, unzip it and go to the "withsendmdb" directory where you will find the EAR archive.
If you want to change and rebuild the example, you need Apache ant on your machine. Switch to "withsendmdb/build" and call:
ant -Dlib=<glassfish-lib-dir>
where <glassfish-lib-dir> must point to the "lib" directory of Glassfish.
You will find all necessary bindings/configuration in the "ejb-jar.xml" (standard J2EE deployment descriptor) and "sun-ejb-jar.xml" (Glassfish's specific deployment descriptor).
In the admin console select "Applications / Enterprise Applications":
Press "Deploy" in the right frame and locate the "withsendmdb.ear":
Press "OK" and the application is deployed:
To test the example you need to send some text messages to queue "sample2-input@router1". You can use the SwiftMQ example P2PSender to do that.
Switch to the router's distribution directory and there to "samples/router_network". From here run:
starter P2PSender smqp://localhost:4001 plainsocket@router1 sample2-input@router1 100
It sends 100 messages to "sample2-input@router1". Now have a look in Glassfish's server.log file. You should see the printouts of the MDB for each message. Note that the messages are not printed in order because the messages are processed asynchronously from multiple MDB instances.
Open the SwiftMQ Explorer and connect to the router. View "sample2-output" and you should see the 100 forwarded messages there.