Documentation ¶
Overview ¶
Package broker is an interface used for asynchronous messaging
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker interface { Init(...Option) error Options() Options Address() string Connect() error Disconnect() error Publish(topic string, m *Message, opts ...PublishOption) error Subscribe(topic string, h Handler, opts ...SubscribeOption) (Subscriber, error) String() string }
Broker is an interface used for asynchronous messaging.
type ErrorHandler ¶ added in v1.18.2
type Option ¶
type Option func(*Options)
type PublishOption ¶
type PublishOption func(*PublishOptions)
func PublishContext ¶ added in v1.18.2
func PublishContext(ctx context.Context) PublishOption
PublishContext set context
type PublishOptions ¶
type SubscribeOption ¶
type SubscribeOption func(*SubscribeOptions)
func HandleError ¶ added in v1.18.2
func HandleError(h ErrorHandler) SubscribeOption
ErrorHandler will catch all broker errors that cant be handled in normal way, for example Codec errors
func Queue ¶
func Queue(name string) SubscribeOption
Queue sets the name of the queue to share messages on
func SubscribeContext ¶ added in v0.23.0
func SubscribeContext(ctx context.Context) SubscribeOption
SubscribeContext set context
type SubscribeOptions ¶
type SubscribeOptions struct { // Handler executed when errors occur processing messages ErrorHandler ErrorHandler // Subscribers with the same queue name // will create a shared subscription where each // receives a subset of messages. Queue string // Other options for implementations of the interface // can be stored in a context Context context.Context }
func NewSubscribeOptions ¶ added in v0.15.0
func NewSubscribeOptions(opts ...SubscribeOption) SubscribeOptions
type Subscriber ¶
type Subscriber interface { Options() SubscribeOptions Topic() string Unsubscribe() error }
Subscriber is a convenience return type for the Subscribe method
Click to show internal directories.
Click to hide internal directories.