Skip to content

internal mqcore

omeyang edited this page Sep 17, 2026 · 1 revision

internal/mqcore

稳定性:Internal · 覆盖率:100.0% · 源码:internal/mqcore

MQ 通用消费循环。xkafka 与 xpulsar 共享底层。Fail-Fast 设计:handler panic 刻意不补 recover。

用途

  • RunConsumeLoop(ctx, handler) 给 xkafka / xpulsar 用
  • 统一消费循环骨架(ctx 监听、消息分发、错误处理)

设计要点

  • Fail-Fast:handler panic 不补 recover,让其暴露
  • 理由:消息处理 handler 是业务方的代码,panic 表明业务 bug;自动 recover 会掩盖问题
  • 对比:xpool / xhealth / xelection / xconf 这些包内拥有 goroutine 的场景必须 recover

相关

Clone this wiki locally