Skip to content

Commit

Permalink
Add aliases to support existing users on next release (#63)
Browse files Browse the repository at this point in the history
* adding alias for publishers
* adding listener alias
  • Loading branch information
imiller31 authored Aug 9, 2021
1 parent 3550d6e commit d222c91
Show file tree
Hide file tree
Showing 3 changed files with 239 additions and 0 deletions.
93 changes: 93 additions & 0 deletions listener/alias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
package listener

import (
"time"

servicebus "github.com/Azure/azure-service-bus-go"
"github.com/Azure/go-autorest/autorest/adal"
topic "github.com/Azure/go-shuttle/topic/listener"
)

// Deprecated: use topic package
type Listener = topic.Listener

// Deprecated: use topic package
type Option = topic.Option

// Deprecated: use topic package
type ManagementOption = topic.ManagementOption

// Deprecated: use topic package
func New(opts ...ManagementOption) (*Listener, error) {
return topic.New(opts...)
}

// Deprecated: use topic package
func WithMessageLockAutoRenewal(interval time.Duration) Option {
return topic.WithMessageLockAutoRenewal(interval)
}

// Deprecated: use topic package
func WithConnectionString(connStr string) ManagementOption {
return topic.WithConnectionString(connStr)
}

// Deprecated: use topic package
func WithEnvironmentName(environmentName string) ManagementOption {
return topic.WithEnvironmentName(environmentName)
}

// Deprecated: use topic package
func WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID string) ManagementOption {
return topic.WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID)
}

// Deprecated: use topic package
func WithToken(serviceBusNamespaceName string, spt *adal.ServicePrincipalToken) ManagementOption {
return topic.WithToken(serviceBusNamespaceName, spt)
}

// Deprecated: use topic package
func WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID string) ManagementOption {
return topic.WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID)
}

// Deprecated: use topic package
func WithSubscriptionDetails(lock time.Duration, maxDelivery int32) ManagementOption {
return topic.WithSubscriptionDetails(lock, maxDelivery)
}

// Deprecated: use topic package
func WithLockDuration(lock time.Duration) ManagementOption {
return topic.WithLockDuration(lock)
}

// Deprecated: use topic package
func WithMaxDeliveryCount(maxDelivery int32) ManagementOption {
return topic.WithMaxDeliveryCount(maxDelivery)
}

// Deprecated: use topic package
func WithPrefetchCount(prefetch uint32) Option {
return topic.WithPrefetchCount(prefetch)
}

// Deprecated: use topic package
func WithMaxConcurrency(concurrency int) Option {
return topic.WithMaxConcurrency(concurrency)
}

// Deprecated: use topic package
func WithSubscriptionName(name string) ManagementOption {
return topic.WithSubscriptionName(name)
}

// Deprecated: use topic package
func WithFilterDescriber(filterName string, filter servicebus.FilterDescriber) ManagementOption {
return topic.WithFilterDescriber(filterName, filter)
}

// Deprecated: use topic package
func WithTypeFilter(event interface{}) ManagementOption {
return topic.WithTypeFilter(event)
}
73 changes: 73 additions & 0 deletions publisher/queue/alias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package queue

import (
"context"
"time"

"github.com/Azure/go-autorest/autorest/adal"
queue "github.com/Azure/go-shuttle/queue/publisher"
)

// Deprecated: use queue package
type Publisher = queue.Publisher

// Deprecated: use queue package
type ManagementOption = queue.ManagementOption

// Deprecated: use queue package
type Option = queue.Option

// Deprecated: use queue package
func New(ctx context.Context, topicName string, opts ...ManagementOption) (*Publisher, error) {
return New(ctx, topicName, opts...)
}

// Deprecated: use queue package
func WithConnectionString(connStr string) ManagementOption {
return WithConnectionString(connStr)
}

// Deprecated: use queue package
func WithEnvironmentName(environmentName string) ManagementOption {
return WithEnvironmentName(environmentName)
}

// Deprecated: use queue package
func WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID string) ManagementOption {
return WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID)
}

// Deprecated: use queue package
func WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID string) ManagementOption {
return WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID)
}

// Deprecated: use queue package
func WithToken(serviceBusNamespaceName string, spt *adal.ServicePrincipalToken) ManagementOption {
return WithToken(serviceBusNamespaceName, spt)
}

// Deprecated: use queue package
func SetDefaultHeader(headerName, msgKey string) ManagementOption {
return SetDefaultHeader(headerName, msgKey)
}

// Deprecated: use queue package
func WithDuplicateDetection(window *time.Duration) ManagementOption {
return WithDuplicateDetection(window)
}

// Deprecated: use queue package
func SetMessageDelay(delay time.Duration) Option {
return SetMessageDelay(delay)
}

// Deprecated: use queue package
func SetMessageID(messageID string) Option {
return SetMessageID(messageID)
}

// Deprecated: use queue package
func SetCorrelationID(correlationID string) Option {
return SetCorrelationID(correlationID)
}
73 changes: 73 additions & 0 deletions publisher/topic/alias.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package topic

import (
"context"
"time"

"github.com/Azure/go-autorest/autorest/adal"
topic "github.com/Azure/go-shuttle/topic/publisher"
)

// Deprecated: use topic package
type Publisher = topic.Publisher

// Deprecated: use topic package
type ManagementOption = topic.ManagementOption

// Deprecated: use topic package
type Option = topic.Option

// Deprecated: use topic package
func New(ctx context.Context, topicName string, opts ...ManagementOption) (*Publisher, error) {
return New(ctx, topicName, opts...)
}

// Deprecated: use topic package
func WithConnectionString(connStr string) ManagementOption {
return WithConnectionString(connStr)
}

// Deprecated: use topic package
func WithEnvironmentName(environmentName string) ManagementOption {
return WithEnvironmentName(environmentName)
}

// Deprecated: use topic package
func WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID string) ManagementOption {
return WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID)
}

// Deprecated: use topic package
func WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID string) ManagementOption {
return WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID)
}

// Deprecated: use topic package
func WithToken(serviceBusNamespaceName string, spt *adal.ServicePrincipalToken) ManagementOption {
return WithToken(serviceBusNamespaceName, spt)
}

// Deprecated: use topic package
func SetDefaultHeader(headerName, msgKey string) ManagementOption {
return SetDefaultHeader(headerName, msgKey)
}

// Deprecated: use topic package
func WithDuplicateDetection(window *time.Duration) ManagementOption {
return WithDuplicateDetection(window)
}

// Deprecated: use topic package
func SetMessageDelay(delay time.Duration) Option {
return SetMessageDelay(delay)
}

// Deprecated: use topic package
func SetMessageID(messageID string) Option {
return SetMessageID(messageID)
}

// Deprecated: use topic package
func SetCorrelationID(correlationID string) Option {
return SetCorrelationID(correlationID)
}

0 comments on commit d222c91

Please sign in to comment.