Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrQueueAlreadyExists is returned when the queue already exists. ErrQueueAlreadyExists = errors.New("queue already exists") // ErrQueueNotFound is returned when the queue is not found. ErrQueueNotFound = errors.New("queue not found") // ErrMessageAlreadyExists is returned when the message already exists. ErrMessageAlreadyExists = errors.New("message already exists") // ErrMessageNotFound is returned when the message is not found. ErrMessageNotFound = errors.New("message not found") )
Functions ¶
Types ¶
type Config ¶
type Config struct {
Testing bool
LogLevel string
ServerHost string
ServerPort uint
ServerReadHeaderTimeoutSeconds uint
DatabaseURL string
TestDatabaseURL string
DatabaseMinConns uint
DatabaseMaxConns uint
QueueMaxNumberOfMessages uint
}
Config holds all application configuration data.
type Message ¶
type Message struct {
ID string `json:"id" db:"id"`
QueueID string `json:"queue_id" db:"queue_id"`
Label *string `json:"label" db:"label" form:"label"`
Body string `json:"body" db:"body" form:"body"`
Attributes map[string]string `json:"attributes" db:"attributes" form:"attributes"`
DeliveryAttempts uint `json:"delivery_attempts" db:"delivery_attempts"`
ExpiredAt time.Time `json:"-" db:"expired_at"`
ScheduledAt time.Time `json:"-" db:"scheduled_at"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"-" db:"updated_at"`
}
Message entity.
type MessageRepository ¶
type MessageRepository interface {
Create(ctx context.Context, message *Message) error
Get(ctx context.Context, id string) (*Message, error)
List(ctx context.Context, queue *Queue, label *string, limit uint) ([]*Message, error)
Ack(ctx context.Context, id string) error
Nack(ctx context.Context, id string, visibilityTimeoutSeconds uint) error
}
MessageRepository is the repository interface for the Message entity.
type MessageService ¶
type MessageService interface {
Create(ctx context.Context, message *Message) error
List(ctx context.Context, queueID string, label *string, limit uint) ([]*Message, error)
Ack(ctx context.Context, id string) error
Nack(ctx context.Context, id string, visibilityTimeoutSeconds uint) error
}
MessageService is the service interface for the Message entity.
type Queue ¶
type Queue struct {
ID string `json:"id" db:"id" form:"id"`
AckDeadlineSeconds uint `json:"ack_deadline_seconds" db:"ack_deadline_seconds" form:"ack_deadline_seconds"`
MessageRetentionSeconds uint `json:"message_retention_seconds" db:"message_retention_seconds" form:"message_retention_seconds"`
DeliveryDelaySeconds uint `json:"delivery_delay_seconds" db:"delivery_delay_seconds" form:"delivery_delay_seconds"`
CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
}
Queue entity.
type QueueRepository ¶
type QueueRepository interface {
Create(ctx context.Context, queue *Queue) error
Update(ctx context.Context, queue *Queue) error
Get(ctx context.Context, id string) (*Queue, error)
List(ctx context.Context, offset, limit int) ([]*Queue, error)
Delete(ctx context.Context, id string) error
Stats(ctx context.Context, id string) (*QueueStats, error)
Purge(ctx context.Context, id string) error
Cleanup(ctx context.Context, id string) error
}
QueueRepository is the repository interface for the Queue entity.
type QueueService ¶
type QueueService interface {
Create(ctx context.Context, queue *Queue) error
Update(ctx context.Context, queue *Queue) error
Get(ctx context.Context, id string) (*Queue, error)
List(ctx context.Context, offset, limit int) ([]*Queue, error)
Delete(ctx context.Context, id string) error
Stats(ctx context.Context, id string) (*QueueStats, error)
Purge(ctx context.Context, id string) error
Cleanup(ctx context.Context, id string) error
}
QueueService is the service interface for the Queue entity.
type QueueStats ¶
type QueueStats struct {
NumUndeliveredMessages int `json:"num_undelivered_messages"`
OldestUnackedMessageAgeSeconds int `json:"oldest_unacked_message_age_seconds"`
}
QueueStats entity.
Click to show internal directories.
Click to hide internal directories.