/// <inheritdoc/> public async Task WriteRetryableExceptionAsync(ChangeFeedEntry changeFeedEntry, int retryNum, Exception exceptionToStore, CancellationToken cancellationToken) { string tableName = Constants.TransientRetryTableName; DicomDataset dataset = changeFeedEntry.Metadata; string studyUid = dataset.GetSingleValue <string>(DicomTag.StudyInstanceUID); string seriesUid = dataset.GetSingleValue <string>(DicomTag.SeriesInstanceUID); string instanceUid = dataset.GetSingleValue <string>(DicomTag.SOPInstanceUID); long changeFeedSequence = changeFeedEntry.Sequence; CloudTable table = _client.GetTableReference(tableName); TableEntity entity = new RetryableEntity(studyUid, seriesUid, instanceUid, changeFeedSequence, retryNum, exceptionToStore); TableOperation operation = TableOperation.InsertOrMerge(entity); try { await table.ExecuteAsync(operation, cancellationToken); _logger.LogInformation("Retryable error when processsing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyUID}, SeriesUID: {SeriesUID}, InstanceUID: {InstanceUID}. Tried {retryNum} time(s). Stored into table: {Table} in table storage.", changeFeedSequence, studyUid, seriesUid, instanceUid, retryNum, tableName); } catch { _logger.LogInformation("Retryable error when processsing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyUID}, SeriesUID: {SeriesUID}, InstanceUID: {InstanceUID}. Tried {retryNum} time(s). Failed to store to table storage.", changeFeedSequence, studyUid, seriesUid, instanceUid, retryNum); throw; } }
/// <inheritdoc/> public async Task WriteRetryableExceptionAsync(ChangeFeedEntry changeFeedEntry, int retryNum, TimeSpan nextDelayTimeSpan, Exception exceptionToStore, CancellationToken cancellationToken) { EnsureArg.IsNotNull(changeFeedEntry, nameof(changeFeedEntry)); DicomDataset dataset = changeFeedEntry.Metadata; string studyInstanceUid = dataset.GetSingleValue <string>(DicomTag.StudyInstanceUID); string seriesInstanceUid = dataset.GetSingleValue <string>(DicomTag.SeriesInstanceUID); string sopInstanceUid = dataset.GetSingleValue <string>(DicomTag.SOPInstanceUID); long changeFeedSequence = changeFeedEntry.Sequence; var tableClient = _tableServiceClient.GetTableClient(Constants.TransientRetryTableName); var entity = new RetryableEntity(studyInstanceUid, seriesInstanceUid, sopInstanceUid, changeFeedSequence, retryNum, exceptionToStore); try { await tableClient.UpsertEntityAsync(entity, cancellationToken : cancellationToken); _logger.LogInformation("Retryable error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyInstanceUid}, SeriesUID: {SeriesInstanceUid}, InstanceUID: {SopInstanceUid}. Tried {RetryNum} time(s). Waiting {Milliseconds} milliseconds . Stored into table: {Table} in table storage.", changeFeedSequence, studyInstanceUid, seriesInstanceUid, sopInstanceUid, retryNum, nextDelayTimeSpan.TotalMilliseconds, Constants.TransientRetryTableName); } catch { _logger.LogInformation("Retryable error when processing changefeed entry: {ChangeFeedSequence} for DICOM instance with StudyUID: {StudyInstanceUid}, SeriesUID: {SeriesInstanceUid}, InstanceUID: {SopInstanceUid}. Tried {RetryNum} time(s). Failed to store to table storage.", changeFeedSequence, studyInstanceUid, seriesInstanceUid, sopInstanceUid, retryNum); throw; } }