MoonBit 通知库:多平台 webhook(飞书/钉钉/企业微信/Slack/Discord)、通用 webhook、SMTP 邮件,含去重/限流/重试引擎
Dependencies
| preset | 平台 Platform | 传输 Transport |
|---|---|---|
| feishu | 飞书 | HTTPS(可选签名) |
| dingtalk | 钉钉 | HTTPS(HMAC 签名) |
| wecom | 企业微信 | HTTPS |
| slack | Slack | HTTPS |
| discord | Discord | HTTPS |
| webhook | 通用 webhook | HTTPS(Bearer) |
| 邮件 | SMTP(STARTTLS / smtps) |
// 一次性投递:None = 成功,Some(reason) = 失败原因(不含凭据)
let failure = deliver(target, msg, 5000, { host: "prod-1", product: "myapp" })// 可选引擎:去重 → 限流 → 队列 → 失败退避重试
let engine = Engine::new({ host: "prod-1", product: "myapp" })
engine.emit(
now, "crash|api", "api", msg, targets, 5000,
dedupe_window_s=3600, rate_per_minute=30, queue_limit=128,
)
let report = engine.pump(now) // 每 tick 调用一次| 接口 | 说明 |
|---|---|
| deliver(target, msg, timeout_ms, ctx) | 投递一条消息到单个目标 |
| deliver_all(targets, msg, timeout_ms, ctx) | 逐个投递,返回 (name, failure) 列表 |
| Engine::new(ctx, max_attempts?) | 创建引擎 |
| Engine::emit(...) | 入队一条消息,返回 Queued / Deduped / RateLimited / QueueFull |
| Engine::pump(now) | 投递队首消息,返回 remaining / outcome / owner |
| Engine::dropped() / Engine::queued() | 丢弃与排队计数 |
Install
Download zipMoonBit 通知库:多平台 webhook(飞书/钉钉/企业微信/Slack/Discord)、通用 webhook、SMTP 邮件,含去重/限流/重试引擎
Dependencies