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;
}