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