February 2002
Beginner to intermediate
544 pages
10h 23m
English
This section describes the publishing and subscribing programs in a pub/sub example that uses a message listener to consume messages asynchronously. This section then explains how to compile and run the programs, using the J2EE SDK 1.3.
The publishing program, SimpleTopicPublisher.java, performs the following steps:
1. |
Performs a JNDI API lookup of the TopicConnectionFactory and topic
|
2. |
Creates a connection and a session
|
3. |
Creates a TopicPublisher
|
4. |
Creates a TextMessage
|
5. |
Publishes one or more messages to the topic
|
6. |
Closes the connection, which automatically closes the session and TopicPublisher
|
The receiving program, SimpleTopicSubscriber.java
Read now
Unlock full access