Files
orbit/examples/task-outbox/README.md

22 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 业务事务 Outbox 示例
独立Go module,使用业务方自己的MySQL保存业务记录与待发请求,再通过独立Orbit SDK提交任务。平台与业务库分别提交,通过原幂等身份衔接恢复。
- [完整初始化、运行、恢复与接口说明](../../docs/examples/task-outbox.md)
- [命令行程序](cmd/sender/main.go):init、enqueue、send、status、demo。
- [业务事务](internal/outbox/store.go)、[发送器](../../adapters/outbox/mysql/sender.go)、[中文模型](internal/outbox/model.go)与[无外键表结构](internal/outbox/schema.sql)。
本模块是可运行的业务接入参考。核心SDK不引入MySQL驱动;生产业务应将本地事务接入自身业务模型、权限、审计与迁移,固定SDK版本并验证兼容性。本例的internal包不作为已发布通用SDK包承诺兼容。
从本目录运行基础检查:
```sh
GOWORK=off go test -race ./...
GOWORK=off go vet ./...
GOWORK=off go build ./cmd/sender
```
真实数据库、HTTP、COMMIT响应丢失、CLI及发送进程故障由仓库根目录的`make integration`统一执行,使用专门的一次性数据库。没有测试环境变量时Integration会跳过。
发送核心已抽为[公共 MySQL 适配包](../../adapters/outbox/mysql/README.md);本项目仅保留示例业务事务。已有 sender_outbox / sender_jobs 表保持兼容。