Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/Custom.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<PropertyGroup>
<MinVerMinimumMajorMinor>9.0</MinVerMinimumMajorMinor>
<MinVerAutoIncrement>minor</MinVerAutoIncrement>
<LangVersion>preview</LangVersion>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,33 @@ internal QueuePeekerOptions() { }
/// </summary>
public TimeSpan Delay
{
get => delay;
get;
set
{
if (value < TimeSpan.FromMilliseconds(100))
{
var message = "Delay requested is invalid. The value should be greater than 100 ms and less than 10 seconds.";
var message =
"Delay requested is invalid. The value should be greater than 100 ms and less than 10 seconds.";
throw new Exception(message);
}

if (value > TimeSpan.FromSeconds(10))
{
var message = $"Delay requested of {value} is not recommended. The recommended delay value is between 100 milliseconds to 10 seconds.";
var message =
$"Delay requested of {value} is not recommended. The recommended delay value is between 100 milliseconds to 10 seconds.";
Logger.Warn(message);
}

delay = value;
field = value;
}
}
} = TimeSpan.FromSeconds(1);

/// <summary>
/// Maximal number of records to peek.
/// </summary>
public int? MaxRecordsToPeek
{
get => maxRecordsToPeek;
get;
set
{
if (value.HasValue && value < 1)
Expand All @@ -48,13 +50,10 @@ public int? MaxRecordsToPeek
throw new Exception(message);
}

maxRecordsToPeek = value;
field = value;
}
}

TimeSpan delay = TimeSpan.FromSeconds(1);
int? maxRecordsToPeek;

static ILog Logger = LogManager.GetLogger<QueuePeekerOptions>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,27 +15,20 @@ internal TransactionScopeOptions() { }
/// </summary>
public TimeSpan Timeout
{
get => timeout;
get;
set
{
if (value > TransactionManager.MaximumTimeout)
{
var message = "Timeout requested is longer than the maximum value for this machine. Override using the maxTimeout setting of the system.transactions section in machine.config";

throw new Exception(message);
}

timeout = value;
ArgumentOutOfRangeException.ThrowIfGreaterThan(value, TransactionManager.MaximumTimeout);
field = value;
}
}
} = TransactionManager.DefaultTimeout;

/// <summary>
/// Transaction isolation level.
/// </summary>
public IsolationLevel IsolationLevel { get; set; } = IsolationLevel.ReadCommitted;

internal TransactionOptions TransactionOptions => new TransactionOptions { IsolationLevel = IsolationLevel, Timeout = timeout };
internal TransactionOptions TransactionOptions => new() { IsolationLevel = IsolationLevel, Timeout = Timeout };

TimeSpan timeout = TransactionManager.DefaultTimeout;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,34 @@
/// </summary>
public partial class DelayedDeliveryOptions
{
string tableSuffix = "Delayed";
int batchSize = 100;

internal DelayedDeliveryOptions() { }

/// <summary>
/// Suffix to be appended to the table name storing delayed messages.
/// </summary>
public string TableSuffix
{
get => tableSuffix;
get;
set
{
ArgumentException.ThrowIfNullOrWhiteSpace(value);

tableSuffix = value;
field = value;
}
}
} = "Delayed";

/// <summary>
/// Size of the batch when moving matured timeouts to the input queue.
/// </summary>
public int BatchSize
{
get => batchSize;
get;
set
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(value);

batchSize = value;
field = value;
}
}
} = 100;
}
}
17 changes: 4 additions & 13 deletions src/NServiceBus.Transport.PostgreSql/SubscriptionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,24 @@
/// </summary>
public class SubscriptionOptions
{
/// <summary>
/// Default to 5 seconds caching. If a system is under load that prevent doing an extra roundtrip for each Publish
/// operation. If
/// a system is not under load, doing an extra roundtrip every 5 seconds is not a problem and 5 seconds is small enough
/// value that
/// people accepts as we always say that subscription operation is not instantaneous.
/// </summary>
TimeSpan cacheInvalidationPeriod = TimeSpan.FromSeconds(5);

/// <summary>
/// Subscription table. All endpoints in a given system need to agree on that name in order for them to be able
/// to subscribe to and publish events.
/// </summary>
public SubscriptionTableName SubscriptionTableName { get; set; } = new SubscriptionTableName("SubscriptionRouting");

/// <summary>
/// Cache subscriptions for a given <see cref="TimeSpan" />.
/// Cache subscriptions for a given <see cref="TimeSpan" />. Defaults to 5 seconds.
/// </summary>
public TimeSpan CacheInvalidationPeriod
{
get => cacheInvalidationPeriod;
get;
set
{
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(value, TimeSpan.Zero);
cacheInvalidationPeriod = value;
field = value;
}
}
} = TimeSpan.FromSeconds(5);

/// <summary>
/// Do not cache subscriptions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,31 +15,33 @@ internal QueuePeekerOptions() { }
/// </summary>
public TimeSpan Delay
{
get => delay;
get;
set
{
if (value < TimeSpan.FromMilliseconds(100))
{
var message = "Delay requested is invalid. The value should be greater than 100 ms and less than 10 seconds.";
var message =
"Delay requested is invalid. The value should be greater than 100 ms and less than 10 seconds.";
throw new Exception(message);
}

if (value > TimeSpan.FromSeconds(10))
{
var message = $"Delay requested of {value} is not recommended. The recommended delay value is between 100 milliseconds to 10 seconds.";
var message =
$"Delay requested of {value} is not recommended. The recommended delay value is between 100 milliseconds to 10 seconds.";
Logger.Warn(message);
}

delay = value;
field = value;
}
}
} = TimeSpan.FromSeconds(1);

/// <summary>
/// Maximal number of records to peek.
/// </summary>
public int? MaxRecordsToPeek
{
get => maxRecordsToPeek;
get;
set
{
if (value.HasValue && value < 1)
Expand All @@ -48,13 +50,10 @@ public int? MaxRecordsToPeek
throw new Exception(message);
}

maxRecordsToPeek = value;
field = value;
}
}

TimeSpan delay = TimeSpan.FromSeconds(1);
int? maxRecordsToPeek;

static ILog Logger = LogManager.GetLogger<QueuePeekerOptions>();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ internal TransactionScopeOptions() { }
/// </summary>
public TimeSpan Timeout
{
get => timeout;
get;
set
{
if (value > TransactionManager.MaximumTimeout)
Expand All @@ -24,18 +24,15 @@ public TimeSpan Timeout

throw new Exception(message);
}

timeout = value;
field = value;
}
}
} = TransactionManager.DefaultTimeout;

/// <summary>
/// Transaction isolation level.
/// </summary>
public IsolationLevel IsolationLevel { get; set; } = IsolationLevel.ReadCommitted;

internal TransactionOptions TransactionOptions => new TransactionOptions { IsolationLevel = IsolationLevel, Timeout = timeout };

TimeSpan timeout = TransactionManager.DefaultTimeout;
internal TransactionOptions TransactionOptions => new() { IsolationLevel = IsolationLevel, Timeout = Timeout };
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,34 @@
/// </summary>
public partial class DelayedDeliveryOptions
{
string tableSuffix = "Delayed";
int batchSize = 100;

internal DelayedDeliveryOptions() { }

/// <summary>
/// Suffix to be appended to the table name storing delayed messages.
/// </summary>
public string TableSuffix
{
get => tableSuffix;
get;
set
{
ArgumentException.ThrowIfNullOrWhiteSpace(value);

tableSuffix = value;
field = value;
}
}
} = "Delayed";

/// <summary>
/// Size of the batch when moving matured timeouts to the input queue.
/// </summary>
public int BatchSize
{
get => batchSize;
get;
set
{
ArgumentOutOfRangeException.ThrowIfNegativeOrZero(value);

batchSize = value;
field = value;
}
}
} = 100;
}
}
17 changes: 4 additions & 13 deletions src/NServiceBus.Transport.SqlServer/PubSub/SubscriptionOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,25 @@
/// </summary>
public class SubscriptionOptions
{
/// <summary>
/// Default to 5 seconds caching. If a system is under load that prevent doing an extra roundtrip for each Publish
/// operation. If
/// a system is not under load, doing an extra roundtrip every 5 seconds is not a problem and 5 seconds is small enough
/// value that
/// people accepts as we always say that subscription operation is not instantaneous.
/// </summary>
TimeSpan cacheInvalidationPeriod = TimeSpan.FromSeconds(5);

/// <summary>
/// Subscription table. All endpoints in a given system need to agree on that name in order for them to be able
/// to subscribe to and publish events.
/// </summary>
public SubscriptionTableName SubscriptionTableName { get; set; } = new SubscriptionTableName("SubscriptionRouting");

/// <summary>
/// Cache subscriptions for a given <see cref="TimeSpan" />.
/// Cache subscriptions for a given <see cref="TimeSpan" />. Defaults to 5 seconds.
/// </summary>
public TimeSpan CacheInvalidationPeriod
{
get => cacheInvalidationPeriod;
get;
set
{
ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(value, TimeSpan.Zero);

cacheInvalidationPeriod = value;
field = value;
}
}
} = TimeSpan.FromSeconds(5);

/// <summary>
/// Do not cache subscriptions.
Expand Down