Documentation
¶
Index ¶
- Constants
- Variables
- type Listener
- type ListenerWithErr
- type MemoryPubsub
- func (*MemoryPubsub) Close() error
- func (m *MemoryPubsub) Publish(event string, message []byte) error
- func (m *MemoryPubsub) Subscribe(event string, listener Listener) (cancel func(), err error)
- func (m *MemoryPubsub) SubscribeWithErr(event string, listener ListenerWithErr) (cancel func(), err error)
- type Pubsub
Constants ¶
View Source
const BufferSize = 2048
BufferSize is the maximum number of unhandled messages we will buffer for a subscriber before dropping messages.
Variables ¶
View Source
var ErrDroppedMessages = xerrors.New("dropped messages")
ErrDroppedMessages is sent to ListenerWithErr if messages are dropped or might have been dropped.
Functions ¶
This section is empty.
Types ¶
type ListenerWithErr ¶
ListenerWithErr represents a pubsub handler that can also receive error indications
type MemoryPubsub ¶ added in v0.26.1
type MemoryPubsub struct {
// contains filtered or unexported fields
}
MemoryPubsub is an in-memory Pubsub implementation. It's an exported type so that our test code can do type checks.
func (*MemoryPubsub) Close ¶ added in v0.26.1
func (*MemoryPubsub) Close() error
func (*MemoryPubsub) Publish ¶ added in v0.26.1
func (m *MemoryPubsub) Publish(event string, message []byte) error
func (*MemoryPubsub) Subscribe ¶ added in v0.26.1
func (m *MemoryPubsub) Subscribe(event string, listener Listener) (cancel func(), err error)
func (*MemoryPubsub) SubscribeWithErr ¶ added in v0.26.1
func (m *MemoryPubsub) SubscribeWithErr(event string, listener ListenerWithErr) (cancel func(), err error)
type Pubsub ¶
type Pubsub interface { Subscribe(event string, listener Listener) (cancel func(), err error) SubscribeWithErr(event string, listener ListenerWithErr) (cancel func(), err error) Publish(event string, message []byte) error Close() error }
Pubsub is a generic interface for broadcasting and receiving messages. Implementors should assume high-availability with the backing implementation.
func NewInMemory ¶
func NewInMemory() Pubsub
Click to show internal directories.
Click to hide internal directories.