You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
订阅打印:
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
订阅:
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以后发现,订阅不会自动恢复,无法接收到后续的消息,发布客户端能够自动恢复等重连成功继续发送消息
The text was updated successfully, but these errors were encountered: