background image

Running the Clients

<< Compiling the AsynchConsumer Client Example | The Non-Text Control Message >>
<< Compiling the AsynchConsumer Client Example | The Non-Text Control Message >>

Running the Clients

The targets package both the main class and the message listener class in the JAR file and place
the file in the dist directory for the example.
Running the Clients for the Asynchronous Receive Example
To run the programs using NetBeans IDE, follow these steps.
1. Run the AsynchConsumer example:
a. Right-click the asynchconsumer project and choose Properties.
b. Select Run from the Categories tree.
c. In the Arguments field, type the following:
topic
d. Click OK.
e. Right-click the project and choose Run Project.
The program displays the following lines and appears to hang:
Destination type is topic
To end program, type Q or q, then <return>
2. Now run the Producer example:
a. Right-click the producer project and choose Properties.
b. Select Run from the Categories tree.
c. In the Arguments field, type the following:
topic 3
d. Click OK.
e. Right-click the project and choose Run Project.
The output of the program looks like this:
Destination type is topic
Sending message: This is message 1
Sending message: This is message 2
Sending message: This is message 3
In the other window, the AsynchConsumer program displays the following:
Destination type is topic
To end program, type Q or q, then <return>
Reading message: This is message 1
Reading message: This is message 2
Reading message: This is message 3
Message is not a TextMessage
Writing Simple JMS Client Applications
Chapter 31 · The Java Message Service API
923