Documentation
¶
Overview ¶
Package queue provides asynchronous webhook delivery with worker pool.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
Config holds configuration for the delivery queue.
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a default queue configuration.
type DeliveryItem ¶
type DeliveryItem struct {
Webhook *webhook.Webhook
WebhookID string // The config ID for tracking
EventID string
}
DeliveryItem represents a webhook to be delivered.
type DeliveryQueue ¶
type DeliveryQueue struct {
// contains filtered or unexported fields
}
DeliveryQueue manages asynchronous webhook delivery with a worker pool.
func NewDeliveryQueue ¶
func NewDeliveryQueue( client *webhook.Client, repo repository.WebhookRepository, cfg Config, opts ...Option, ) *DeliveryQueue
NewDeliveryQueue creates a new delivery queue with the specified configuration.
func (*DeliveryQueue) Enqueue ¶
func (q *DeliveryQueue) Enqueue(item DeliveryItem) bool
Enqueue adds a webhook to the delivery queue. Returns false if the queue is full or stopped.
func (*DeliveryQueue) Pending ¶
func (q *DeliveryQueue) Pending() int
Pending returns the number of items waiting in the queue.
func (*DeliveryQueue) Start ¶
func (q *DeliveryQueue) Start(ctx context.Context)
Start begins processing webhooks from the queue.
func (*DeliveryQueue) Stop ¶
func (q *DeliveryQueue) Stop()
Stop gracefully shuts down the queue, waiting for pending deliveries.
type Logger ¶
type Logger interface {
Info(msg string, args ...any)
Error(msg string, args ...any)
Debug(msg string, args ...any)
Warn(msg string, args ...any)
}
Logger defines the logging interface for the queue.