versioning

package
v0.33.4 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultVersionHeaderKey = "application-version"

DefaultVersionHeaderKey is the field that will be added to a message to get the version.

Variables

View Source
var (
	// ErrNoVersion happens when there is no version in the context or the message.
	ErrNoVersion = fmt.Errorf("%w: no version present", extensions.ErrAsyncAPI)
)

Functions

This section is empty.

Types

type Wrapper

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

Wrapper allows to use multiple version of the same App/User Controllers on one Broker Controller in order to handle migrations.

func NewWrapper

func NewWrapper(broker extensions.BrokerController, options ...WrapperOption) *Wrapper

NewWrapper creates a Version Wrapper around a Broker Controller.

func (*Wrapper) Publish

func (w *Wrapper) Publish(ctx context.Context, channel string, mw extensions.BrokerMessage) error

Publish a message to the broker.

func (*Wrapper) Subscribe

func (w *Wrapper) Subscribe(ctx context.Context, channel string) (extensions.BrokerChannelSubscription, error)

Subscribe to messages from the broker.

type WrapperOption

type WrapperOption func(versionWrapper *Wrapper)

WrapperOption adds an option to Version Wrapper.

func WithDefaultVersion

func WithDefaultVersion(version string) WrapperOption

WithDefaultVersion lets add a default version to tag messages that don't have versions tagged.

func WithLogger

func WithLogger(logger extensions.Logger) WrapperOption

WithLogger lets add a logger to the Wrapper struct.

func WithVersionHeaderKey

func WithVersionHeaderKey(headerKey string) WrapperOption

WithVersionHeaderKey lets use a different version header key to add application version to published messages and retrieve it from received messages.

Jump to

Keyboard shortcuts

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