Exemplo n.º 1
0
        public async Task Store(OutgoingMessage message, TimeSpan dueAfter, string destination, SqlConnection connection, SqlTransaction transaction)
        {
            var messageRow = StoreDelayedMessageCommand.From(message.Headers, message.Body, dueAfter, destination);

            using (var command = new SqlCommand(storeCommand, connection, transaction))
            {
                messageRow.PrepareSendCommand(command);
                await command.ExecuteNonQueryAsync().ConfigureAwait(false);
            }
        }
Exemplo n.º 2
0
        public static StoreDelayedMessageCommand From(Dictionary <string, string> headers, byte[] body, TimeSpan dueAfter, string destination)
        {
            Guard.AgainstNull(nameof(destination), destination);

            var row = new StoreDelayedMessageCommand();

            headers["NServiceBus.SqlServer.ForwardDestination"] = destination;
            row.headers   = DictionarySerializer.Serialize(headers);
            row.bodyBytes = body;
            row.dueAfter  = dueAfter;
            return(row);
        }