Skip to content

Instantly share code, notes, and snippets.

@tylertreat
Last active August 29, 2015 14:12
Show Gist options
  • Save tylertreat/65269a28931fb0471b1a to your computer and use it in GitHub Desktop.
Save tylertreat/65269a28931fb0471b1a to your computer and use it in GitHub Desktop.
func start(host string) {
pub := NewNSQPeer(host)
for i := 0; i < 1000; i++ {
message := getMessage()
pub.Send(message)
}
pub.Teardown()
}
func start(host string) {
sub := NewNSQPeer(host)
sub.Subscribe()
for {
message, _ := sub.Recv()
fmt.Println(message)
if isDone() {
break
}
}
sub.Teardown()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment