Open lumichael24 opened 4 years ago
Hi! That's interesting, I'll look into this and get back to you. In the meantime, we have this other example for a consumer that only receives events: https://github.com/Azure/azure-event-hubs-go/blob/master/_examples/helloworld/consumer/main.go.
This is the link to the full project that demonstrates how to a producer sends messages and how the consumer receives them: https://github.com/Azure/azure-event-hubs-go/tree/master/_examples/helloworld.
Hopefully that helps for a quick start while I look into this.
Expected Behavior
From the quick start code, if we remove the lines:
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt, os.Kill)
<-signalChan
the event hub handler should still receive events from the EventHub since the Receive function is blocking until there is a connection to the EventHub.
Actual Behavior
Removing those lines of code AND the line that sends a new string to the EventHub results in the EventHub being closed early and nothing being printed in the handler function. Is it the expected behavior/required to have the OS signal channel or something like time.Sleep for the connection to persist as well as the events be returned from the EventHub?
Full code attached below for reference
`
Environment