servicebus

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package servicebus provides an in-memory mock implementation of Azure Service Bus.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionTrigger

type FunctionTrigger func(queueURL string, message driver.Message)

FunctionTrigger is a function that gets called when a message is sent to a queue.

type Mock

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

Mock is an in-memory mock implementation of the Azure Service Bus service.

func New

func New(opts *config.Options) *Mock

New creates a new Service Bus mock with the given configuration options.

func (*Mock) ChangeVisibility

func (m *Mock) ChangeVisibility(_ context.Context, queueURL, receiptHandle string, timeout int) error

ChangeVisibility changes the lock duration (visibility timeout) of a message in the specified queue.

func (*Mock) CreateQueue

func (m *Mock) CreateQueue(_ context.Context, cfg driver.QueueConfig) (*driver.QueueInfo, error)

CreateQueue creates a new Service Bus queue.

func (*Mock) DeleteMessage

func (m *Mock) DeleteMessage(_ context.Context, queueURL, receiptHandle string) error

DeleteMessage deletes (completes) a message from the specified queue using its receipt handle (lock token).

func (*Mock) DeleteQueue

func (m *Mock) DeleteQueue(_ context.Context, url string) error

DeleteQueue deletes a Service Bus queue by URL.

func (*Mock) GetQueueInfo

func (m *Mock) GetQueueInfo(_ context.Context, url string) (*driver.QueueInfo, error)

GetQueueInfo retrieves information about a Service Bus queue by URL.

func (*Mock) ListQueues

func (m *Mock) ListQueues(_ context.Context, prefix string) ([]driver.QueueInfo, error)

ListQueues returns all queues whose names match the given prefix. If prefix is empty, all queues are returned.

func (*Mock) ReceiveMessages

func (m *Mock) ReceiveMessages(_ context.Context, input driver.ReceiveMessageInput) ([]driver.Message, error)

ReceiveMessages receives messages from the specified Service Bus queue. Returns messages where VisibleAt <= now, and sets a new VisibleAt based on the visibility timeout.

func (*Mock) RemoveTrigger

func (m *Mock) RemoveTrigger(queueURL string)

RemoveTrigger removes a Function trigger from a queue.

func (*Mock) SendMessage

SendMessage sends a message to the specified Service Bus queue.

func (*Mock) SetTrigger

func (m *Mock) SetTrigger(queueURL string, fn FunctionTrigger)

SetTrigger registers an Azure Function trigger for a queue.

Jump to

Keyboard shortcuts

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