You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
`
hub, err := eventhub.NewHubFromConnectionString(connStr)
if err != nil {
fmt.Println(err)
return
}
ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
defer cancel()
//hub.Send(ctx, eventhub.NewEventFromString("hello a different sdfsdf"))
handler := func(c context.Context, event *eventhub.Event) error {
fmt.Println(string(event.Data))
return nil
}
// listen to each partition of the Event Hub
runtimeInfo, err := hub.GetRuntimeInformation(ctx)
if err != nil {
fmt.Println(err)
return
}
for _, partitionID := range runtimeInfo.PartitionIDs {
//eventhub.ReceiveWithLatestOffset()
listenerHandle, err := hub.Receive(ctx, partitionID, handler, eventhub.ReceiveWithConsumerGroup("$Default"))
if err != nil {
fmt.Println(err)
return
}
fmt.Println(listenerHandle.Err())
}
//time.Sleep(10 * time.Second)
/*
// Wait for a signal to quit:
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt, os.Kill)
<-signalChan*/`
Environment
OS: Windows 10 Enterprise
Go version: go1.14.6 windows/amd64
Version of Library: github.com/Azure/azure-event-hubs-go v1.3.1
The text was updated successfully, but these errors were encountered:
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
The text was updated successfully, but these errors were encountered: