开发者

Should WS-notification be used to just notify or should the data also be transmitted with the payload

Should WS-notification (WS Notification) be used to just notify or should the data also be transmitted with the payload to sav开发者_如何转开发e an extra call(back).

Use Case: A customer's record has changed. Need to notify other systems. Sends a notification.

Scenario 1. Send the notification with customer record changes. Could be bad since each listening system might do a different action or may or may not need the customer record.

Scenario 2. Just send the notification. Means that each listening system will have to "react" in some way. Responsibility is on the listening system.


Two methods.

Pub/Sub Push and Pub/Sub Pull.

Pub/Sub Push is to push out the full data.

Pub/Sub Pull is to send enough data for the target app to call back and request the full data. This allows better control of information passed than the pub/sub push method.

Pub/Sub Push method is the easiest to implement.


Pub-sub kind of implies that the notification consumers are already interested in the topic in question by virtue of the fact that they have subscribed. However, as you say, they may not need to respond. So if you consider the notification to be a true event then the notifying system is saying, "here is a notification that my state has changed". If the notification consumer is interested it can use request-response to get that new state. This would be more flexible and lightweight. Notifications are inherently more event-oriented and therefore using them to push state should be considered carefully. Particularly as with pub-sub you seldom have an idea as to how many subscribers you have at run time - then capacity planning can be difficult and peak load spikes are not uncommon. So keep the notifications lightweight. Let the consumers decide if they're to act on the event. You're on your way to a true EDA!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜