Documentation
¶
Overview ¶
Package servicebus provides an in-memory mock implementation of Azure Service Bus.
Index ¶
- type FunctionTrigger
- type Mock
- func (m *Mock) ChangeVisibility(_ context.Context, queueURL, receiptHandle string, timeout int) error
- func (m *Mock) CreateQueue(_ context.Context, cfg driver.QueueConfig) (*driver.QueueInfo, error)
- func (m *Mock) DeleteMessage(_ context.Context, queueURL, receiptHandle string) error
- func (m *Mock) DeleteMessageBatch(ctx context.Context, queue string, entries []driver.BatchDeleteEntry) (*driver.BatchDeleteResult, error)
- func (m *Mock) DeleteQueue(_ context.Context, url string) error
- func (m *Mock) GetQueueAttributes(_ context.Context, queue string) (*driver.QueueAttributes, error)
- func (m *Mock) GetQueueInfo(_ context.Context, url string) (*driver.QueueInfo, error)
- func (m *Mock) ListQueues(_ context.Context, prefix string) ([]driver.QueueInfo, error)
- func (m *Mock) PurgeQueue(_ context.Context, queue string) error
- func (m *Mock) ReceiveMessages(_ context.Context, input driver.ReceiveMessageInput) ([]driver.Message, error)
- func (m *Mock) ReceiveMessagesWithOptions(_ context.Context, queue string, opts driver.ReceiveOptions) ([]driver.Message, error)
- func (m *Mock) RemoveTrigger(queueURL string)
- func (m *Mock) SendMessage(_ context.Context, input driver.SendMessageInput) (*driver.SendMessageOutput, error)
- func (m *Mock) SendMessageBatch(ctx context.Context, queue string, entries []driver.BatchSendEntry) (*driver.BatchSendResult, error)
- func (m *Mock) SetMonitoring(mon mondriver.Monitoring)
- func (m *Mock) SetQueueAttributes(_ context.Context, queue string, attrs map[string]int) error
- func (m *Mock) SetTrigger(queueURL string, fn FunctionTrigger)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FunctionTrigger ¶
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 (*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 ¶
CreateQueue creates a new Service Bus queue.
func (*Mock) DeleteMessage ¶
DeleteMessage deletes (completes) a message from the specified queue using its receipt handle (lock token).
func (*Mock) DeleteMessageBatch ¶ added in v1.2.0
func (m *Mock) DeleteMessageBatch( ctx context.Context, queue string, entries []driver.BatchDeleteEntry, ) (*driver.BatchDeleteResult, error)
DeleteMessageBatch deletes up to 10 messages from the specified Service Bus queue.
func (*Mock) DeleteQueue ¶
DeleteQueue deletes a Service Bus queue by URL.
func (*Mock) GetQueueAttributes ¶ added in v1.2.0
func (m *Mock) GetQueueAttributes( _ context.Context, queue string, ) (*driver.QueueAttributes, error)
GetQueueAttributes returns detailed attributes of the specified queue.
func (*Mock) GetQueueInfo ¶
GetQueueInfo retrieves information about a Service Bus queue by URL.
func (*Mock) ListQueues ¶
ListQueues returns all queues whose names match the given prefix. If prefix is empty, all queues are returned.
func (*Mock) PurgeQueue ¶ added in v1.2.0
PurgeQueue removes all messages from the specified queue.
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) ReceiveMessagesWithOptions ¶ added in v1.2.0
func (m *Mock) ReceiveMessagesWithOptions( _ context.Context, queue string, opts driver.ReceiveOptions, ) ([]driver.Message, error)
ReceiveMessagesWithOptions receives messages with configurable options.
func (*Mock) RemoveTrigger ¶
RemoveTrigger removes a Function trigger from a queue.
func (*Mock) SendMessage ¶
func (m *Mock) SendMessage(_ context.Context, input driver.SendMessageInput) (*driver.SendMessageOutput, error)
SendMessage sends a message to the specified Service Bus queue.
func (*Mock) SendMessageBatch ¶ added in v1.2.0
func (m *Mock) SendMessageBatch( ctx context.Context, queue string, entries []driver.BatchSendEntry, ) (*driver.BatchSendResult, error)
SendMessageBatch sends up to 10 messages to the specified Service Bus queue.
func (*Mock) SetMonitoring ¶ added in v1.2.0
func (m *Mock) SetMonitoring(mon mondriver.Monitoring)
SetMonitoring sets the monitoring backend for auto-metric generation.
func (*Mock) SetQueueAttributes ¶ added in v1.2.0
SetQueueAttributes updates the attributes of the specified queue.
func (*Mock) SetTrigger ¶
func (m *Mock) SetTrigger(queueURL string, fn FunctionTrigger)
SetTrigger registers an Azure Function trigger for a queue.