Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public async Task ef_core_middleware_is_marking_the_envelope_as_handled()
var persisted = fromStore.Single(x => x.Id == envelope.Id);
persisted.Status.ShouldBe(EnvelopeStatus.Handled);

persisted.KeepUntil.HasValue.ShouldBeTrue();
}

private async Task<Item> loadItem(Guid id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,13 @@ public async ValueTask CommitAsync(CancellationToken cancellation)

// Are we marking an existing envelope as persisted?
if (_messaging.Envelope.WasPersistedInInbox)
{
{
var keepUntil =
DateTimeOffset.UtcNow.Add(_messaging.Runtime.Options.Durability.KeepAfterMessageHandling);
var cmd = conn.CreateCommand(
$"update {_database.SchemaName}.{DatabaseConstants.IncomingTable} set {DatabaseConstants.Status} = '{EnvelopeStatus.Handled}' where id = @id")
.With("id", _messaging.Envelope.Id);
$"update {_database.SchemaName}.{DatabaseConstants.IncomingTable} set {DatabaseConstants.Status} = '{EnvelopeStatus.Handled}', {DatabaseConstants.KeepUntil} = @keep where id = @id")
.With("id", _messaging.Envelope.Id)
.With("keep", keepUntil);
cmd.Transaction = tx;
await cmd.ExecuteNonQueryAsync(cancellation);
}
Expand Down
Loading