publisher

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 DeadLetterTarget

type DeadLetterTarget struct {
}

type ManagementOption

type ManagementOption = publisheropts.ManagementOption

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 WithDefaultMessageMarshaller

func WithDefaultMessageMarshaller(marshaller marshal.Marshaller) ManagementOption

WithDefaultMessageMarshaller sets the Marshaller for the published message. Defaults to Json Marshaller

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 WithForwardDeadLetteredMessagesTo

func WithForwardDeadLetteredMessagesTo(deadLetterTargetName string, deliveryCount int) ManagementOption

WithForwardDeadLetteredMessagesTo forwards deadlettered messages to a targetable queue, the identity must have management permissions on said queue

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 = publisheropts.Option

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

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 {
	common.PublisherSettings
	// contains filtered or unexported fields
}

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

func New

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

New creates a new service bus publisher

func (*Publisher) AppendQueueManagementOption

func (p *Publisher) AppendQueueManagementOption(option servicebus.QueueManagementOption)

func (*Publisher) Close

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

func (*Publisher) Publish

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

Publish publishes to the pre-configured Service Bus queue

type QueuePublisher

type QueuePublisher interface {
	common.Publisher
	AppendQueueManagementOption(option servicebus.QueueManagementOption)
}

Jump to

Keyboard shortcuts

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