Documentation
¶
Index ¶
- type DistributedPriorityQueue
- type DistributedQueue
- type Notification
- type PriorityQueue
- func (pq *PriorityQueue) Dequeue() (any, bool)
- func (pq *PriorityQueue) DequeueWithAckId() (any, bool, string)
- func (pq *PriorityQueue) Enqueue(item any, priority int) bool
- func (pq *PriorityQueue) Len() int
- func (pq *PriorityQueue) Remove(item any) bool
- func (pq *PriorityQueue) RequeueNackedItems() error
- func (pq *PriorityQueue) Values() []any
- type Queue
- func (q *Queue) Acknowledge(ackID string) bool
- func (q *Queue) Close() error
- func (q *Queue) Dequeue() (any, bool)
- func (q *Queue) DequeueWithAckId() (any, bool, string)
- func (q *Queue) Enqueue(item any) bool
- func (q *Queue) GetNackedItemsCount() int
- func (q *Queue) Len() int
- func (q *Queue) Listen()
- func (q *Queue) PrepareForFutureAck(ackID string, item any) error
- func (q *Queue) Purge()
- func (q *Queue) Remove(item any) bool
- func (q *Queue) RequeueNackedItems() error
- func (q *Queue) SetAckTimeout(ackTimeout time.Duration)
- func (q *Queue) SetExpiration(expiration time.Duration)
- func (q *Queue) SetVisibilityTimeout(d time.Duration)
- func (q *Queue) Values() []any
- type Queues
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DistributedPriorityQueue ¶
type DistributedPriorityQueue struct {
*PriorityQueue
*Notification
}
func (*DistributedPriorityQueue) Close ¶
func (q *DistributedPriorityQueue) Close() error
func (*DistributedPriorityQueue) Dequeue ¶
func (q *DistributedPriorityQueue) Dequeue() (any, bool)
type DistributedQueue ¶
type DistributedQueue struct {
*Queue
*Notification
}
func (*DistributedQueue) Close ¶
func (q *DistributedQueue) Close() error
func (*DistributedQueue) Dequeue ¶
func (q *DistributedQueue) Dequeue() (any, bool)
func (*DistributedQueue) Enqueue ¶
func (q *DistributedQueue) Enqueue(item any) bool
type Notification ¶
type Notification struct {
// contains filtered or unexported fields
}
func (*Notification) Send ¶
func (n *Notification) Send(action string)
func (*Notification) Start ¶
func (n *Notification) Start()
func (*Notification) Stop ¶
func (n *Notification) Stop()
func (*Notification) Subscribe ¶
func (n *Notification) Subscribe(handler func(action string))
type PriorityQueue ¶
type PriorityQueue struct {
*Queue
}
func (*PriorityQueue) Dequeue ¶
func (pq *PriorityQueue) Dequeue() (any, bool)
Dequeue removes and returns the highest priority item from the queue (lowest score)
func (*PriorityQueue) DequeueWithAckId ¶ added in v1.4.0
func (pq *PriorityQueue) DequeueWithAckId() (any, bool, string)
func (*PriorityQueue) Enqueue ¶
func (pq *PriorityQueue) Enqueue(item any, priority int) bool
Enqueue adds an item to the queue with a specified priority Lower priority values (closer to 1) will be dequeued first
func (*PriorityQueue) Len ¶
func (pq *PriorityQueue) Len() int
Len returns the number of items in the priority queue
func (*PriorityQueue) Remove ¶
func (pq *PriorityQueue) Remove(item any) bool
func (*PriorityQueue) RequeueNackedItems ¶ added in v1.4.0
func (pq *PriorityQueue) RequeueNackedItems() error
RequeueNackedItems checks for un-acknowledged items in the nacked list and returns them to the priority queue
func (*PriorityQueue) Values ¶
func (pq *PriorityQueue) Values() []any
Values returns all items in the priority queue ordered by priority (highest to lowest)
type Queue ¶
type Queue struct {
// contains filtered or unexported fields
}
func (*Queue) Acknowledge ¶
Acknowledge removes an item from the pending list indicating successful processing
func (*Queue) Dequeue ¶
Dequeue removes and returns an item from the queue without acknowledgment For reliable processing with acknowledgment, use DequeueWithAck instead
func (*Queue) GetNackedItemsCount ¶
GetNackedItemsCount returns the number of items in the nacked list
func (*Queue) PrepareForFutureAck ¶
PrepareForFutureAck adds an item to the pending list for acknowledgment tracking Returns an error if the operation fails
func (*Queue) RequeueNackedItems ¶
requeueNackedItems checks for un-acknowledged items in the nacked list and returns them to the main queue to be processed again
func (*Queue) SetAckTimeout ¶
SetAckTimeout sets the acknowledgment timeout for jobs This controls how long a job can be processing before being requeued
func (*Queue) SetExpiration ¶
SetExpiration sets the expiration time for the Queue
func (*Queue) SetVisibilityTimeout ¶ added in v1.4.0
SetVisibilityTimeout sets the visibility timeout for jobs This controls how long a job remains invisible in the nacked queue before being candidates for requeuing
type Queues ¶
type Queues interface {
NewQueue(queueKey string) *Queue
NewPriorityQueue(queueKey string) *PriorityQueue
NewDistributedQueue(queueKey string) *DistributedQueue
NewDistributedPriorityQueue(queueKey string) *DistributedPriorityQueue
Close() error
}