Help us shape the future of Go! Take the 2026 Go Developer Survey

queue

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Overview

Package queue emulates Azure Queue Storage on Azurite's port (10001): queues with metadata and access policies, and messages with visibility timeouts, TTLs, pop receipts, peek, update and clear. Connect with a connection string whose QueueEndpoint is http://127.0.0.1:10001/devstoreaccount1. Shared Key and SAS are accepted without signature checks.

Index

Constants

View Source
const Port = 10001

Port is Azurite's queue port.

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	Queues map[string]*Queue `json:"queues"`
	Props  string            `json:"props,omitempty"` // service properties XML
}

Account is a storage account (devstoreaccount1 by default).

type Message

type Message struct {
	ID           string    `json:"id"`
	Text         string    `json:"text"`
	Inserted     time.Time `json:"inserted"`
	Expires      time.Time `json:"expires"`
	NextVisible  time.Time `json:"nextVisible"`
	DequeueCount int64     `json:"dequeueCount"`
	PopReceipt   string    `json:"popReceipt"`
}

Message is a queue message.

type Queue

type Queue struct {
	Name     string            `json:"name"`
	Meta     map[string]string `json:"meta,omitempty"`
	ACL      string            `json:"acl,omitempty"` // SignedIdentifiers XML
	Messages []*Message        `json:"messages"`
}

Queue holds messages in arrival order. ponytail: operations scan the slice; index by id if queues get deep.

type Service

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

Service is the Queue Storage emulator.

func New

func New(hub *core.Hub) *Service

New creates the Queue Storage service.

func (*Service) DropAccount

func (s *Service) DropAccount(name string)

DropAccount forgets a storage account's queues; the blob package calls it when the account is deleted.

func (*Service) Info

func (s *Service) Info() core.Info

func (*Service) Inspect

func (s *Service) Inspect(table, id string) any

Inspect returns a queue's metadata and a peek at its first 20 visible messages.

func (*Service) Load

func (s *Service) Load(b []byte) error

func (*Service) Peek

func (s *Service) Peek(account, queue string, max int) []Message

Peek returns up to max visible messages without changing them.

func (*Service) Port

func (s *Service) Port() int

func (*Service) Reset

func (s *Service) Reset()

func (*Service) Resources

func (s *Service) Resources() []core.Table

Resources lists queues across accounts.

func (*Service) Save

func (s *Service) Save() ([]byte, error)

func (*Service) Send

func (s *Service) Send(account, queue, text string) error

Send enqueues a message that is visible now and lives for 7 days.

func (*Service) ServeHTTP

func (s *Service) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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