Skip to content

The Redis plugin only has a publish interface for sending messages and does not have a subscribe interface. #4708

@huangxinze

Description

@huangxinze

Describe the bug
The Redis plugin only has a publish interface for sending messages and does not have a subscribe interface.

To Reproduce
o use the Redis plugin for publishing and subscribing to messages.

  1. The code is

file path: go-zero/core/stores/redis/redis.go

func (s *Redis) Publish(channel string, message interface{}) (int64, error) {
 return s.PublishCtx(context.Background(), channel, message)
}

func (s *Redis) PublishCtx(ctx context.Context, channel string, message interface{}) (int64, error) {
 conn, err := getRedis(s)
 if err != nil {
 	return 0, err
 }
 return conn.Publish(ctx, channel, message).Result()
}
  1. The error is only has a publish interface for sending messages and does not have a subscribe interface.

I hope a subscribe interface can be added.


**Expected behavior**
I hope a subscribe interface can be added.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Environments (please complete the following information):**
- OS: [e.g. Linux]
- go-zero version [e.g. 1.2.1]
- goctl version [e.g. 1.2.1, optional]

**More description**
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions