Documentation ¶
Index ¶
- type HandlerFunc
- type Subscription
- func (s *Subscription) AbandonMessage(ctx context.Context, m *azservicebus.ReceivedMessage)
- func (s *Subscription) Close(closeCtx context.Context)
- func (s *Subscription) CompleteMessage(ctx context.Context, m *azservicebus.ReceivedMessage)
- func (s *Subscription) Connect(newReceiverFunc func() (*azservicebus.Receiver, error)) error
- func (s *Subscription) ReceiveAndBlock(handler HandlerFunc, lockRenewalInSec int, onFirstSuccess func()) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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.