Documentation
¶
Index ¶
- func Setup(ctx context.Context, db *sql.DB) error
- type ID
- type Interface
- type Message
- type NewOpts
- type Queue
- func (q *Queue) Delete(ctx context.Context, id ID) error
- func (q *Queue) Extend(ctx context.Context, id ID, delay time.Duration) error
- func (q *Queue) MaxReceive() int
- func (q *Queue) MoveToDeadLetter(ctx context.Context, id ID, jobName, failureReason, errorMsg string) error
- func (q *Queue) Receive(ctx context.Context) (*Message, error)
- func (q *Queue) ReceiveAndWait(ctx context.Context, interval time.Duration) (*Message, error)
- func (q *Queue) Send(ctx context.Context, m Message) error
- func (q *Queue) SendAndGetID(ctx context.Context, m Message) (ID, error)
- func (q *Queue) SendTx(ctx context.Context, tx *sql.Tx, m Message) error
- func (q *Queue) Timeout() time.Duration
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Interface ¶
type Interface interface {
MaxReceive() int
Timeout() time.Duration
Send(context.Context, Message) error
SendTx(context.Context, *sql.Tx, Message) error
SendAndGetID(context.Context, Message) (ID, error)
Receive(context.Context) (*Message, error)
ReceiveAndWait(context.Context, time.Duration) (*Message, error)
Extend(context.Context, ID, time.Duration) error
Delete(context.Context, ID) error
MoveToDeadLetter(context.Context, ID, string, string, string) error
}
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func New ¶
New Queue with the given options. Defaults if not given: - Logs are discarded. - Max receive count is 3. - Timeout is five seconds.
func (*Queue) MaxReceive ¶
func (*Queue) MoveToDeadLetter ¶
func (q *Queue) MoveToDeadLetter(ctx context.Context, id ID, jobName, failureReason, errorMsg string) error
MoveToDeadLetter moves a message from the main queue to the dead letter queue. This is used for jobs that fail permanently or exceed max retries.
func (*Queue) ReceiveAndWait ¶
ReceiveAndWait for a Message from the queue, polling at the given interval, until the context is cancelled. If the context is cancelled, the error will be non-nil. See context.Context.Err.
func (*Queue) SendAndGetID ¶
SendAndGetID is like Send, but also returns the message ID, which can be used to interact with the message without receiving it first.
Click to show internal directories.
Click to hide internal directories.