O código nunca recebe chamadas passadas para: eventProcessorHost.RegisterEventProcessorAsync <ListenEventProcessor>
Estou usando um Hub de Eventos do Azure como backplane para meu SignalR Web App (asp.net mvc, 4.5.2).
Tenho alguns problemas com a criação de um cliente que pode ouvir mensagens. O carregamento de todo o aplicativo para nesta linha quando esse aplicativo é iniciado.
await eventProcessorHost.RegisterEventProcessorAsync<ListenEventProcessor>(options);
meu código:
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.");
}
}
Se eu remover waitit eventProcessorHost.RegisterEventProcessorAsync (opções); o aplicativo da web carrega muito bem, mas não recebe nenhuma mensagem, é claro
Eu usei este guia ao escrever o códigohttps://docs.microsoft.com/en-gb/azure/event-hubs/event-hubs-dotnet-standard-getstarted-receive-eph