/// <summary>
 /// Facebook webhook controller
 /// </summary>
 public FbPageWebhookController()
 {
     verifyToken        = SettingsFB.FacebookVerifyToken;
     appSecret          = SettingsFB.FacebookAppSecret;
     eventApiClient     = new EventApiClient(new Auth(Settings.AAdAppId, Settings.AAdAppSecret), Settings.EventAPIBaseUrl);
     azureTableProvider = new AzureTableProvider(Settings.StorageAccountConnectionString);
 }
        public async static Task ProcessQueueMessage()
        {
            queueProvider       = new AzureStorageQueueProvider(Settings.StorageAccountConnectionString, Settings.QueueName);
            azureTableProvider  = new AzureTableProvider(Settings.StorageAccountConnectionString);
            pageJobMappingTable = await azureTableProvider.EnsureTableExistAsync(Settings.PageJobMappingTableName);

            while (true)
            {
                try
                {
                    CloudQueueMessage queueMessage = queueProvider.GetMessage(queueVisibilityTimeOutInSec);

                    if (queueMessage != null)
                    {
                        await ProcessMessage(queueMessage, httpClient, pageJobMappingTable);

                        // Delete the message
                        queueProvider.DeleteMessage(queueMessage);
                    }
                    else
                    {
                        await Task.Delay(sleepTime);
                    }
                }
                catch (Exception ex)
                {
                    // If ProcessMessage throws an exception, it will reappear in queue after visibility timeout
                    Trace.TraceError($"Processing Failed in ProcessQueueMessage. Exception: {ex.Message}, {ex.StackTrace}");
                }
            }
        }
        private static async Task InitializeStorageEntities()
        {
            AzureTableProvider azureTableProvider = new AzureTableProvider(Settings.StorageAccountConnectionString);
            CloudTable         tokenTable         = await azureTableProvider.EnsureTableExistAsync(Settings.TokenTableName);

            CloudTable pageJobMappingTable = await azureTableProvider.EnsureTableExistAsync(Settings.PageJobMappingTableName);

            CloudTable settingsTable = await azureTableProvider.EnsureTableExistAsync(Settings.ConfigurationSettingsTableName);

            await GetConfigurationSettingFomStorge(azureTableProvider, settingsTable);
        }
 private static async Task GetConfigurationSettingFomStorge(AzureTableProvider azureTableProvider, CloudTable settingsTable)
 {
     SettingsFB.FacebookAppId       = (await azureTableProvider.GetEntityAsync <ConfigurationSettingsEntity>(settingsTable, "ConfigurationSetting", "FacebookAppId"))?.settingValue;
     SettingsFB.FacebookAppSecret   = (await azureTableProvider.GetEntityAsync <ConfigurationSettingsEntity>(settingsTable, "ConfigurationSetting", "FacebookAppSecret"))?.settingValue;
     SettingsFB.FacebookVerifyToken = (await azureTableProvider.GetEntityAsync <ConfigurationSettingsEntity>(settingsTable, "ConfigurationSetting", "FacebookVerifyToken"))?.settingValue;
     Settings.AAdAppId     = (await azureTableProvider.GetEntityAsync <ConfigurationSettingsEntity>(settingsTable, "ConfigurationSetting", "AAdAppId"))?.settingValue;
     Settings.AAdAppSecret = (await azureTableProvider.GetEntityAsync <ConfigurationSettingsEntity>(settingsTable, "ConfigurationSetting", "AAdAppSecret"))?.settingValue;
     Settings.AADAppUri    = (await azureTableProvider.GetEntityAsync <ConfigurationSettingsEntity>(settingsTable, "ConfigurationSetting", "AADAppUri"))?.settingValue;
     Settings.APPINSIGHTS_INSTRUMENTATIONKEY = (await azureTableProvider.GetEntityAsync <ConfigurationSettingsEntity>(settingsTable, "ConfigurationSetting", "APPINSIGHTS_INSTRUMENTATIONKEY"))?.settingValue;
     if (Settings.APPINSIGHTS_INSTRUMENTATIONKEY == null)
     {
         Settings.APPINSIGHTS_INSTRUMENTATIONKEY = string.Empty;
     }
 }
 public DataIngestionController()
 {
     this.queueProvider      = new AzureStorageQueueProvider(Settings.StorageAccountConnectionString, Settings.QueueName);
     this.azureTableProvider = new AzureTableProvider(Settings.StorageAccountConnectionString);
 }
 public Utility()
 {
     azureTableProvider = new AzureTableProvider(Settings.StorageAccountConnectionString);
     settingsTable      = azureTableProvider.GetAzureTableReference(Settings.ConfigurationSettingsTableName);
 }
 public ConfigurationController()
 {
     this.azureTableProvider = new AzureTableProvider(Settings.StorageAccountConnectionString);
 }
 public DataSourceSetupController()
 {
     azureTableProvider = new AzureTableProvider(Settings.StorageAccountConnectionString);
     sourceProvider     = new FacebookProvider(azureTableProvider);
 }
 public ConnectorSourceProvider(AzureTableProvider azureTableProvider, CloudTable tokenTable)
 {
     this.azureTableProvider = azureTableProvider;
     this.tokenTable         = tokenTable;
 }
示例#10
0
 public DataIngestion(HttpClient httpClient, AzureTableProvider azureTableProvider, CloudTable cloudTable)
 {
     this.httpClient          = httpClient;
     this.PageJobMappingTable = cloudTable;
     this.azureTableProvider  = azureTableProvider;
 }