background image

Running the Clients

<< The SynchConsumer Example | The Producer Project >>
<< The SynchConsumer Example | The Producer Project >>

Running the Clients

Running the Clients for the Synchronous Receive Example
To run the sample programs using NetBeans IDE, follow these steps.
1. 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:
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
The messages are now in the queue, waiting to be received.
2. Now run the SynchConsumer example:
a. Right-click the synchconsumer 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
Reading message: This is message 1
Reading message: This is message 2
Reading message: This is message 3
3. Now try running the programs in the opposite order. Right-click the synchconsumer project
and choose Run Project.
The Output pane displays the destination type and then appears to hang, waiting for
messages.
4. Right-click the producer project and choose Run Project.
The Output pane shows the output of both programs, in two different tabs.
5. Now run the Producer example using a topic instead of a queue.
Writing Simple JMS Client Applications
Chapter 31 · The Java Message Service API
917