I am trying to consume EventHub messages from a WebJob, without avail. The job builds and runs without throwing any exceptions, but the trigger is never called. I am referencing Microsoft.Azure.WebJobs, Microsoft.Azure.WebJobs.Extensions and Microsoft.Azure.WebJobs.ServiceBus v2.0.0.0 (beta).
Here's my code:
Program.cs:
public static void Main() { var eventHubConfig = new EventHubConfiguration(); string eventHubName = "myHub"; eventHubConfig.AddReceiver(eventHubName, "Endpoint=sb://xxxx.servicebus.windows.net/;SharedAccessKeyName=xxxx;SharedAccessKey=yyyy"); config.UseEventHub(eventHubConfig); JobHost host = new JobHost(config); if (config.IsDevelopment) { config.UseDevelopmentSettings(); } host.RunAndBlock(); }
Functions.cs:
public static void Trigger([EventHubTrigger("myHub")] string message) { _logger.Debug("Message received"); }
In my app.config, I've set the appropriate connection strings for AzureWebJobsDashboardand AzureWebJobsStorage.
I've tried everything from using batches of messages to changing the method signature of the trigger method, specifically the parameter type to EventData or byte[]. Nothing works. I should note messages are sent to the EventHub as byte arrays wrapped in an EventData.
What am I missing?
Thank you for your time and looking forward to replies.