Documentation ¶
Overview ¶
@Time : 2019/6/5 16:28 @Author : kenny zhu @File : broker @Software: GoLand @Others:
@Time : 2019/6/5 16:25 @Author : kenny zhu @File : options @Software: GoLand @Others:
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker interface { Options() Options Address() string Connect() error Disconnect() error Init(...Option) error Publish(string, *Message, ...PublishOption) error Subscribe(string, Handler, ...SubscribeOption) (Subscriber, error) String() string }
Broker is an interface used for asynchronous messaging.
type Handler ¶
type Handler func(Publication) error
Handler is used to process messages via a subscription of a topic.
type Option ¶
type Option func(*Options)
type Publication ¶
Publication is given to a subscription handler for processing
type PublishOption ¶
type PublishOption func(*PublishOptions)
type PublishOptions ¶
type SubscribeOption ¶
type SubscribeOption func(*SubscribeOptions)
func DisableAutoAck ¶
func DisableAutoAck() SubscribeOption
DisableAutoAck will disable auto acking of messages after they have been handled.
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 { // AutoAck defaults to true. When a handler returns // with a nil error the message is acked. AutoAck bool // 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.