-
-
Save emretanriverdi/8fa0478e148a171a880c294f9b21305d to your computer and use it in GitHub Desktop.
channel-deadlock.go
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
func readAndSend() { | |
c := make(chan User) | |
go readFromCouchbase("123", c) | |
for user := range c { | |
sendToKafka(user) | |
} | |
} | |
func readFromCouchbase(key string, c chan User) { | |
time.Sleep(5 * time.Millisecond) | |
fmt.Println("# read from Couchbase for key -> " + key) | |
c <- User{Id: 123, Name: "Emre"} | |
} | |
func sendToKafka(user User) { | |
fmt.Println("# sending to Kafka for username -> " + user.Name) | |
time.Sleep(5 * time.Millisecond) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment