I am using an Azure Event Hub as backplane for my SignalR Web App (asp.net mvc, 4.5.2).
I have some problems with creating a client that can listen for messages. The loading of the entire application stops at this line when this application start up.
await eventProcessorHost.RegisterEventProcessorAsync<ListenEventProcessor>(options);
my code:
public class TCT
{
// Singleton instance
private static readonly Lazy<TCT> Instance = new Lazy<TCT>(() => new TCT(GlobalHost.ConnectionManager.GetHubContext<TCHub>().Clients));
private TCT()
{
InitializeEventHubListnerAsync().GetAwaiter().GetResult();
}
private async Task InitializeEventHubListnerAsync()
{
...
var eventProcessorHostName = Guid.NewGuid().ToString();
var eventProcessorHost = new EventProcessorHost(eventProcessorHostName, eventHubName, EventHubConsumerGroup.DefaultGroupName, eventHubConnectionString, storageConnectionString);
var options = new EventProcessorOptions();
options.ExceptionReceived += (sender, e) =>
{
ServiceEventSource.Current.Message("Error occured recieveing message " + e.Exception.Message);
};
ServiceEventSource.Current.Message("This is the last entry is see in the log file");
await eventProcessorHost.RegisterEventProcessorAsync<ListenEventProcessor>(options);
ServiceEventSource.Current.Message("This line is never printet in the logs and the loading of the entire web application stops here.");
}
}
If i remove await eventProcessorHost.RegisterEventProcessorAsync(options); the web application loads just fine, but does not recieve any messages of course
I used this guide when writing the code https://docs.microsoft.com/en-gb/azure/event-hubs/event-hubs-dotnet-standard-getstarted-receive-eph