public UploadHandler(ITagTransactionTable transactionTable, ITagTransactionBlobContainer container, ITagQueue queue) { this.TagTransactionTable = transactionTable; this.TagTransactionBlobContainer = container; this.TagQueue = queue; }
public RecalculateDownloadCountsCommand(ITagTransactionTable txTable, ITagTable tagTable, IRedirectTable redirectTable, IDownloadTable downloadTable) { this.TagTransactionTable = txTable; this.TagTable = tagTable; this.RedirectTable = redirectTable; this.DownloadTable = downloadTable; }
public UpdateStorageCommand(ITagTransactionTable txTable, ITagTransactionBlobContainer transactionContainer, ITagTable tagTable, ITagBlobContainer blobContainer, IRedirectTable redirectTable) { this.TagTransactionTable = txTable; this.TagTransactionContainer = transactionContainer; this.TagTable = tagTable; this.TagBlobContainer = blobContainer; this.RedirectTable = redirectTable; }
public StoreTagCommand(ITagTransactionTable transactionTable, ITagQueue tagQueue, UpdateStorageCommand command) { _tagTxTable = transactionTable; _tagQueue = tagQueue; _command = command; }
public static async Task StoreTag([QueueTrigger(StorageName.TagTransactionQueue)] StoreTagMessage message, string channel, string transactionId, int dequeueCount, TextWriter log) { using (var scope = _provider.GetRequiredService <IServiceScopeFactory>().CreateScope()) { try { var command = scope.ServiceProvider.GetService <StoreTagCommand>(); await command.ExecuteAsync(channel, transactionId); } catch (StoreTagJobException e) { try { if (!e.OnlyLog) { ITagTransactionTable txTable = scope.ServiceProvider.GetService <ITagTransactionTable>(); await txTable.AddTagTransactionErrorMessageAsync(channel, transactionId, e.Message); } await log.WriteLineAsync(e.Message); } catch (Exception exception) { await log.WriteLineAsync($"Failed to store message for {channel}/{transactionId}. Original message: {e.Message}. Exception: {exception.ToString()}"); } } //var connection = new Connection(TableStorageConnectionString /*_environment.TableStorageConnectionString*/); //var tagTxTable = connection.TransactionTable(); //var tagTx = await tagTxTable.GetTagTransactionAsync(channel, transactionId); //if (tagTx == null) //{ // await log.WriteLineAsync($"Could not find transaction id: {transactionId} in channel: {channel}"); // return; //} //try //{ // var update = new UpdateStorageCommand(connection, tagTx); // await update.ExecuteAsync(); // if (update.DidWork) // { // await connection.QueueIndexMessageAsync(new IndexChannelMessage(channel)); // } //} //catch (StoreTagJobException e) //{ // try // { // await tagTxTable.AddTagTransactionErrorMessageAsync(tagTx, e.Message); // } // catch (Exception exception) // { // await log.WriteLineAsync($"Failed to store message for {channel}/{transactionId}. Original message: {e.Message}. Exception: {exception.ToString()}"); // } //} } }