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 ¶
type Option ¶
type Option func(*Options)
type PublishOption ¶
type PublishOption func(*PublishOptions)
func PublishContext ¶
func PublishContext(ctx context.Context) PublishOption
PublishContext set context
type PublishOptions ¶
type SubscribeOption ¶
type SubscribeOption func(*SubscribeOptions)
func HandleError ¶
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 ¶
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 ¶
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.