Documentation ¶
Index ¶
- func NewWatermillPublisher(pub Publisher) (publisher.Publisher, error)
- func NewWatermillSubscriber(sub Subscriber, consumeFunc subscriber.ConsumeFunc) subscriber.Subscriber
- type Config
- type MultiSubscriber
- type PubConfig
- type Publisher
- type Redis
- type SubConfig
- type Subscriber
- type WatermillPublisher
- type WatermillSubscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewWatermillSubscriber ¶
func NewWatermillSubscriber(sub Subscriber, consumeFunc subscriber.ConsumeFunc) subscriber.Subscriber
Types ¶
type Config ¶
type Config struct { Host string `env:"REDIS_HOST,required"` Port string `env:"REDIS_PORT,required"` Password string `env:"REDIS_PASSWORD" envdefault:""` DB int `env:"REDIS_DB,required"` TTL time.Duration `env:"REDIS_TTL,required"` UseTls bool `env:"REDIS_USE_TLS,notEmpty" envdefault:"false"` MaxIdleConns int `env:"REDIS_MAX_IDLE_CONNS,required"` MinIdleConns int `env:"REDIS_MIN_IDLE_CONNS,required"` }
type MultiSubscriber ¶
type MultiSubscriber struct {
// contains filtered or unexported fields
}
Subscriber to manage multiple subscribers
func NewMultiSubscriber ¶
func NewMultiSubscriber(config *SubConfig) *MultiSubscriber
func (*MultiSubscriber) Close ¶
func (s *MultiSubscriber) Close() error
func (*MultiSubscriber) Subscribe ¶
func (s *MultiSubscriber) Subscribe(topic string, consumeFunc subscriber.ConsumeFunc) error
type PubConfig ¶
type PubConfig struct { LoggerDebug bool `env:"REDIS_PUB_SUB_LOGGER_DEBUG,notEmpty" envdefault:"false"` LoggerTrace bool `env:"REDIS_PUB_SUB_LOGGER_TRACE,notEmpty" envdefault:"false"` MaxStreamEntries int64 `env:"REDIS_MAX_STREAM_ENTRIES" envDefault:"200"` }
func NewPubConfig ¶
type Publisher ¶
type SubConfig ¶
type SubConfig struct { PubConfig ConsumerGroup string `env:"REDIS_PUB_SUB_CONSUMER_GROUP_ID,notEmpty" envdefault:""` }
func NewSubConfig ¶
type Subscriber ¶
type Subscriber interface { Close() error Subscribe(ctx context.Context, topic string) (<-chan *message.Message, error) GroupID() string Topic() string }
func NewSubscriber ¶
func NewSubscriber(config *SubConfig, client redis.UniversalClient, topic string) (Subscriber, error)
type WatermillPublisher ¶
type WatermillPublisher struct {
// contains filtered or unexported fields
}
func (*WatermillPublisher) Close ¶
func (w *WatermillPublisher) Close() error
func (*WatermillPublisher) PublishMessage ¶
func (w *WatermillPublisher) PublishMessage(messages ...string) error
func (*WatermillPublisher) Topic ¶
func (w *WatermillPublisher) Topic() string
type WatermillSubscriber ¶
type WatermillSubscriber struct {
// contains filtered or unexported fields
}
func (*WatermillSubscriber) Close ¶
func (r *WatermillSubscriber) Close() error
func (*WatermillSubscriber) GroupID ¶
func (r *WatermillSubscriber) GroupID() string
func (*WatermillSubscriber) Start ¶
func (r *WatermillSubscriber) Start()
func (*WatermillSubscriber) Topic ¶
func (r *WatermillSubscriber) Topic() string
Click to show internal directories.
Click to hide internal directories.