public async Task SetAsDispatched(string messageId, ContextBag context) { using (var connection = await connectionManager.OpenConnection(context.GetIncomingMessage()).ConfigureAwait(false)) using (var command = sqlDialect.CreateCommand(connection)) { command.CommandText = outboxCommands.SetAsDispatched; command.AddParameter("MessageId", messageId); command.AddParameter("DispatchedAt", DateTime.UtcNow); await command.ExecuteNonQueryEx().ConfigureAwait(false); } }
public override async Task Begin(string messageId, DbConnection connection, DbTransaction transaction) { using (var command = sqlDialect.CreateCommand(connection)) { command.CommandText = outboxCommands.PessimisticBegin; command.Transaction = transaction; command.AddParameter("MessageId", messageId); command.AddParameter("PersistenceVersion", StaticVersions.PersistenceVersion); await command.ExecuteNonQueryEx().ConfigureAwait(false); } }
internal override CommandWrapper CreateCommand(DbConnection connection) { var commandWrapper = impl.CreateCommand(connection); commandWrapper.InnerCommand.CommandTimeout = commandTimeout; return(commandWrapper); }
public async Task Add(TimeoutData timeout, ContextBag context) { using (var connection = await connectionManager.OpenNonContextualConnection().ConfigureAwait(false)) using (var command = sqlDialect.CreateCommand(connection)) { command.CommandText = timeoutCommands.Add; var id = SequentialGuid.Next(); timeout.Id = id.ToString(); command.AddParameter("Id", id); command.AddParameter("Destination", timeout.Destination); command.AddParameter("SagaId", timeout.SagaId); command.AddParameter("State", timeout.State); command.AddParameter("Time", timeout.Time); command.AddParameter("Headers", Serializer.Serialize(timeout.Headers)); command.AddParameter("PersistenceVersion", StaticVersions.PersistenceVersion); await command.ExecuteNonQueryEx().ConfigureAwait(false); } }
public override async Task Complete(OutboxMessage outboxMessage, DbConnection connection, DbTransaction transaction, ContextBag context) { using (var command = sqlDialect.CreateCommand(connection)) { command.CommandText = outboxCommands.OptimisticStore; command.Transaction = transaction; command.AddParameter("MessageId", outboxMessage.MessageId); command.AddJsonParameter("Operations", Serializer.Serialize(outboxMessage.TransportOperations.ToSerializable())); command.AddParameter("PersistenceVersion", StaticVersions.PersistenceVersion); await command.ExecuteNonQueryEx().ConfigureAwait(false); } }
public CommandWrapper CreateCommand(DbConnection connection) { return(sqlDialect.CreateCommand(connection)); }