Documentation
¶
Index ¶
Constants ¶
const DefaultVersionHeaderKey = "application-version"
DefaultVersionHeaderKey is the field that will be added to a message to get the version.
Variables ¶
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.