Publish/Subscribe paradigm: Why must message classes not know about their subscribers?

Posted by carleeto on Stack Overflow See other posts from Stack Overflow or by carleeto
Published on 2010-05-25T22:05:25Z Indexed on 2010/05/25 22:11 UTC
Read the original article Hit count: 163

From Wikipedia: "Publish/subscribe (or pub/sub) is a messaging paradigm where senders (publishers) of messages are not programmed to send their messages to specific receivers (subscribers). Rather, published messages are characterized into classes, without knowledge of what (if any) subscribers there may be"

I can understand why a sender must not be programmed to send its message to a specific receiver. But why must published messages be classes that do not have knowledge of their subscribers?

It would seem that once the messaging system itself is in place, what typically changes as software evolves is the messages sent, the publishers and the receivers. Keeping the messages separate from the subscribers seems to imply that the subscription model might also change. Is this the reason? Also, does this occur in the real world?

I realize this may be a basic question, but I'm trying to understand this paradigm and your replies are very much appreciated.

© Stack Overflow or respective owner

Related posts about design

Related posts about paradigms