Created
July 23, 2018 12:50
-
-
Save ilgooz/052058aae1951ccb925c7bb7666f33a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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