Webhook(Web 回调)
知识库位置:
FDE Knowledge Base/03 Engineering/Enterprise Integration/Webhook/Webhook.md
Webhook 是:
当某个事件发生时,一个系统主动通知另一个系统。
与 Polling(轮询)对比:
Polling(轮询)
Section titled “Polling(轮询)”Application(应用)↓Every 30 seconds(每 30 秒)↓Any new order?(有新订单吗)Webhook(Web 回调)
Section titled “Webhook(Web 回调)”Order Created(订单创建)↓Send Event(发送事件)↓Application(应用)Typical Use Cases(典型用例)
Section titled “Typical Use Cases(典型用例)”- Payment Completed(支付完成)
- Ticket Created(工单创建)
- Document Uploaded(文档上传)
- Order Changed(订单变更)
Important Concerns(必须考虑的问题)
Section titled “Important Concerns(必须考虑的问题)”Webhook 必须考虑:
- Authentication(身份认证)
- Signature Validation(签名校验)
- Duplicate Delivery(重复投递)
- Retry(重试)
- Ordering(事件顺序)
- Idempotency(幂等性)
Idempotency(幂等性)
Section titled “Idempotency(幂等性)”同一个 Webhook 可能收到两次。
系统应该保证:
Same Event × 2(同一事件收到两次)≠Business Action × 2(业务动作执行两次)