Skip to content

Instantly share code, notes, and snippets.

@ilgooz
Created July 23, 2018 12:50
Show Gist options
  • Save ilgooz/052058aae1951ccb925c7bb7666f33a0 to your computer and use it in GitHub Desktop.
Save ilgooz/052058aae1951ccb925c7bb7666f33a0 to your computer and use it in GitHub Desktop.
// stream is *Stream and err is error
// err filled if we fail to listen for events
stream, err := observable3.Execute(serviceID, "send")
if err != nil {
log.Fatal(err)
}
for {
select {
case execution := <- stream.Executions:
// exection.Err is an error
// filled when task execution failed
if exection.Err != nil {
continue
}
fmt.Println(execution.ID)
// err is an error
// send on stream error
// if received, stream.Executions channel will be closed too.
case err := <- stream.Err:
}
}
stream.Close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment