Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redis重启以后订阅主题没有自动恢复 #101

Open
fredmuyu opened this issue Sep 12, 2024 · 0 comments
Open

redis重启以后订阅主题没有自动恢复 #101

fredmuyu opened this issue Sep 12, 2024 · 0 comments

Comments

@fredmuyu
Copy link

订阅:
redis.RegisterSubscriber(srv.Server, topic, func(ctx context.Context, key string, headers broker.Headers, msg *string) error {
fmt.Printf("topic:%s,key:%s,msg:%s\n", topic, key, *msg)
return nil
})

发布:
if err := srv.Publish(context.Background(), topic, fmt.Sprintf("hello world %d", i)); err != nil {
fmt.Println("err:", err)
} else {
fmt.Println("pub suc %d", i)
}

订阅打印:
topic:test,key:test,msg:hello world 1
topic:test,key:test,msg:hello world 2
topic:test,key:test,msg:hello world 3
topic:test,key:test,msg:hello world 4
topic:test,key:test,msg:hello world 5
topic:test,key:test,msg:hello world 6
topic:test,key:test,msg:hello world 7
topic:test,key:test,msg:hello world 8
topic:test,key:test,msg:hello world 9
topic:test,key:test,msg:hello world 10
topic:test,key:test,msg:hello world 11
ERROR msg=[redis] recv error: EOF
ERROR msg=[redis] close pubsub connection error: write tcp 127.0.0.1:61474->127.0.0.1:6379: use of closed network connection

发布打印:
pub suc 7
pub suc 8
pub suc 9
pub suc 10
pub suc 11
err: EOF
err: dial tcp 127.0.0.1:6379: connect: connection refused
pub suc 12
pub suc 13
pub suc 14

通过重启redis以后发现,订阅不会自动恢复,无法接收到后续的消息,发布客户端能够自动恢复等重连成功继续发送消息

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant