public static MessageRow From(Dictionary<string, string> headers, ReadOnlyMemory<byte> body, TimeSpan toBeReceived)
 {
     return new MessageRow
     {
         id = Guid.NewGuid(),
         timeToBeReceived = toBeReceived == TimeSpan.MaxValue ? null : (int?)toBeReceived.TotalMilliseconds,
         headers = DictionarySerializer.Serialize(headers),
         bodyBytes = body.ToArray()
     };
 }
Пример #2
0
 public static MessageRow From(Dictionary <string, string> headers, byte[] body, TimeSpan toBeReceived)
 {
     return(new MessageRow
     {
         id = Guid.NewGuid(),
         correlationId = TryGetHeaderValue(headers, Headers.CorrelationId, s => s),
         replyToAddress = TryGetHeaderValue(headers, Headers.ReplyToAddress, s => s),
         timeToBeReceived = toBeReceived == TimeSpan.MaxValue ? null : (int?)toBeReceived.TotalMilliseconds,
         headers = DictionarySerializer.Serialize(headers),
         bodyBytes = body
     });
 }
        public static StoreDelayedMessageCommand From(Dictionary <string, string> headers, ReadOnlyMemory <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.ToArray();
            row.dueAfter  = dueAfter;
            return(row);
        }