zeromq / netmq

A 100% native C# implementation of ZeroMQ for .NET
Other
2.95k stars 744 forks source link

The first message sent from publisher is lost. #911

Closed AnudeepGarge closed 4 years ago

AnudeepGarge commented 4 years ago

Environment

NetMQ Version:   4.0.0.207 
Operating System: Windows 10
.NET Version:     4.6.2

Expected behaviour

I have a pub-sub pattern implemented. In one of my scenario the pub disposes and will be recreated after a while (while subscribers remain intact). The first message sent by the publisher after creating and stating it is lost, but if I give a delay of around 1 sec the message is received in the subscriber.

Actual behaviour

The first message must not be lost, also a delay looks unnecessary.

Steps to reproduce the behaviour

Create a pub-sub pattern in 2 different processes (same process will do the job as well). Send a message from pub. Dispose the pub and create it back again binding to the same port. Try sending the message immediately, The first message will be lost.

dxdjgl commented 4 years ago

See https://github.com/zeromq/netmq/issues/482 this explains why the first messages are lost. The subscriber must be reconnected before published data will be recieved. Have a look at for instance http://zguide.zeromq.org/php:chapter5#Last-Value-Caching Please reopen if you disagree.