0

Azure イベント ハブをリッスンするために EventProcessorHost を使用しました。イベント ハブ構成で RegisterEventProcessorAsync のクラスに非同期メソッドを作成しました。Startup.cs クラスでこの非同期メソッドを使用します。ローカルでは問題なく動作していますが、Azure にデプロイしている間は動作しません。これは、イベント ハブと startup.cs クラスを登録するための私の方法です。

    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);
        });

    }
}
4

0 に答える 0