title: ZMQ PUSH/PULL model: Lost messages when a node PUSHes messages and exits
body: <p>I have a requirement that a PHP web application write messages to a non-blocking queue and other process(es) dequeue them. My current design is PHP app create a <code>ZMQ.PUSH</code> socket, do a <code>connect</code> to the destination address and <code>send</code> the message. While at the destination, a process (Java) create a <code>ZMQ.PULL</code> socket, do a <code>bind</code> on the same address and <code>receive</code> the message. However, when the dequeuer process is down (or not started), the messages that the PHP app sent during that time are lost (not delivered to the dequeuer when the process starts again on the same address). Is this an issue with the PHP application creating a new <code>ZMQ.Context</code> everytime?</p>
  
  <p>As an example, I created another Java process to write messages to the queue.</p>
  
  <pre><code>public static void main(String[] args) {
      ZMQ.Context context = ZMQ.context(1);
      ZMQ.Socket socket = context.socket(ZMQ.PUSH);
      socket.connect("tcp://localhost:5557");
  
      for(int i = 0; i &lt; 10; i++) {
          socket.send(("Sending : " + message).getBytes(), 0);
      }
  }
  </code></pre>
  
  <p>This has the same problem of lost messages if the dequeuing process does not start by the time the above processes finishes. </p>
  
  <p>But adding a <code>while(true) {}</code> to the end of the above method body does not result in any lost messages - all the messages are delivered when the dequeuer starts. So am I correct in the assumption that the <code>ZMQ.Context</code> object being garbage collected causes the problem here? If yes, then how to solve this problem in a PHP web application? Since I cannot persist the <code>ZMQ.Context</code> object. </p>