Documentation ¶
Overview ¶
Package broker is an interface used for asynchronous messaging
Index ¶
- Variables
- func Connect() error
- func Disconnect() error
- func Init(opts ...Option) error
- func Publish(topic string, msg *Message, opts ...PublishOption) error
- func String() string
- type Broker
- type Handler
- type Message
- type Option
- type Options
- type Publication
- type PublishOption
- type PublishOptions
- type SubscribeOption
- type SubscribeOptions
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DefaultSubPath = "/_sub"
)
Functions ¶
func Disconnect ¶
func Disconnect() error
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.
var (
DefaultBroker Broker = newHttpBroker()
)
type Handler ¶
type Handler func(Publication) error
Handler is used to process messages via a subscription of a topic. The handler is passed a publication interface which contains the message and optional Ack method to acknowledge receipt of the message.
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
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 }
type Subscriber ¶
type Subscriber interface { Options() SubscribeOptions Topic() string Unsubscribe() error }
Subscriber is a convenience return type for the Subscribe method
func Subscribe ¶
func Subscribe(topic string, handler Handler, opts ...SubscribeOption) (Subscriber, error)
Directories ¶
Path | Synopsis |
---|---|
gocloud
module
|
|
selector
Module
|
|
selector/dns
Module
|
|
selector/registry
Module
|
|
selector/static
Module
|
|
server/mock
Module
|
|
googlepubsub
module
|
|
grpc
module
|
|
proto
Module
|
|
kafka
module
|
|
memory
module
|
|
mqtt
module
|
|
transport/http
Module
|
|
nats
module
|
|
nsq
module
|
|
proxy
module
|
|
broker/memory
Module
|
|
rabbitmq
module
|
|
broker
Module
|
|
broker/http
Module
|
|
broker/memory
Module
|
|
codec/protorpc
Module
|
|
redis
module
|
|
broker
Module
|
|
broker/http
Module
|
|
broker/memory
Module
|
|
segmentio
module
|
|
snssqs
module
|
|
registry/gossip
Module
|
|
registry/gossip/proto
Module
|
|
selector/static
Module
|
|
sqs
module
|
|
stan
module
|
|
stomp
module
|
|
registry/gossip/proto
Module
|
Click to show internal directories.
Click to hide internal directories.