NServiceBus.TimeToBeReceivedMappings.GetTimeToBeReceived C# (CSharp) Method

GetTimeToBeReceived() static private method

static private GetTimeToBeReceived ( TimeSpan>.Func convention, Type messageType, bool doesTransportSupportDiscardIfNotReceivedBefore ) : System.TimeSpan
convention TimeSpan>.Func
messageType System.Type
doesTransportSupportDiscardIfNotReceivedBefore bool
return System.TimeSpan
        static TimeSpan GetTimeToBeReceived(Func<Type, TimeSpan> convention, Type messageType, bool doesTransportSupportDiscardIfNotReceivedBefore)
        {
            var timeToBeReceived = convention(messageType);

            if (timeToBeReceived < TimeSpan.MaxValue && !doesTransportSupportDiscardIfNotReceivedBefore)
            {
                throw new Exception("Messages with TimeToBeReceived found but the selected transport does not support this type of restriction. Remove TTBR from messages or select a transport that does support TTBR");
            }

            if (timeToBeReceived <= TimeSpan.Zero)
            {
                throw new Exception("TimeToBeReceived must be greater that 0");
            }
            return timeToBeReceived;
        }