Documentation
¶
Index ¶
- type Listener
- func (l *Listener) Close(ctx context.Context) error
- func (l *Listener) GetActiveMessageCount(ctx context.Context, topicName, subscriptionName string) (int32, error)
- func (l *Listener) Listen(ctx context.Context, handler message.Handler, topicName string, opts ...Option) error
- func (l *Listener) Namespace() *servicebus.Namespace
- func (l *Listener) Subscription() *servicebus.SubscriptionEntity
- func (l *Listener) Topic() *servicebus.TopicEntity
- type ManagementOption
- func WithConnectionString(connStr string) ManagementOption
- func WithEnvironmentName(environmentName string) ManagementOption
- func WithFilterDescriber(filterName string, filter servicebus.FilterDescriber) ManagementOption
- func WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID string) ManagementOption
- func WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID string) ManagementOption
- func WithSubscriptionDetails(lock time.Duration, maxDelivery int32) ManagementOption
- func WithSubscriptionLockDuration(lock time.Duration) ManagementOption
- func WithSubscriptionMaxDeliveryCount(maxDelivery int32) ManagementOption
- func WithSubscriptionName(name string) ManagementOption
- func WithToken(serviceBusNamespaceName string, spt *adal.ServicePrincipalToken) ManagementOption
- func WithTypeFilter(event interface{}) ManagementOption
- type Option
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) 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 ¶
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 WithEnvironmentName ¶ added in v0.6.2
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 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 WithSubscriptionLockDuration ¶ added in v0.6.2
func WithSubscriptionLockDuration(lock time.Duration) ManagementOption
WithSubscriptionLockDuration allows listeners to control LockDuration. Passing zeros leaves it up to Service bus defaults
func WithSubscriptionMaxDeliveryCount ¶ added in v0.6.2
func WithSubscriptionMaxDeliveryCount(maxDelivery int32) ManagementOption
WithSubscriptionMaxDeliveryCount allows listeners to control MaxDeliveryCount. 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 ¶ added in v0.6.2
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 ¶
Option provides structure for configuring when starting to listen to a specified topic
func WithMaxConcurrency ¶ added in v0.6.1
func WithMessageLockAutoRenewal ¶ added in v0.6.1
func WithPrefetchCount ¶ added in v0.6.1
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