1212import com .iluwatar .publish .subscribe .subscriber .WeatherSubscriber ;
1313
1414/**
15- * <p>The Publish and Subscribe pattern is a messaging paradigm used in software architecture with
16- * several key points: <li>Decoupling of publishers and subscribers: Publishers and subscribers
17- * operate independently, and there's no direct link between them. This enhances the scalability and
18- * * modularity of applications.</li><li>Event-driven communication: The pattern facilitates
19- * event-driven architectures by allowing publishers to broadcast events without concerning
20- * themselves with who receives the events.</li><li>Dynamic subscription: Subscribers can
21- * dynamically choose to listen for specific events or messages they are interested in, often by
22- * subscribing to a particular topic or channel.</li><li>Asynchronous processing: The pattern
23- * inherently supports asynchronous message processing, enabling efficient handling of events and
24- * improving application responsiveness.</li><li>Scalability: By decoupling senders and receivers,
25- * the pattern can support a large number of publishers and subscribers, making it suitable for
26- * scalable systems.</li><li>Flexibility and adaptability: New subscribers or publishers can be
27- * added to the system without significant changes to the existing components, making the system
28- * highly adaptable to evolving requirements.</li></p>
15+ * The Publish and Subscribe pattern is a messaging paradigm used in software architecture with
16+ * several key points:
17+ * <li>Decoupling of publishers and subscribers: Publishers and subscribers operate independently,
18+ * and there's no direct link between them. This enhances the scalability and * modularity of
19+ * applications.
20+ * <li>Event-driven communication: The pattern facilitates event-driven architectures by allowing
21+ * publishers to broadcast events without concerning themselves with who receives the events.
22+ * <li>Dynamic subscription: Subscribers can dynamically choose to listen for specific events or
23+ * messages they are interested in, often by subscribing to a particular topic or channel.
24+ * <li>Asynchronous processing: The pattern inherently supports asynchronous message processing,
25+ * enabling efficient handling of events and improving application responsiveness.
26+ * <li>Scalability: By decoupling senders and receivers, the pattern can support a large number of
27+ * publishers and subscribers, making it suitable for scalable systems.
28+ * <li>Flexibility and adaptability: New subscribers or publishers can be added to the system
29+ * without significant changes to the existing components, making the system highly adaptable to
30+ * evolving requirements.
2931 *
30- * <p>In this example we will create two {@link TopicName}s WEATHER and CUSTOMER_SUPPORT.
31- * Then we will register those topics in the {@link Publisher}.
32- * After that we will create two {@link WeatherSubscriber}s to WEATHER {@link Topic}.
33- * Also, we will create two {@link CustomerSupportSubscriber}s to CUSTOMER_SUPPORT {@link Topic}.
34- * Now we can publish the two {@link Topic}s with different content in the {@link Message}s.
35- * And we can observe the output in the log where,
36- * {@link WeatherSubscriber} will output the message with {@link WeatherContent}.
37- * {@link CustomerSupportSubscriber} will output the message with {@link CustomerSupportContent}.
38- * Each subscriber is only listening to the subscribed topic.
32+ * <p>In this example we will create two {@link TopicName}s WEATHER and CUSTOMER_SUPPORT. Then
33+ * we will register those topics in the {@link Publisher}. After that we will create two {@link
34+ * WeatherSubscriber}s to WEATHER {@link Topic}. Also, we will create two {@link
35+ * CustomerSupportSubscriber}s to CUSTOMER_SUPPORT {@link Topic}. Now we can publish the two
36+ * {@link Topic}s with different content in the {@link Message}s. And we can observe the output
37+ * in the log where, {@link WeatherSubscriber} will output the message with {@link
38+ * WeatherContent}. {@link CustomerSupportSubscriber} will output the message with {@link
39+ * CustomerSupportContent}. Each subscriber is only listening to the subscribed topic.
3940 */
4041public class App {
4142
@@ -71,4 +72,4 @@ public static void main(String[] args) {
7172 publisher .publish (weatherTopic , new Message (WeatherContent .earthquake ));
7273 publisher .publish (supportTopic , new Message (CustomerSupportContent .DE ));
7374 }
74- }
75+ }
0 commit comments