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 DelayedMessageRow From(Dictionary <string, string> headers, byte[] body, DateTime due, string destination) { Guard.AgainstNull(nameof(destination), destination); var row = new DelayedMessageRow(); headers["NServiceBus.SqlServer.ForwardDestination"] = destination; row.headers = DictionarySerializer.Serialize(headers); row.bodyBytes = body; row.due = due; return(row); }
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); }