The Publish/Subscribe Messaging Domain

So far, you have seen how to create a simple point-to-point application with a single sender and receiver. Now you will build a simple bulletin board application to demonstrate the features of the publish/subscribe model.

For this example, a producer will be used that creates messages and publishes them to a bulletin board. Later you will write the subscriber program, which asynchronously listens for messages. The messages are printed to the screen—one at time—in the order they were received.

Remember that, unlike messages in a queue, messages in a topic are immediately distributed to all subscribers. As a result, the timing of the publisher and the subscriber becomes important. Apart from this, the subscriber/publisher ...

Get Sams Teach Yourself J2EE™ in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.