Ejemplo n.º 1
0
    public override async Task Complete(OutboxMessage outboxMessage, DbConnection connection, DbTransaction transaction, ContextBag context, CancellationToken cancellationToken = default)
    {
        string json = Serializer.Serialize(outboxMessage.TransportOperations.ToSerializable());

        json = sqlDialect.AddOutboxPadding(json);

        using (var command = sqlDialect.CreateCommand(connection))
        {
            command.CommandText = outboxCommands.OptimisticStore;
            command.Transaction = transaction;
            command.AddParameter("MessageId", outboxMessage.MessageId);
            command.AddJsonParameter("Operations", json);
            command.AddParameter("PersistenceVersion", StaticVersions.PersistenceVersion);
            await command.ExecuteNonQueryEx(cancellationToken).ConfigureAwait(false);
        }
    }