/// <inheritdoc /> public async Task Add(BackgroundCommandEvent commandEvent, CancellationToken cancellationToken = default) { if (commandEvent is null) { throw new ArgumentNullException(nameof(commandEvent)); } var operation = TableOperation.Insert(new EventTableEntity(commandEvent, _commandSerializer)); await _cloudTable.ExecuteAsync(operation, cancellationToken); }
/// <inheritdoc /> public async Task Add(BackgroundCommandEvent commandEvent, CancellationToken cancellationToken = default) { if (commandEvent is null) { throw new ArgumentNullException(nameof(commandEvent)); } var allCommandEvents = (await GetFromCache(commandEvent.Command.Id, cancellationToken)) ?? new List <BackgroundCommandEvent>(); allCommandEvents.Add(commandEvent); await Set(allCommandEvents, cancellationToken); }
/// <inheritdoc /> public async Task Add(BackgroundCommandEvent commandEvent, CancellationToken cancellationToken = default) { if (commandEvent is null) { throw new ArgumentNullException(nameof(commandEvent)); } var allCommandEvents = _cache.Get <IList <BackgroundCommandEvent> >(commandEvent.Command.Id) ?? new List <BackgroundCommandEvent>(); allCommandEvents.Add(commandEvent); _cache.Set(commandEvent.Command.Id, allCommandEvents, _expiration); }
public EventCacheEntry(BackgroundCommandEvent commandEvent, IBackgroundCommandSerializer serializer) { EventStatus = commandEvent.Status.ToString(); EventTimestamp = commandEvent.Timestamp; Command = serializer.SerializeAsync(commandEvent.Command).Result; if (commandEvent.Exception != null) { try { Exception = JsonConvert.SerializeObject(commandEvent.Exception); } catch (Exception ex) { Exception = ex.ToString(); } } }
public EventTableEntity(BackgroundCommandEvent commandEvent, IBackgroundCommandSerializer serializer) { PartitionKey = commandEvent.Command.Id; RowKey = BackgroundCommandIdGenerator.Generate(); EventStatus = commandEvent.Status.ToString(); EventTimestamp = commandEvent.Timestamp; Command = serializer.SerializeAsync(commandEvent.Command).Result; if (commandEvent.Exception != null) { try { Exception = JsonConvert.SerializeObject(commandEvent.Exception); } catch (Exception ex) { Exception = ex.ToString(); } } }