pubsub

package
v0.0.0-...-11198bb Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kafka

type Kafka struct {
	// contains filtered or unexported fields
}

func NewKafkaConsumer

func NewKafkaConsumer(addr, groupId string, startOffset int64) *Kafka

func NewKafkaPublish

func NewKafkaPublish(addr string) *Kafka

func (*Kafka) Publish

func (k *Kafka) Publish(ctx context.Context, key string, value []byte) (err error)

func (*Kafka) Subscribe

func (k *Kafka) Subscribe(ctx context.Context, key string, callBack func(value []byte, err error))

type PubSub

type PubSub struct {
	// contains filtered or unexported fields
}

func NewPubSub

func NewPubSub(pub Publisher, sub Subscriber) *PubSub

func (*PubSub) Publish

func (ps *PubSub) Publish(ctx context.Context, key string, value []byte) (err error)

func (*PubSub) Subscribe

func (ps *PubSub) Subscribe(ctx context.Context, key string, callBack func(value []byte, err error))

type Publisher

type Publisher interface {
	Publish(ctx context.Context, key string, value []byte) (err error)
}

type RedisLpushBrpop

type RedisLpushBrpop struct {
	Addr     string
	Password string
	Db       string
}

func NewRedisLpushBrpop

func NewRedisLpushBrpop(addr, password, db string) *RedisLpushBrpop

func (*RedisLpushBrpop) Publish

func (r *RedisLpushBrpop) Publish(ctx context.Context, key string, value []byte) (err error)

func (*RedisLpushBrpop) Subscribe

func (r *RedisLpushBrpop) Subscribe(ctx context.Context, key string, callBack func([]byte, error))

type Subscriber

type Subscriber interface {
	Subscribe(ctx context.Context, key string, callBack func(value []byte, err error))
}

Jump to

Keyboard shortcuts

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