jeromq
jeromq copied to clipboard
About pub-sub model, heartbeat monitoring, timeout reconnection
Nowadays, we encounter the problem of socket timeout due to the lack of data for a long time in use.I want to reconnect the socket by setting the heartbeat time and then reconnecting if timeout happens, but I don't know if jeromq will automatically reconnect.
ZMQ.Context context = ZMQ.context(1);
ZMQ.Socket subscriber = context.socket(ZMQ.SUB);
subscriber.connect(zmqSet.getZMQIP());
subscriber.setHeartbeatIvl(1000);
I don't know if this is the case. When the heartbeat Ping has no data, it will reconnect.
It will, but you have to set the interval before calling connect.
Hi ! I have the same problem in C#. If you have solved it, please teach me how to do.
--- part of my cord --- subSocket.Options.HeartbeatInterval = new TimeSpan(0, 0, 0, 30); subSocket.Options.HeartbeatTimeout = new TimeSpan(0, 0, 0, 60); subSocket.Options.HeartbeatTtl = new TimeSpan(0, 0, 0, 60); subSocket.Connect(accessPoint);