public static async Task RunAsync(
            [BlobTrigger("spitball-files/study-room/{studyRoomId}/{studyRoomId2}_{sessionId}.mp4")] CloudBlockBlob blob, string studyRoomId2, string sessionId,
            [Inject] IVideoService videoService,
            [Inject] IQueryBus queryBus,
            [Queue(QueueName.BackgroundQueueName)] IAsyncCollector <string> queueCollector,
            ILogger log,
            CancellationToken token)
        {
            log.LogInformation($"Received blob {blob.Name}");
            await blob.FetchAttributesAsync();

            if (blob.Metadata.TryGetValue(MetaEncodingKey, out _))
            {
                log.LogInformation($"Sending email of blob {blob.Name}");
                var query  = new StudyRoomVideoEmailQuery($"{studyRoomId2}_{sessionId}");
                var result = await queryBus.QueryAsync(query, token);

                result.DownloadLink = blob.GetDownloadLink(TimeSpan.FromDays(365));

                var json = JsonConvert.SerializeObject(result, new JsonSerializerSettings
                {
                    TypeNameHandling = TypeNameHandling.All
                });
                await queueCollector.AddAsync(json, token);

                return;
            }
            log.LogInformation($"Processing video of blob {blob.Name}");

            var link = blob.GetDownloadLink(TimeSpan.FromHours(1));
            var v    = $"{studyRoomId2}{Separator}{sessionId}";
            await videoService.CreateStudyRoomSessionEncoding(v, link.AbsoluteUri, token);
        }
示例#2
0
 public async Task StudyRoomVideoEmailQuery_Ok()
 {
     var query = new StudyRoomVideoEmailQuery("d7140ca0-2b83-4ce5-b35c-ab190086fe18_1575469575");
     var _     = await fixture.QueryBus.QueryAsync(query, default);
 }