listener

package
v0.6.1-pre Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Listener

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

Listener is a struct to contain service bus entities relevant to subscribing to a publisher topic

func New

func New(opts ...ManagementOption) (*Listener, error)

New creates a new service bus listener

func (*Listener) Close

func (l *Listener) Close(ctx context.Context) error

Close closes the listener if an active listener exists

func (*Listener) GetActiveMessageCount added in v0.5.3

func (l *Listener) GetActiveMessageCount(ctx context.Context, topicName, subscriptionName string) (int32, error)

GetActiveMessageCount gets the active message count of a topic subscription WARNING: GetActiveMessageCount is 10 times expensive than a call to receive a message

func (*Listener) Listen

func (l *Listener) Listen(ctx context.Context, handler message.Handler, topicName string, opts ...Option) error

Listen waits for a message from the Service Bus Topic subscription

func (*Listener) Namespace

func (l *Listener) Namespace() *servicebus.Namespace

Namespace returns the servicebus.Namespace that the listener is setup with

func (*Listener) Subscription

func (l *Listener) Subscription() *servicebus.SubscriptionEntity

Subscription returns the servicebus.SubscriptionEntity that the listener is setup with

func (*Listener) Topic

func (l *Listener) Topic() *servicebus.TopicEntity

Topic returns servicebus.TopicEntity that the listener is setup with

type ManagementOption

type ManagementOption func(l *Listener) error

ManagementOption provides structure for configuring a new Listener

func WithConnectionString

func WithConnectionString(connStr string) ManagementOption

WithConnectionString configures a listener with the information provided in a Service Bus connection string

func WithFilterDescriber

func WithFilterDescriber(filterName string, filter servicebus.FilterDescriber) ManagementOption

WithFilterDescriber configures the filters on the subscription

func WithManagedIdentityClientID

func WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID string) ManagementOption

WithManagedIdentityClientID configures a listener with the attached managed identity and the Service bus resource name

func WithManagedIdentityResourceID

func WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID string) ManagementOption

WithManagedIdentityResourceID configures a listener with the attached managed identity and the Service bus resource name

func WithSubscriptionDetails added in v0.6.0

func WithSubscriptionDetails(lock time.Duration, maxDelivery int32) ManagementOption

WithSubscriptionDetails allows listeners to control subscription details for longer lived operations. If you using RetryLater you probably want this. Passing zeros leaves it up to Service bus defaults

func WithSubscriptionName

func WithSubscriptionName(name string) ManagementOption

WithSubscriptionName configures the subscription name of the subscription to listen to

func WithToken

func WithToken(serviceBusNamespaceName string, spt *adal.ServicePrincipalToken) ManagementOption

WithToken configures a listener with a AAD token

type Option

type Option func(l *Listener) error

Option provides structure for configuring when starting to listen to a specified topic

func WithMaxConcurrency added in v0.6.1

func WithMaxConcurrency(concurrency int) Option

func WithMessageLockAutoRenewal added in v0.6.1

func WithMessageLockAutoRenewal(interval time.Duration) Option

func WithPrefetchCount added in v0.6.1

func WithPrefetchCount(prefetch uint32) Option

WithPrefetchCount the receiver to quietly acquires more messages, up to the PrefetchCount limit. A single Receive call to the ServiceBus api therefore acquires several messages for immediate consumption that is returned as soon as available. Please be aware of the consequences : https://docs.microsoft.com/en-us/azure/service-bus-messaging/service-bus-prefetch#if-it-is-faster-why-is-prefetch-not-the-default-option

Jump to

Keyboard shortcuts

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