Documentation
¶
Overview ¶
Package dlq provides the Dead Letter Queue (DLQ) interface for handling failed jobs. DLQ implementations can store failed jobs for later inspection, retry, or cleanup.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DLQAdapter ¶
type DLQAdapter interface {
// Push adds a failed job to the dead letter queue along with its error information.
// The context can be used for cancellation and timeout control.
// The job parameter contains the failed job and its processing context.
// The err parameter contains the error that caused the job to fail.
//
// Returns an error if the job cannot be added to the DLQ.
Push(ctx context.Context, job *job.JobContext, err error) error
}
DLQAdapter defines the interface for Dead Letter Queue implementations. A DLQ stores jobs that have failed processing after exhausting all retry attempts. This allows for manual inspection, debugging, and potential reprocessing of failed jobs.
type MySQLDLQ ¶
type MySQLDLQ struct {
// contains filtered or unexported fields
}
MySQLDLQ implements the DLQ interface using a MySQL database
func NewMySQLDLQ ¶
NewMySQLDLQ creates a new MySQL Dead Letter Queue
type PostgresDLQ ¶
type PostgresDLQ struct {
// contains filtered or unexported fields
}
PostgresDLQ implements the DLQ interface using a PostgreSQL database
func NewPostgresDLQ ¶
func NewPostgresDLQ(db *sql.DB, logger logger.Logger) *PostgresDLQ
NewPostgresDLQ creates a new PostgreSQL Dead Letter Queue
func (*PostgresDLQ) Push ¶
func (p *PostgresDLQ) Push(ctx context.Context, job *job.JobContext, err error) error
Push adds a failed job to the dead letter queue and deletes it from the jobs table