Publish Subscriber Pattern (Observer Design Pattern)
- The Publisher/Subscriber pattern is one of the variations of the Observer designer pattern
- A publisher publishes a message and there are one or more Subscribers who capture the published message.
- Publishers broadcast messages, with no knowledge of the subscribers.
- Subscribers ‘listen’ out for messages regarding topic/categories that they are interested in without any knowledge of who the publishers are.
- The event bus transfers the messages from the publishers to the subscribers.
- Each subscriber only receives a subset of the messages that have been sent by the publisher, they only receive the message topics or categories they have subscribed to.
Event Bus knows what topic each subscriber is subscribed to. The event bus will filter messages based on topic and send the messages to subscribers that are subscribed to the topic of the message. The publishers are responsible for defining the topics of their messages.
To understand this consider a real-life scenario where Mobile operators are sending messages to their customers.
No comments:
Post a Comment
This is a User Friendly Blog.
Simple Interface and Simple Controls are used.
Post your comments so i can modify blog regarding your wish.