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
I'm building a pub/sub server (many-to-one), in which pub clients use REQ sockets and the sub server uses a ROUTER socket, similar to what's happening in this pic:
The thing is, sometimes the sub server loses connection in the network and all the pub clients log this error:
zmq4: no connections available)
To make my system fault resilient, I'm looking into including an auto-reconnect feat to pub clients. I notice the library also includes that option, but even after enabling it, pub clients still log the same message. Is it expected? Does auto-reconnect only work in certain architectures like REQ/REP?
Some of my source-code:
// Wraps [zmq4.Socket] so context can be accessed for extracting dependencies.typeSocketstruct {
zmq4.Socketctx context.Context
}
// Creates a new sub [zmq4-Socket] wrapper with a custom context.// The context must contain all the dependencies required by the socket.funcNewSubSocket(ctx context.Context) Socket {
returnSocket{
Socket: zmq4.NewRouter(ctx),
ctx: ctx,
}
}
// Creates a new sub [zmq4-Socket] wrapper with a custom context.// The context must contain all the dependencies required by the socket.funcNewPubSocket(ctx context.Context) Socket {
returnSocket{
Socket: zmq4.NewReq(ctx, zmq4.WithAutomaticReconnect(true)),
ctx: ctx,
}
}
func (sSocket) PublishAndForget(mmsg) {
logging.LogInfo("publishing msg with topic: %d", m.Topic)
b, err:=encode(m)
iferr!=nil {
log.Printf("failed to encode message, %v\n", err)
}
err=s.Send(zmq4.NewMsg(b))
iferr!=nil {
log.Printf("failed to publish message, %v\n", err)
}
}
The text was updated successfully, but these errors were encountered:
Hey
I'm building a pub/sub server (many-to-one), in which pub clients use REQ sockets and the sub server uses a ROUTER socket, similar to what's happening in this pic:
The thing is, sometimes the sub server loses connection in the network and all the pub clients log this error:
To make my system fault resilient, I'm looking into including an auto-reconnect feat to pub clients. I notice the library also includes that option, but even after enabling it, pub clients still log the same message. Is it expected? Does auto-reconnect only work in certain architectures like REQ/REP?
Some of my source-code:
The text was updated successfully, but these errors were encountered: