Esempio n. 1
0
        private static async Task <AssetStatusModel> DisplayAssetStatus(IngestionStartModel startModel)
        {
            await Task.Delay(MillisecondsToDelay);

            var asset =
                await GetAsync <AssetStatusModel>($"/libraries/49FCFFB0-BAFB-4C36-A525-8F1AE478837D/assets/{startModel.AssetId}");

            Console.WriteLine(JsonConvert.SerializeObject(asset));

            return(asset);
        }
Esempio n. 2
0
        private static async Task Run(int numberOfAssets)
        {
            var rand = new Random(DateTime.UtcNow.Millisecond);

            var startModels = new IngestionStartModel[numberOfAssets];


            for (var i = 0; i < numberOfAssets; i++)
            {
                var startModel = await PostAsync <AssetRequestModel, IngestionStartModel>("/libraries/49FCFFB0-BAFB-4C36-A525-8F1AE478837D/assets/", new AssetRequestModel { Filename = i + ".jpg" });

                startModels[i] = startModel;

                await DisplayAssetStatus(startModel);
            }

            Parallel.For(0, numberOfAssets, async i =>
            {
                await Task.Delay(TimeSpan.FromSeconds(rand.Next(5, 20)));

                var startModel = startModels[i];
                await
                PostAsync <StringMessage>(
                    $"/libraries/49FCFFB0-BAFB-4C36-A525-8F1AE478837D/ingestions/{startModel.ProcessId}/events");
            });

            var assets = new AssetStatusModel[numberOfAssets];

            while (Continue(assets))
            {
                Console.WriteLine("--------");

                for (var i = 0; i < numberOfAssets; i++)
                {
                    assets[i] = await DisplayAssetStatus(startModels[i]);
                }

                await Task.Delay(MillisecondsToDelay);
            }
        }