Documentation ¶
Overview ¶
Package broker defines standard interface for a message broker.
Index ¶
- type Broker
- type Encoder
- type Event
- type Handler
- type JSONEncoder
- type Message
- func (*Message) Descriptor() ([]byte, []int)
- func (m *Message) GetBody() []byte
- func (m *Message) GetHeader() map[string]string
- func (*Message) ProtoMessage()
- func (m *Message) Reset()
- func (m *Message) String() string
- func (m *Message) XXX_DiscardUnknown()
- func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *Message) XXX_Merge(src proto.Message)
- func (m *Message) XXX_Size() int
- func (m *Message) XXX_Unmarshal(b []byte) error
- type ProtoEncoder
- type PublishOption
- type PublishOptions
- type SubscribeOption
- type SubscribeOptions
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Broker ¶
type Broker interface { Publish(topic string, m *Message, opts ...PublishOption) error Subscribe(topic string, h Handler, opts ...SubscribeOption) (Subscriber, error) HealthCheck() health.CheckFunc }
Broker is an interface used for asynchronous messaging.
type Handler ¶
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 JSONEncoder ¶
type JSONEncoder struct{}
JSONEncoder JSON format encoder.
type Message ¶
type Message struct { Header map[string]string `` /* 153-byte string literal not displayed */ Body []byte `protobuf:"bytes,2,opt,name=body,proto3" json:"body,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
func (*Message) Descriptor ¶
func (*Message) ProtoMessage ¶
func (*Message) ProtoMessage()
func (*Message) XXX_DiscardUnknown ¶
func (m *Message) XXX_DiscardUnknown()
func (*Message) XXX_Marshal ¶
func (*Message) XXX_Unmarshal ¶
type ProtoEncoder ¶
type ProtoEncoder struct{}
ProtoEncoder proto buffer encoder.
type PublishOption ¶
type PublishOption func(*PublishOptions)
PublishOption is a func for config publish options.
type PublishOptions ¶
type PublishOptions struct { }
PublishOptions is a configuration holder for publish options.
type SubscribeOption ¶
type SubscribeOption func(*SubscribeOptions)
SubscribeOption is a func for config subscription.
func DisableAutoAck ¶
func DisableAutoAck() SubscribeOption
DisableAutoAck will disable auto ack 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 }
SubscribeOptions is a configuration holder for subscriptions.
func (*SubscribeOptions) Apply ¶
func (op *SubscribeOptions) Apply(opts ...SubscribeOption)
Apply apply the options.
type Subscriber ¶
Subscriber is a convenience return type for the Subscribe method