modulepackage
0.0.0-20190308031246-e07d9eceecb4
Repository: https://github.com/russellluo/rpubsub.git
Documentation: pkg.go.dev
# README
rpubsub
Reliable implementation of Publish–subscribe messaging pattern backed by Redis Streams.
Installation
$ go get -u github.com/RussellLuo/rpubsub
Motivation
- Learn Redis Streams by doing.
- Implement a more reliable Publish–subscribe messaging mechanism than Pub/Sub.
Design & Implementation
- Publishing
- Just use XADD directly.
- Subscribing
- API (inspired by Principles of designing Go APIs with channels).
- Blocking instead of polling (which means one goroutine per topic).
- Snapshotting
- Built-in snapshotters (NilSnapshotter and RedisSnapshotter).
- Save point (inspired by Redis's RDB persistence).
Documentation
Check out the Godoc.
License
# Functions
NewPublisher creates an instance of Publisher with the given options.
No description provided by the author
NewSubscriber creates an instance of Subscriber with the given options.
# Structs
No description provided by the author
NilSnapshotter is a fake manager that does no snapshotting.
PubArgs holds the arguments for publishing.
Publisher provides reliable publishing capability backed by Redis Streams.
RedisSnapshotter is a manager that will save the subscribing state to Redis.
No description provided by the author
SavePoint configures a snapshotter to have it save the last message ID for a topic every `Duration`, if there are at least `Changes` messages received in the topic.
No description provided by the author
SubOpts holds the options for subscribing.
Subscriber provides reliable subscribing capability backed by Redis Streams.
SubState represents the subscribing state of a specific topic.
# Interfaces
RedisClient is the interface that both redis.Client and redis.ClusterClient implement.
Snapshotter is a manager that will snapshot the subscribing state for a specific subscriber.
SubMonitor is the minimum interface that a subscriber must implement for snapshotting.