Java Reference
In-Depth Information
appclient -client client-jar/synchconsumerClient.jar queue
The client displays the destination type and then appears to hang, waiting for mes-
sages.
8. In a different terminal window, run the
Producer
client.
cd
tut-install
/examples/jms/simple/producer
appclient -client client-jar/producerClient.jar queue 3
When the messages have been sent, the
SynchConsumer
client receives them
and exits.
9. Now run the
Producer
client using a topic instead of a queue:
appclient -client client-jar/producerClient.jar topic 3
The output of the client looks like this (along with some additional output):
Destination type is topic
Sending message: This is message 1 from producer
Sending message: This is message 2 from producer
Sending message: This is message 3 from producer
10. Now run the
SynchConsumer
client using the topic:
appclient -client client-jar/synchconsumerClient.jar topic
The result, however, is different. Because you are using a topic, messages that were
sent before you started the consumer cannot be received. (See “
Publish/Subscribe
Messaging Domain
” on page
347
for details.) Instead of receiving the messages,
the client appears to hang.
11. Run the
Producer
client again.
Now the
SynchConsumer
client receives the messages (along with some addi-
tional output):
Destination type is topic
Reading message: This is message 1 from producer
Reading message: This is message 2 from producer
Reading message: This is message 3 from producer