jeromq icon indicating copy to clipboard operation
jeromq copied to clipboard

About pub-sub model, heartbeat monitoring, timeout reconnection

Open Rui2guo opened this issue 6 years ago • 2 comments

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.

Rui2guo avatar May 30 '19 10:05 Rui2guo

It will, but you have to set the interval before calling connect.

somdoron avatar May 09 '20 06:05 somdoron

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);

ntkysd avatar Mar 17 '21 07:03 ntkysd