topic

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ManagementOption

type ManagementOption func(p *Publisher) error

ManagementOption provides structure for configuring a new Publisher

func SetDefaultHeader

func SetDefaultHeader(headerName, msgKey string) ManagementOption

SetDefaultHeader adds a header to every message published using the value specified from the message body

func WithConnectionString

func WithConnectionString(connStr string) ManagementOption

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

func WithDuplicateDetection

func WithDuplicateDetection(window *time.Duration) ManagementOption

SetDuplicateDetection guarantees that the topic will have exactly-once delivery over a user-defined span of time. Defaults to 30 seconds with a maximum of 7 days

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 WithManagedIdentityClientID

func WithManagedIdentityClientID(serviceBusNamespaceName, managedIdentityClientID string) ManagementOption

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

func WithManagedIdentityResourceID

func WithManagedIdentityResourceID(serviceBusNamespaceName, managedIdentityResourceID string) ManagementOption

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

func WithToken

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

type Option

type Option func(msg *servicebus.Message) error

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

func SetCorrelationID

func SetCorrelationID(correlationID string) Option

SetCorrelationID sets the SetCorrelationID of the message.

func SetMessageDelay

func SetMessageDelay(delay time.Duration) Option

SetMessageDelay schedules a message in the future

func SetMessageID

func SetMessageID(messageID string) Option

SetMessageID sets the messageID of the message. Used for duplication detection

type Publisher

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

Publisher is a struct to contain service bus entities relevant to publishing to a topic

func New

func New(ctx context.Context, topicName string, opts ...ManagementOption) (*Publisher, error)

New creates a new service bus publisher

func (*Publisher) Close

func (p *Publisher) Close(ctx context.Context) error

func (*Publisher) Namespace

func (p *Publisher) Namespace() *servicebus.Namespace

func (*Publisher) Publish

func (p *Publisher) Publish(ctx context.Context, msg interface{}, opts ...Option) error

Publish publishes to the pre-configured Service Bus topic

Jump to

Keyboard shortcuts

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