Azure / azure-event-hubs-go

Golang client library for Azure Event Hubs https://azure.microsoft.com/services/event-hubs
MIT License
88 stars 69 forks source link

`eventhub.Receive` function gives `no such file or directory` instead of creating one #280

Open sariburak opened 1 year ago

sariburak commented 1 year ago

Setup

I first create a FilePersister and Hub by the following code:

persister, err := persist.NewFilePersister(output)
if err != nil {
    // error handle
}
hub, err := eventhub.NewHubFromConnectionString(conn_str, eventhub.HubWithOffsetPersistence(persister))
if err != nil {
    //error handle
}
t.hub = hub

and then try to fetch data from EventHub like this:

for _, partitionID := range partitionIDs {
    _, err := t.hub.Receive(ctx, partitionID, handler, eventhub.ReceiveWithConsumerGroup('$Default'))
    if err != nil {
        // err handle
    }
}

However. hub.Receive gives no such file or directory error.

Expected Behavior

FilePersister file should be automatically created.

Actual Behavior

gives no such file or directory error.

Environment

Additional Notes

I tried to run the code in a docker container. I built the code and copied the binary into a docker container which is running on golang:alpine. In that case, code run without any problems. So that's interesting.

Also, in my local run, I am sure the output dir has all the permission it needs.