httpapi

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Router

func Router(queue *blockqueue.Queue, options Options) http.Handler

Types

type BatchNackRequest

type BatchNackRequest struct {
	MessageID    string `json:"message_id"`
	ReceiptToken string `json:"receipt_token"`
	RetryDelay   string `json:"retry_delay,omitempty"`
	Error        string `json:"error,omitempty"`
}

type BatchReceiptRequest

type BatchReceiptRequest struct {
	MessageID    string `json:"message_id"`
	ReceiptToken string `json:"receipt_token"`
}

type CancelRequest

type CancelRequest struct {
	Reason string `json:"reason,omitempty"`
}

type ErrorMapper

type ErrorMapper func(error) (status int, code, message string)

type Handler

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

func New

func New(service Service, mapper ErrorMapper) *Handler

func (*Handler) Attach

func (h *Handler) Attach(root chi.Router)

type LeaseRequest

type LeaseRequest struct {
	ReceiptToken string `json:"receipt_token"`
	Extension    string `json:"extension,omitempty"`
}

type NackRequest

type NackRequest struct {
	ReceiptToken string `json:"receipt_token"`
	RetryDelay   string `json:"retry_delay,omitempty"`
	Error        string `json:"error,omitempty"`
}

type Options

type Options struct {
	// Prefix defaults to /v1. Handler.Attach can be used directly when the
	// embedding application wants to own all routing decisions.
	Prefix    string
	UIPath    string
	DisableUI bool
	// AuthMiddleware is applied only to the versioned API. Health checks,
	// OpenAPI, and static UI remain available for the embedding application to
	// protect at a wider router boundary when desired.
	AuthMiddleware func(http.Handler) http.Handler
}

type PublishRequest

type PublishRequest struct {
	Message        string            `json:"message"`
	Headers        map[string]string `json:"headers,omitempty"`
	CorrelationID  string            `json:"correlation_id,omitempty"`
	IdempotencyKey string            `json:"idempotency_key,omitempty"`
	Priority       int               `json:"priority,omitempty"`
	Delay          string            `json:"delay,omitempty"`
	ScheduleAt     string            `json:"schedule_at,omitempty"`
}

type ReceiptRequest

type ReceiptRequest struct {
	ReceiptToken string `json:"receipt_token"`
}

type ReplayRequest

type ReplayRequest struct {
	MessageIDs []string `json:"message_ids"`
}

type ScheduleRequest

type ScheduleRequest struct {
	Name           string            `json:"name"`
	CronExpression string            `json:"cron"`
	Timezone       string            `json:"timezone,omitempty"`
	Message        string            `json:"message"`
	Headers        map[string]string `json:"headers,omitempty"`
	CorrelationID  string            `json:"correlation_id,omitempty"`
	Priority       int               `json:"priority,omitempty"`
	MisfirePolicy  string            `json:"misfire_policy,omitempty"`
	OverlapPolicy  string            `json:"overlap_policy,omitempty"`
}

type ScheduleUpdateRequest

type ScheduleUpdateRequest struct {
	Version int `json:"version"`
	ScheduleRequest
}

type Service

type Service interface {
	GetTopics(context.Context, blockqueue.TopicFilter) (blockqueue.Topics, error)
	GetTopic(string) (blockqueue.Topic, bool)
	CreateTopic(context.Context, blockqueue.Topic, blockqueue.Subscribers) error
	DeleteTopic(context.Context, blockqueue.Topic) error
	GetSubscribersStatus(context.Context, blockqueue.Topic) (blockqueue.SubscriberStatuses, error)
	CreateSubscribers(context.Context, blockqueue.Topic, blockqueue.Subscribers) error
	DeleteSubscriber(context.Context, blockqueue.Topic, string) error
	PublishAsync(context.Context, blockqueue.Topic, blockqueue.Message) (blockqueue.PublishReceipt, error)
	PublishDurable(context.Context, blockqueue.Topic, blockqueue.Message) (blockqueue.PublishReceipt, error)
	BatchPublishAsync(context.Context, blockqueue.Topic, []blockqueue.Message) (blockqueue.PublishReceipts, error)
	BatchPublishDurable(context.Context, blockqueue.Topic, []blockqueue.Message) (blockqueue.PublishReceipts, error)
	GetMessageStatus(context.Context, blockqueue.Topic, string) (blockqueue.MessageStatus, error)
	ClaimWait(context.Context, blockqueue.Topic, string, int, time.Duration) (blockqueue.Deliveries, error)
	AckDelivery(context.Context, blockqueue.Topic, string, string, string) error
	NackDelivery(context.Context, blockqueue.Topic, string, string, string, time.Duration, string) error
	ExtendLease(context.Context, blockqueue.Topic, string, string, string, time.Duration) (time.Time, error)
	BatchAckDeliveries(context.Context, blockqueue.Topic, string, []blockqueue.BatchAckItem) []blockqueue.DeliveryResult
	BatchNackDeliveries(context.Context, blockqueue.Topic, string, []blockqueue.BatchNackItem) []blockqueue.DeliveryResult
	SnoozeDelivery(context.Context, blockqueue.Topic, string, string, string, time.Duration) (time.Time, error)
	CancelDelivery(context.Context, blockqueue.Topic, string, string, string) error
	CancelMessage(context.Context, blockqueue.Topic, string, string) ([]blockqueue.DeliveryResult, error)
	DeliveryErrors(context.Context, blockqueue.Topic, string, string, int, string) (blockqueue.DeliveryErrorPage, error)
	ListDeliveries(context.Context, blockqueue.Topic, string, bool, int, string) (blockqueue.DeliveryPage, error)
	ReplayDeadLetters(context.Context, blockqueue.Topic, string, []string) []blockqueue.DeliveryResult
	PauseTopic(context.Context, blockqueue.Topic) error
	ResumeTopic(context.Context, blockqueue.Topic) error
	PauseSubscriber(context.Context, blockqueue.Topic, string) error
	ResumeSubscriber(context.Context, blockqueue.Topic, string) error
	ListSchedules(context.Context, blockqueue.Topic) ([]blockqueue.Schedule, error)
	CreateSchedule(context.Context, blockqueue.Topic, blockqueue.ScheduleInput) (blockqueue.Schedule, error)
	GetSchedule(context.Context, blockqueue.Topic, string) (blockqueue.Schedule, error)
	UpdateSchedule(context.Context, blockqueue.Topic, string, int, blockqueue.ScheduleInput) (blockqueue.Schedule, error)
	DeleteSchedule(context.Context, blockqueue.Topic, string) error
	PauseSchedule(context.Context, blockqueue.Topic, string, bool) error
	RunScheduleNow(context.Context, blockqueue.Topic, string, bool) (blockqueue.ScheduleRun, error)
	ScheduleRunHistory(context.Context, blockqueue.Topic, string, int, string) (blockqueue.ScheduleRunPage, error)
}

Service is the application port consumed by the HTTP transport.

type SnoozeRequest

type SnoozeRequest struct {
	ReceiptToken string `json:"receipt_token"`
	Delay        string `json:"delay"`
}

type SubscriberOptions

type SubscriberOptions struct {
	MaxAttempts        int                    `json:"max_attempts"`
	VisibilityDuration string                 `json:"visibility_duration"`
	DequeueBatchSize   int                    `json:"dequeue_batch_size,omitempty"`
	RetryPolicy        blockqueue.RetryPolicy `json:"retry_policy,omitempty"`
}

type SubscriberRequest

type SubscriberRequest struct {
	Name   string            `json:"name"`
	Option SubscriberOptions `json:"option"`
}

type TopicRequest

type TopicRequest struct {
	Name        string              `json:"name"`
	Subscribers []SubscriberRequest `json:"subscribers"`
}

Jump to

Keyboard shortcuts

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