servicebus

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNetworkError added in v1.9.0

func IsNetworkError(err error) bool

IsNetworkError returns true if the error returned by Service Bus is a network-level one, which would require reconnecting.

Types

type HandlerFunc

type HandlerFunc func(ctx context.Context, msg *azservicebus.ReceivedMessage) error

HandlerFunc is the type for handlers that receive messages

type Subscription

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

Subscription is an object that manages a subscription to an Azure Service Bus receiver, for a topic or queue.

func NewSubscription

func NewSubscription(
	parentCtx context.Context,
	maxActiveMessages int,
	timeoutInSec int,
	maxRetriableEPS int,
	maxConcurrentHandlers *int,
	entity string,
	logger logger.Logger,
) *Subscription

NewSubscription returns a new Subscription object. Parameter "entity" is usually in the format "topic <topicname>" or "queue <queuename>" and it's only used for logging.

func (*Subscription) AbandonMessage

func (s *Subscription) AbandonMessage(ctx context.Context, m *azservicebus.ReceivedMessage)

AbandonMessage marks a messsage as abandoned.

func (*Subscription) Close

func (s *Subscription) Close(closeCtx context.Context)

Close the receiver and stops watching for new messages.

func (*Subscription) CompleteMessage

func (s *Subscription) CompleteMessage(ctx context.Context, m *azservicebus.ReceivedMessage)

CompleteMessage marks a message as complete.

func (*Subscription) Connect

func (s *Subscription) Connect(newReceiverFunc func() (*azservicebus.Receiver, error)) error

Connect to a Service Bus topic or queue, blocking until it succeeds; it can retry forever (until the context is canceled).

func (*Subscription) ReceiveAndBlock

func (s *Subscription) ReceiveAndBlock(handler HandlerFunc, lockRenewalInSec int, onFirstSuccess func()) error

ReceiveAndBlock is a blocking call to receive messages on an Azure Service Bus subscription from a topic or queue.

Jump to

Keyboard shortcuts

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