public override Task MoveToDeadLetterStorage(ErrorReport[] errors) { var cmd = DatabaseSettings.CreateCommand(_deleteIncomingEnvelopesSql) .With("ids", errors); var builder = new CommandBuilder(cmd); foreach (var error in errors) { var id = builder.AddParameter(error.Id); var source = builder.AddParameter(error.Source); var messageType = builder.AddParameter(error.MessageType); var explanation = builder.AddParameter(error.Explanation); var exText = builder.AddParameter(error.ExceptionText); var exType = builder.AddParameter(error.ExceptionType); var exMessage = builder.AddParameter(error.ExceptionMessage); var body = builder.AddParameter(error.RawData); builder.Append( $"insert into {DatabaseSettings.SchemaName}.{DeadLetterTable} (id, source, message_type, explanation, exception_text, exception_type, exception_message, body) values (@{id.ParameterName}, @{source.ParameterName}, @{messageType.ParameterName}, @{explanation.ParameterName}, @{exText.ParameterName}, @{exType.ParameterName}, @{exMessage.ParameterName}, @{body.ParameterName});"); } return(builder.ApplyAndExecuteOnce(_cancellation)); }
public override Task DiscardAndReassignOutgoing(Envelope[] discards, Envelope[] reassigned, int nodeId) { return(DatabaseSettings.CreateCommand(_deleteOutgoingEnvelopesSql + $";update {DatabaseSettings.SchemaName}.{OutgoingTable} set owner_id = @node where id = ANY(@rids)") .With("ids", discards) .With("node", nodeId) .With("rids", reassigned) .ExecuteOnce(_cancellation)); }
public override Task DeleteOutgoing(Envelope[] envelopes) { return(DatabaseSettings.CreateCommand(_deleteOutgoingEnvelopesSql) .With("ids", envelopes) .ExecuteOnce(_cancellation)); }