internal OutboxLockedJob(OutboxEnvelope envelope, Guid lockId, CancellationTokenSource?cts) { Envelope = envelope; _cancellationToken = cts?.Token ?? CancellationToken.None; _cts = cts; LockId = lockId; }
public override async Task <OutboxEnvelope> Add(OutboxEnvelope outboxEnvelope, CancellationToken cancellationToken) { await _graphClient.Cypher .Create($"(outbox:{nameof(Outbox)})") .Set("outbox = {outbox}").WithParam("outbox", outboxEnvelope) .ExecuteWithoutResultsAsync(); return(outboxEnvelope); }
public override Task <OutboxEnvelope> Add(OutboxEnvelope outboxEnvelope, CancellationToken cancellationToken) { if (outboxEnvelope == null) { throw new ArgumentNullException(nameof(outboxEnvelope)); } var entityEntry = _dbContext.Set <OutboxEnvelope>().Add(outboxEnvelope); return(Task.FromResult(entityEntry.Entity)); }
public async Task <Guid> EnqueueAsync <T>(Guid correlationId, T message, CancellationToken cancellationToken) where T : IOutboxMessage { var assemblyQualifiedName = message.GetType().AssemblyQualifiedName; if (assemblyQualifiedName == null) { throw new InvalidOperationException("Can't resolve assemblyQualifiedName"); } var outbox = new OutboxEnvelope(correlationId, assemblyQualifiedName, OutboxMessageStatus.New, _serializer.Serialize(message)); await _outboxDataProvider.Add(outbox, cancellationToken).ConfigureAwait(false); return(correlationId); }
public abstract Task <OutboxEnvelope> Add(OutboxEnvelope outboxEnvelope, CancellationToken cancellationToken);