Exemple #1
0
        public async ValueTask <int> StageBatch(IReadOnlyList <TimeoutData> timeouts, int batchNumber)
        {
            await PurgeStagingTable();

            var timeoutsToBeStaged = timeouts.Select(timeout => StagedDelayedMessageEntity.FromTimeoutData(timeout, batchNumber)).GroupBy(x => x.PartitionKey);
            var table = client.GetTableReference(stagingTableName);

            var timeoutsStaged = await BatchProcessRecords(table, timeoutsToBeStaged, (operation, entity) => operation.InsertOrReplace(entity));

            return(timeoutsStaged);
        }
 public static DelayedMessageEntity FromStagedTimeout(StagedDelayedMessageEntity timeout)
 {
     return(new DelayedMessageEntity
     {
         PartitionKey = GetPartitionKey(timeout.Time),
         RowKey = $"{GetRawRowKeyPrefix(timeout.Time)}_{timeout.MessageId}",
         Destination = timeout.Destination,
         Body = timeout.Body,
         MessageId = timeout.MessageId,
         Headers = timeout.Headers
     });
 }