Azure-Functions icon indicating copy to clipboard operation
Azure-Functions copied to clipboard

[Visual Studio] Event Hub not working on dotnet core

Open vdurante opened this issue 8 years ago • 4 comments

I am unsure if Event Hub is already working with dotnet core. If it is not, disconsider my issue.

I have created a new Azure Function solution and added 2 functions:

public static class FuncTimer
{
    [FunctionName("FuncTimer")]
    public static void Run([TimerTrigger("0 */5 * * * *")]TimerInfo myTimer, [EventHub("test-eh", Connection = "Test_EventHub")] ICollector<string> outputEventHubMessages, TraceWriter log)
    {
        outputEventHubMessages.Add("1 test");
        outputEventHubMessages.Add("2 test");
        outputEventHubMessages.Add("3 test");
    }
}
public static class FuncEvent
{
    [FunctionName("FuncEvent")]
    public static void Run([EventHubTrigger("test-eh", Connection = "Test_EventHub")] string[] eventHubMessages, TraceWriter log)
    {
        foreach (var message in eventHubMessages)
        {
            log.Info($"C# Event Hub trigger function processed a message: {message}");
        }
    }
}

I also added the the EventHub Extension NuGet package:

Install-Package Microsoft.Azure.WebJobs.Extensions.EventHubs -Version 3.0.0-beta3

The FuncTimer works like a charm. I am able to add events through the ICollector. The FuncEvent, on the other hand, doesn't. This is the error I get:

[08/12/17 17:43:08] FuncEvent: Unabled to configure binding 'eventHubMessages' of type 'eventHubTrigger'. This may indicate invalid function.json properties. Can't figure out which ctor to call.

vdurante avatar Dec 08 '17 17:12 vdurante

We should be supporting it, as shown in this documentation.

ConnorMcMahon avatar Dec 08 '17 18:12 ConnorMcMahon

@ConnorMcMahon It is supported, but apparently it has a bug when working with an array. Single messages work like a charm

vdurante avatar Dec 21 '17 18:12 vdurante

Seems to me the same as https://github.com/Azure/Azure-Functions/issues/652 As I explain there, in the function.json file the property "path" should be "eventhubname". Manual change can get you going.

DamiaoCastro avatar Jan 27 '18 12:01 DamiaoCastro

This should have been fixed and is working now. Let me know if you have any other ?s

jeffhollan avatar May 10 '18 18:05 jeffhollan