Java Reference
In-Depth Information
5. Now run the
Producer
example using a topic instead of a queue.
a. Right-click the
producer
project and select Properties.
b. Select Run from the Categories tree.
c. In the Arguments field, type the following:
topic 3
d. Click OK.
e. Right-click the project and select Run.
The output 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
6. Now run the
SynchConsumer
example using the topic.
a. Right-click the
synchconsumer
project and select Properties.
b. Select Run from the Categories tree.
c. In the Arguments field, type the following:
topic
d. Click OK.
e. Right-click the project and select Run.
The result, however, is different. Because you are using a topic, messages that
Subscribe Messaging Domain
” on page
347
for details.) Instead of receiving
the messages, the program appears to hang.
7. Run the
Producer
example again. Right-click the
producer
project and
select Run.
Now the
SynchConsumer
example receives the messages:
Destination type is topic
Reading message: This is message 1 from producer