background image

The ackequivexample Project

<< A Message Acknowledgment Example | Specifying Message Persistence >>
<< A Message Acknowledgment Example | Specifying Message Persistence >>

The ackequivexample Project

b. In the Open Project dialog, navigate to
tut-install/javaeetutorial5/examples/jms/advanced/.
c. Select the ackequivexample folder.
d. Select the Open as Main Project check box.
e. Click Open Project Folder.
f. Right-click the project and choose Build Project.
To compile and package the program using Ant, type the following command:
ant
4. To run the program using NetBeans IDE, right-click the ackequivexample project and
choose Run Project. To run the program from the command line, follow these steps:
a. Go to the dist directory:
cd dist
b. Type the following command:
appclient -client ackequivexample.jar
The program output looks something like this:
Queue name is jms/ControlQueue
Queue name is jms/Queue
Topic name is jms/Topic
Connection factory name is jms/DurableConnectionFactory
SENDER: Created client-acknowledge session
SENDER: Sending message: Here is a client-acknowledge message
RECEIVER: Created client-acknowledge session
RECEIVER: Processing message: Here is a client-acknowledge message
RECEIVER: Now I
'll acknowledge the message
SUBSCRIBER: Created auto-acknowledge session
SUBSCRIBER: Sending synchronize message to control queue
PUBLISHER: Created auto-acknowledge session
PUBLISHER: Receiving synchronize messages from control queue; count = 1
PUBLISHER: Received synchronize message;
expect 0 more
PUBLISHER: Publishing message: Here is an auto-acknowledge message 1
PUBLISHER: Publishing message: Here is an auto-acknowledge message 2
SUBSCRIBER: Processing message: Here is an auto-acknowledge message 1
PUBLISHER: Publishing message: Here is an auto-acknowledge message 3
SUBSCRIBER: Processing message: Here is an auto-acknowledge message 2
SUBSCRIBER: Processing message: Here is an auto-acknowledge message 3
After you run the program, you can delete the destination resource jms/ControlQueue. Go to
the directory tut-install/javaeetutorial5/examples/jms/advanced/ackequivexample/ and
type the following command:
Creating Robust JMS Applications
Chapter 31 · The Java Message Service API
939