You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: publish-subscribe/README.md
+8-8
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
---
2
-
title: "Publisher-Subscriber Pattern in Java: Decoupling the solution with asynchronous communication"
2
+
title: "Publish-Subscribe Pattern in Java: Decoupling the solution with asynchronous communication"
3
3
shortTitle: Proxy
4
4
description: "Explore the Proxy design pattern in Java with detailed examples. Learn how it provides controlled access, facilitates lazy initialization, and ensures security. Ideal for developers looking to implement advanced Java techniques."
5
5
category: Structural
@@ -14,14 +14,14 @@ tag:
14
14
- Wrapping
15
15
---
16
16
17
-
## Intent of the Publisher-Subscriber Design Pattern
17
+
## Intent of the Publish-Subscribe Design Pattern
18
18
19
-
The publisher-subscriber design pattern is widely used in software architecture to transmit data between various components in a system.
19
+
The Publish-Subscriber design pattern is widely used in software architecture to transmit data between various components in a system.
20
20
It is a behavioral design pattern aimed at achieving loosely coupled communication between objects.
21
21
The primary intent is to allow a one-to-many dependency relationship where one object (the Publisher) notifies multiple other objects (the Subscribers) about changes or events,
22
22
without needing to know who or what the subscribers are.
23
23
24
-
## Detailed Explanation of Publisher-Subscriber Pattern with Real-World Examples
24
+
## Detailed Explanation of Publish-Subscribe Pattern with Real-World Examples
25
25
26
26
- Messaging systems like Kafka, RabbitMQ, AWS SNS, JMS
27
27
-**Kafka** : publishes messages to topics and subscribers consumes them in real time for analytics, logs or other purposes.
@@ -38,7 +38,7 @@ without needing to know who or what the subscribers are.
38
38
-**Publisher** : Writes a new blog post and publish to subscribers
39
39
-**Subscribers** : All the subscribers to the newsletter receive the email
40
40
41
-
## Programmatic Example of Publisher-Subscriber Pattern in Java
41
+
## Programmatic Example of Publish-Subscribe Pattern in Java
42
42
43
43
First we need to identify the Event on which we need the pub-sub methods to trigger.
44
44
For example:
@@ -157,7 +157,7 @@ Program output:
157
157
11:46:44.311 [main] INFO com.iluwatar.publish.subscribe.subscriber.CustomerSupportSubscriber - Subscriber: supportSub2 sent the email to: [email protected]
158
158
```
159
159
160
-
## When to Use the Publisher-Subscriber Pattern
160
+
## When to Use the Publish-Subscribe Pattern
161
161
162
162
- Event-Driven Systems
163
163
- Use Pub/Sub when your system relies on events (e.g., user registration, payment completion).
@@ -183,13 +183,13 @@ Program output:
183
183
- Allow independent services to communicate without direct coupling.
184
184
- Example: An order service publishes an event, and both the billing and shipping services process it.
0 commit comments