msgqueue

package
v0.8.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type QueuedMessage

type QueuedMessage struct {
	ID          string    `json:"id"`
	Text        string    `json:"text"`
	SessionID   string    `json:"session_id"`
	WorkspaceID string    `json:"workspace_id"`
	EnqueuedAt  time.Time `json:"enqueued_at"`
	RetryCount  int       `json:"retry_count"`
}

QueuedMessage represents a message held in the Redis-backed queue.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides a Redis-backed FIFO message queue per workspace+session.

func NewWithClient

func NewWithClient(client *redis.Client) *Service

NewWithClient creates a queue Service backed by the given Redis client. The client is borrowed — its lifecycle is managed by the caller.

func (*Service) Clear

func (s *Service) Clear(ctx context.Context, workspaceID, sessionID string) error

func (*Service) ClearWorkspace

func (s *Service) ClearWorkspace(ctx context.Context, workspaceID string) error

func (*Service) Dequeue

func (s *Service) Dequeue(ctx context.Context, workspaceID, sessionID string) (*QueuedMessage, error)

func (*Service) Enqueue

func (s *Service) Enqueue(ctx context.Context, workspaceID, sessionID, text string) (string, error)

func (*Service) Len

func (s *Service) Len(ctx context.Context, workspaceID, sessionID string) (int64, error)

func (*Service) PeekAll

func (s *Service) PeekAll(ctx context.Context, workspaceID, sessionID string) ([]QueuedMessage, error)

func (*Service) PeekAllGlobal

func (s *Service) PeekAllGlobal(ctx context.Context) ([]QueuedMessage, error)

PeekAllGlobal returns ALL queued messages across every workspace and session. It scans Redis for all queue keys matching the global prefix and peeks each one. The order of messages across workspaces/sessions is undefined. Use this for global operations like the periodic stranded-queue sweep.

func (*Service) PeekAllWorkspace

func (s *Service) PeekAllWorkspace(ctx context.Context, workspaceID string) ([]QueuedMessage, error)

PeekAllWorkspace returns all queued messages across every session for the given workspace. It scans Redis for all queue keys belonging to the workspace and peeks each one. The order of messages across sessions is undefined.

func (*Service) Remove

func (s *Service) Remove(ctx context.Context, workspaceID, sessionID, messageID string) error

func (*Service) Requeue

func (s *Service) Requeue(ctx context.Context, workspaceID, sessionID string, msg QueuedMessage) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL