The difference between the observer pattern and the subscription-publishing pattern

Observer pattern:

Subscription publish mode:

 

The difference between the two:

1. Compared with the observer mode, the subscription-publishing mode has one more "dispatch center" in the middle. Therefore, it is more decoupled, so in common systems, the subscription-publishing mode can make the business clearer

2. The communication mode of restful requests can be regarded as the application of the observer mode; while the service bus (MQ) mode is the subscription and publishing mode

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325689735&siteId=291194637