Files
orbit/adapters/outbox/mysql/options.go

20 lines
770 B
Go
Raw Permalink 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.
package outbox
import (
"context"
"database/sql"
orbit "git.yuntuo.hk/k2safe/orbit/sdk/go"
)
// AcceptedHook 在最新租约确认事务内关联业务数据;可能在事务回滚/提交不明后再次调用。
// 必须同库、幂等、遵守 context,只做短 SQL;不能 Commit/Rollback,也不能发网络请求。
// record 是锁定后的发送记录,receipt 是本次已核验的受理回执,不是任务完成结果。
type AcceptedHook func(context.Context, *sql.Tx, Record, orbit.SubmitTaskResult) error
// Options 在构造后固定,Store 可以在多个发送 goroutine 中复用。
type Options struct {
// OnAccepted 可选的业务关联;为空时受理关系仅保存在 Outbox 的 TaskID/ReceiptJSON。
OnAccepted AcceptedHook
}