Documentation
¶
Index ¶
- Constants
- func Claim(ctx context.Context, database Database, messageID string) (bool, error)
- func Insert(ctx context.Context, database Database, task Task) (bool, error)
- func IsPermanentFailure(err error) bool
- func MarkFailed(ctx context.Context, database Database, messageID string, attempts int, ...) error
- func MarkPending(ctx context.Context, database Database, messageID string, attempts int, ...) error
- func MarkSent(ctx context.Context, database Database, messageID string, attempts int, ...) error
- func NewDeliveryID() string
- func PurgeTerminal(ctx context.Context, database Database, before time.Time) error
- func RecoverInterrupted(ctx context.Context, database Database, now time.Time) error
- func RetryDelay(attempts int) time.Duration
- func RetryDelayWithJitter(attempts int) time.Duration
- func SchemaQueries() []string
- func StartDeliveryWorker(ctx context.Context, sender Sender) chan DeliveryJob
- type Database
- type DeliveryJob
- type DirectSender
- type Message
- type PermanentError
- type Record
- type Result
- type Sender
- type Task
Constants ¶
View Source
const ( StatusPending = "pending" StatusSending = "sending" StatusSent = "sent" StatusFailed = "failed" RouteLocal = "local" RouteRelay = "relay" )
View Source
const ( DefaultRetention = 7 * 24 * time.Hour TerminalRetention = 30 * 24 * time.Hour )
View Source
const DeliveryQueueSize = 256
Variables ¶
This section is empty.
Functions ¶
func IsPermanentFailure ¶
func MarkFailed ¶
func MarkPending ¶
func NewDeliveryID ¶
func NewDeliveryID() string
func PurgeTerminal ¶
func RecoverInterrupted ¶
func RetryDelay ¶
func RetryDelayWithJitter ¶
func SchemaQueries ¶
func SchemaQueries() []string
func StartDeliveryWorker ¶
func StartDeliveryWorker(ctx context.Context, sender Sender) chan DeliveryJob
Types ¶
type Database ¶
type Database interface {
ExecContext(context.Context, string, ...any) (sql.Result, error)
QueryContext(context.Context, string, ...any) (*sql.Rows, error)
QueryRowContext(context.Context, string, ...any) *sql.Row
}
Database is the database/sql surface required by the outbox store.
type DeliveryJob ¶
type DeliveryJob struct {
Message Message
}
type DirectSender ¶
type PermanentError ¶
type PermanentError struct {
Err error
}
func (PermanentError) Error ¶
func (deliveryError PermanentError) Error() string
func (PermanentError) Unwrap ¶
func (deliveryError PermanentError) Unwrap() error
type Record ¶
type Record struct {
Task
Status string
Attempts int
NextAttempt time.Time
SentAt time.Time
LastError string
}
type Task ¶
type Task struct {
ID string
InstallationID string
Kind string
Route string
Message Message
CreatedAt time.Time
ExpiresAt time.Time
Accepted chan error
Reply chan Result
Done <-chan struct{}
}
Task transfers responsibility for one durable delivery to the mail process. Reply belongs to the submitting consumer and may be reused for later tasks.
func NormalizeTask ¶
Click to show internal directories.
Click to hide internal directories.