Java Reference
In-Depth Information
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
In the other window, the
AsynchConsumer
client displays the following (along
with some additional output):
Destination type is topic
To end program, type Q or q, then <return>
Reading message: This is message 1 from producer
Reading message: This is message 2 from producer
Reading message: This is message 3 from producer
Message is not a TextMessage
The last line appears because the client has received the non-text control message
sent by the
Producer
client.
4. Type
Q
or
q
and press Return to stop the client.
5. Now run the clients using a queue.
In this case, as with the synchronous example, you can run the
Producer
client
first, because there is no timing dependency between the sender and receiver:
appclient -client client-jar/producerClient.jar queue 3
The output of the client looks like this:
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
6. Run the
AsynchConsumer
client:
appclient -client client-jar/asynchconsumerClient.jar queue
The output of the client looks like this (along with some additional output):