Documentation
¶
Index ¶
- type Option
- func WithEncoder(encoder encoder.Encoder) Option
- func WithErrorHandler(h nc.ErrorHandler) Option
- func WithLogger(logger loggerInterface) Option
- func WithPanicHandler(h nc.PanicHandler) Option
- func WithRedisClient(cli *redis.Client) Option
- func WithRedisOpts(opts *redis.Options) Option
- func WithRedisURL(urlString string) Option
- func WithTopics(topics ...string) Option
- type Options
- type Publisher
- type Subscriber
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(opt *Options)
Option of the Redis subscriber or publisher
func WithEncoder ¶
WithEncoder set the message encoder
func WithErrorHandler ¶
func WithErrorHandler(h nc.ErrorHandler) Option
WithErrorHandler set handler of error processing
func WithLogger ¶
func WithLogger(logger loggerInterface) Option
WithLogger provides logging interface
func WithPanicHandler ¶
func WithPanicHandler(h nc.PanicHandler) Option
WithPanicHandler set handler of panic processing
func WithRedisClient ¶
WithRedisClient puts redis connect option
func WithRedisOpts ¶
WithRedisOpts set redis options to connect
func WithRedisURL ¶
WithRedisURL is an Option to set the URL the client should connect to. The url can contain username/password semantics. e.g. redis://derek:pass@localhost:4222/databaseNumber?topics=t1,t2
type Options ¶
type Options struct {
// Client of the redis server
Client *redis.Client
// Channels list
Channels []string
// RedisOptions to connect to the client
RedisOptions *redis.Options
// ErrorHandler of message processing
ErrorHandler nc.ErrorHandler
// PanicHandler process panic
PanicHandler nc.PanicHandler
// Message encoder interface
Encoder encoder.Encoder
// Logger of subscriber
Logger loggerInterface
}
Options of the Redis wrapper
type Publisher ¶
type Publisher struct {
// contains filtered or unexported fields
}
Publisher for NATS queue
func MustNewPublisher ¶
MustNewPublisher of the NATS stream server
func NewPublisher ¶
NewPublisher of the NATS stream server
type Subscriber ¶
type Subscriber struct {
nc.ModelSubscriber
// contains filtered or unexported fields
}
Subscriber for Redis channels
func MustNewSubscriber ¶
func MustNewSubscriber(options ...Option) *Subscriber
MustNewSubscriber creates new subscriber object
func NewSubscriber ¶
func NewSubscriber(options ...Option) (*Subscriber, error)
NewSubscriber creates new subscriber object