Java Reference
In-Depth Information
Destination type is queue
Sending message: This is message 1 from producer
Sending message: This is message 2 from producer
Sending message: This is message 3 from producer
The messages are now in the queue, waiting to be received.
Note
When you run an application client, the command often takes a long
time to complete.
2. Now deploy and run the
SynchConsumer
example:
a. Right-click the
synchconsumer
project and select 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 select Run.
The output of the program looks like this (along with some additional output):
Destination type is queue
Reading message: This is message 1 from producer
Reading message: This is message 2 from producer
Reading message: This is message 3 from producer
3. Now try running the programs in the opposite order. Right-click the
synch-
consumer
project and select Run.
The Output pane displays the destination type and then appears to hang, waiting
for messages.
4. Right-click the
producer
project and select Run.
When the messages have been sent, the
SynchConsumer
client receives them
and exits. The Output pane shows the output of both programs, in two different
tabs.