background image

The Non-Text Control Message

<< Running the Clients | The Terminal Window >>
<< Running the Clients | The Terminal Window >>

The Non-Text Control Message

The last line appears because the program has received the non-text control message
sent by the Producer program.
3. Type Q or q in the Input field and press Return to stop the program.
4. Now run the programs using a queue. In this case, as with the synchronous example, you
can run the Producer program first, because there is no timing dependency between the
sender and receiver.
a. Right-click the producer project and choose Properties.
b. Select Run from the Categories tree.
c. In the Arguments field, type the following:
queue 3
d. Click OK.
e. Right-click the project and choose Run Project.
The output of the program looks like this:
Destination type is queue
Sending message: This is message 1
Sending message: This is message 2
Sending message: This is message 3
5. Run the AsynchConsumer program.
a. Right-click the asynchconsumer project and choose Properties.
b. Select Run from the Categories tree.
c. In the Arguments field, type the following:
queue
d. Click OK.
e. Right-click the project and choose Run Project.
The output of the program looks like this:
Destination type is queue
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
6. Type Q or q in the Input field and press Return to stop the program.
Writing Simple JMS Client Applications
The Java EE 5 Tutorial · September 2007
924