Decision Guide:Polling vs Webhook(轮询 vs Web 回调)
知识库位置:
FDE Knowledge Base/03 Engineering/Decision Guides/Polling-vs-Webhook.md
两种方式都可以发现:
外部系统发生了变化。
Polling(轮询)
Section titled “Polling(轮询)”系统主动问:
Anything new?(有新数据吗)Anything new?(有新数据吗)Anything new?(有新数据吗)Webhook(Web 回调)
Section titled “Webhook(Web 回调)”外部系统主动通知:
Something changed.(有变化了)Prefer Webhook When(倾向 Webhook 的场景)
Section titled “Prefer Webhook When(倾向 Webhook 的场景)”- Source(来源系统)支持 Webhook
- 需要较低延迟
- Event volume(事件量)合理
- 希望减少无效请求
Prefer Polling When(倾向轮询的场景)
Section titled “Prefer Polling When(倾向轮询的场景)”- Source 不支持 Webhook
- 数据变化不频繁
- 实现简单优先
- Webhook 网络连通困难
- 需要定期对账(Reconciliation,对账)
Important Reality(重要现实)
Section titled “Important Reality(重要现实)”即使使用 Webhook,也经常需要:
Webhook(Web 回调)+Periodic Reconciliation(周期性对账)因为 Webhook 可能:
- 丢失
- 延迟
- 重复
FDE Principle(FDE 原则)
Section titled “FDE Principle(FDE 原则)”Webhook 用于:
快速知道变化。
Polling / Reconciliation(轮询/对账)用于:
最终确认状态。