public async Task ExportOrchestration()

in src/ApiForFhirMigrationTool.Function/ExportOrchestrator.cs [56:93]


    public async Task<string> ExportOrchestration(
        [OrchestrationTrigger] TaskOrchestrationContext context)
    {
        ILogger logger = context.CreateReplaySafeLogger(nameof(ExportOrchestration));
        logger.LogInformation("Starting export activities.");
        var statusRespose = new HttpResponseMessage();
        var statusUrl = string.Empty;
        var import_body = string.Empty;

        try
        {
            logger.LogInformation("Creating table clients");
            TableClient chunktableClient = _azureTableClientFactory.Create(_options.ChunkTableName);
            TableClient exportTableClient = _azureTableClientFactory.Create(_options.ExportTableName);
            logger.LogInformation("Table clients created successfully.");

            logger.LogInformation(" Query the export table to check for running or incomplete jobs.");
            Pageable<TableEntity> jobList = exportTableClient.Query<TableEntity>(filter: ent => ent.GetString("IsExportRunning") == "Running" || ent.GetString("IsExportRunning") == "Started" || ent.GetString("IsImportRunning") == "Running" || ent.GetString("IsImportRunning") == "Started" || ent.GetString("IsImportRunning") == "Not Started" || ent.GetBoolean("IsProcessed") == false);
            logger?.LogInformation("Query completed");

            if (jobList.Count() <= 0)
            {
                logger?.LogInformation("Calling ProcessExport function");
                ResponseModel exportResponse = await context.CallActivityAsync<ResponseModel>(nameof(ProcessExport));
                logger?.LogInformation("ProcessExport function has completed.");
            }
            else
            {
                logger?.LogInformation("Currently, an import or export job is already running, so a new export cannot be started.");
            }
        }
        catch
        {
            throw;
        }
        logger?.LogInformation("Completed export activities.");
        return "Completed";
    }