I have used EventProcessorHost for listen azure event hub. I have created an async method in a class for RegisterEventProcessorAsync with event hub configuration . and using this async method in my Startup.cs class . It is working fine on local but while deployed it on Azure its not working . This is my method for register event hub and startup.cs class.
public static class ProcesssRTS
{
private static string EhConnectionString =""
private static string EhEntityPath =""
private static string StorageContainerName =""
private static string StorageAccountName =""
private static string StorageAccountKey =""
private static readonly string StorageConnectionString = string.Format("DefaultEndpointsProtocol=https;AccountName={0};AccountKey={1}", StorageAccountName, StorageAccountKey);
public static async Task MainAsync()
{
Console.WriteLine("Registering EventProcessor...");
var eventProcessorHost = new EventProcessorHost(
EhEntityPath,
PartitionReceiver.DefaultConsumerGroupName,
EhConnectionString,
StorageConnectionString,
StorageContainerName);
await eventProcessorHost.RegisterEventProcessorAsync<RTSEventProcessor>();
Console.WriteLine("Receiving. Press ENTER to stop worker.");
Console.ReadLine();
await eventProcessorHost.UnregisterEventProcessorAsync();
}
}
public class Startup
{
public void Configuration(IAppBuilder app)
{
ProcesssRTS.MainAsync();
app.Map("/signalr", map =>
{
map.UseCors(CorsOptions.AllowAll);
var hubConfiguration = new HubConfiguration { };
map.RunSignalR(hubConfiguration);
});
}
}