listener

package
v0.0.2-test Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: MIT Imports: 13 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 {
	common.ListenerSettings
	// 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) AppendFilterDefinition

func (l *Listener) AppendFilterDefinition(definition *filterDefinition)

func (*Listener) Close

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

Close closes the listener if an active listener exists

func (*Listener) GetActiveMessageCount

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) SetSubscriptionName

func (l *Listener) SetSubscriptionName(subscriptionName string)

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 = listeneropts.ManagementOption

func WithConnectionString

func WithConnectionString(connStr string) ManagementOption

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

func WithEnvironmentName

func WithEnvironmentName(environmentName string) ManagementOption

WithEnvironmentName configures the azure environment used to connect to Servicebus. The environment value used is then provided by Azure/go-autorest. ref: https://github.com/Azure/go-autorest/blob/c7f947c0610de1bc279f76e6d453353f95cd1bfa/autorest/azure/environments.go#L34

func WithFilterDescriber

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

WithFilterDescriber configures the filters on the subscription

func WithLockDuration

func WithLockDuration(lock time.Duration) ManagementOption

WithLockDuration allows listeners to control LockDuration. Passing zeros leaves it up to Service bus defaults

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 WithMaxDeliveryCount

func WithMaxDeliveryCount(maxDelivery int32) ManagementOption

WithQueueMaxDeliveryCount allows listeners to control MaxDeliveryCount. Passing zeros leaves it up to Service bus defaults

func WithSubscriptionDetails

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

WithDetails allows listeners to control Queue 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

func WithTypeFilter

func WithTypeFilter(event interface{}) ManagementOption

WithTypeFilter will subscribe to event of the go type provided. It uses the `type` property automatically to messages published via go-shuttle.

type Option

type Option = listeneropts.Option

func WithMaxConcurrency

func WithMaxConcurrency(concurrency int) Option

func WithMessageLockAutoRenewal

func WithMessageLockAutoRenewal(interval time.Duration) Option

func WithPrefetchCount

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

type TopicListener

type TopicListener interface {
	common.Listener
	SetSubscriptionName(subscriptionName string)
	AppendFilterDefinition(definition *filterDefinition)
}

Jump to

Keyboard shortcuts

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