pubsub_redis

package
v0.0.0-...-7edcfce Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Provider string = "redis"

Variables

This section is empty.

Functions

This section is empty.

Types

type Publisher

type Publisher struct {
	RedisClient
	pubsub.PublisherBase
}

func NewPublisher

func NewPublisher(serializer ...message.Serializer) *Publisher

func (*Publisher) Publish

func (p *Publisher) Publish(topicName string, obj interface{}) error

type RedisClient

type RedisClient struct {
	RedisConfig
	// contains filtered or unexported fields
}

func (*RedisClient) Config

func (r *RedisClient) Config() interface{}

func (*RedisClient) Context

func (r *RedisClient) Context() context.Context

func (*RedisClient) Init

func (r *RedisClient) Init(cfg config.Config, log logger.Logger, vld validator.Validator, configPath ...string) error

func (*RedisClient) InitWithConfig

func (r *RedisClient) InitWithConfig(log logger.Logger, cfg *RedisConfig) error

func (*RedisClient) NativeHandler

func (r *RedisClient) NativeHandler() *redis.Client

func (*RedisClient) Shutdown

func (r *RedisClient) Shutdown(ctx context.Context) error

type RedisConfig

type RedisConfig struct {
	Host     string `default:"localhost" validate:"required" vmessage:"Host of Redis server not set"`
	Port     uint16 `default:"6379" validate:"gt=0" vmessage:"Port of Redis can not be zero"`
	Db       int
	Password string `mask:"true"`
}

type Subscriber

type Subscriber struct {
	RedisClient
	pubsub_subscriber.SubscriberBase
	// contains filtered or unexported fields
}

func NewSubscriber

func NewSubscriber(app app_context.Context, serializer ...message.Serializer) *Subscriber

func (*Subscriber) Subscribe

func (s *Subscriber) Subscribe(topic pubsub_subscriber.Topic) (string, error)

func (*Subscriber) Unsubscribe

func (s *Subscriber) Unsubscribe(topicName string, subscriptionId ...string)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL