exported

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// EventConn is used whenever we create a connection or any links (ie: receivers, senders).
	EventConn log.Event = "azeh.Conn"

	// EventAuth is used when we're doing authentication/claims negotiation.
	EventAuth log.Event = "azeh.Auth"

	// EventProducer represents operations that happen on Producers.
	EventProducer log.Event = "azeh.Producer"

	// EventConsumer represents operations that happen on Consumers.
	EventConsumer log.Event = "azeh.Consumer"
)

NOTE: these are publicly exported via type-aliasing in azeventhubs/log.go

Variables

This section is empty.

Functions

func NewError

func NewError(code ErrorCode, innerErr error) error

NewError creates a new `Error` instance. NOTE: this function is only exported so it can be used by the `internal` package. It is not available for customers.

Types

type ConnectionStringProperties added in v0.5.0

type ConnectionStringProperties struct {
	// Endpoint is the Endpoint value in the connection string.
	// Ex: sb://example.servicebus.windows.net
	Endpoint string

	// EntityPath is EntityPath value in the connection string.
	EntityPath *string

	// FullyQualifiedNamespace is the Endpoint value without the protocol scheme.
	// Ex: example.servicebus.windows.net
	FullyQualifiedNamespace string

	// SharedAccessKey is the SharedAccessKey value in the connection string.
	SharedAccessKey *string

	// SharedAccessKeyName is the SharedAccessKeyName value in the connection string.
	SharedAccessKeyName *string

	// SharedAccessSignature is the SharedAccessSignature value in the connection string.
	SharedAccessSignature *string

	// Emulator indicates that the connection string is for an emulator:
	// ex: Endpoint=localhost:6765;SharedAccessKeyName=<< REDACTED >>;SharedAccessKey=<< REDACTED >>;UseDevelopmentEmulator=true
	Emulator bool
}

ConnectionStringProperties are the properties of a connection string as returned by ParseConnectionString.

func ParseConnectionString added in v0.5.0

func ParseConnectionString(connStr string) (ConnectionStringProperties, error)

ParseConnectionString takes a connection string from the Azure portal and returns the parsed representation.

There are two supported formats:

  1. Connection strings generated from the portal (or elsewhere) that contain an embedded key and keyname.

  2. A connection string with an embedded SharedAccessSignature: Endpoint=sb://<sb>.servicebus.windows.net;SharedAccessSignature=SharedAccessSignature sr=<sb>.servicebus.windows.net&sig=<base64-sig>&se=<expiry>&skn=<keyname>"

type Error

type Error struct {
	// Code is a stable error code which can be used as part of programatic error handling.
	// The codes can expand in the future, but the values (and their meaning) will remain the same.
	Code ErrorCode
	// contains filtered or unexported fields
}

Error represents an Event Hub specific error. NOTE: the Code is considered part of the published API but the message that comes back from Error(), as well as the underlying wrapped error, are NOT and are subject to change.

func (*Error) Error

func (e *Error) Error() string

Error is an error message containing the code and a user friendly message, if any.

type ErrorCode added in v0.2.0

type ErrorCode string

ErrorCode is an error code, usable by consuming code to work with programatically.

const (
	// ErrorCodeUnauthorizedAccess means the credentials provided are not valid for use with
	// a particular entity, or have expired.
	ErrorCodeUnauthorizedAccess ErrorCode = "unauthorized"

	// ErrorCodeConnectionLost means our connection was lost and all retry attempts failed.
	// This typically reflects an extended outage or connection disruption and may
	// require manual intervention.
	ErrorCodeConnectionLost ErrorCode = "connlost"

	// ErrorCodeOwnershipLost means that a partition that you were reading from was opened
	// by another link with an epoch/owner level greater or equal to your [PartitionClient].
	//
	// When using types like the [Processor], partition ownership will change as instances
	// rebalance.
	ErrorCodeOwnershipLost ErrorCode = "ownershiplost"
)

type RetryOptions

type RetryOptions struct {
	// MaxRetries specifies the maximum number of attempts a failed operation will be retried
	// before producing an error.
	// The default value is three.  A value less than zero means one try and no retries.
	MaxRetries int32

	// RetryDelay specifies the initial amount of delay to use before retrying an operation.
	// The delay increases exponentially with each retry up to the maximum specified by MaxRetryDelay.
	// The default value is four seconds.  A value less than zero means no delay between retries.
	RetryDelay time.Duration

	// MaxRetryDelay specifies the maximum delay allowed before retrying an operation.
	// Typically the value is greater than or equal to the value specified in RetryDelay.
	// The default Value is 120 seconds.  A value less than zero means there is no cap.
	MaxRetryDelay time.Duration
}

RetryOptions represent the options for retries.

type WebSocketConnParams added in v0.2.0

type WebSocketConnParams struct {
	// Host is the the `wss://<host>` to connect to
	Host string
}

WebSocketConnParams are the arguments to the NewWebSocketConn function you pass if you want to enable websockets.

Jump to

Keyboard shortcuts

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