We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I would like to understand the best practice for gracefully exiting a poll loop when using this library (or zmq poll in general)
I have the following crude example, which works fine : Is there a more elegant way to do it ?
I realize there is only 1 socket in this example but more will be added.
Eish: for { sockets, _ := poller.Poll(time.Second * 3) for _, socket := range sockets { switch s := socket.Socket; s { case sub1: address, err := s.Recv(0) if err != nil { log.Errorf("Error receiving zmq message(1) : %v", err) continue } if msg, err := s.Recv(0); err != nil { log.Errorf("Error receiving zmq message(2) : %v", err) continue } else { mess := string(msg) fmt.Print("Received message from " + address + " channel.") fmt.Printf("%+v\n", mess) } } } select { case <-ctx.Done(): log.Infof("Exiting zmq.") break Eish case <-time.After(time.Millisecond * 1): } }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I would like to understand the best practice for gracefully exiting a poll loop when using this library (or zmq poll in general)
I have the following crude example, which works fine : Is there a more elegant way to do it ?
I realize there is only 1 socket in this example but more will be added.
The text was updated successfully, but these errors were encountered: