-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathQueuePeekerOptions.cs
More file actions
59 lines (52 loc) · 1.6 KB
/
QueuePeekerOptions.cs
File metadata and controls
59 lines (52 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
namespace NServiceBus
{
using System;
using Logging;
/// <summary>
/// Queue peeker options.
/// </summary>
public class QueuePeekerOptions
{
internal QueuePeekerOptions() { }
/// <summary>
/// Time delay between peeks.
/// </summary>
public TimeSpan 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.";
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.";
Logger.Warn(message);
}
field = value;
}
} = TimeSpan.FromSeconds(1);
/// <summary>
/// Maximal number of records to peek.
/// </summary>
public int? MaxRecordsToPeek
{
get;
set
{
if (value.HasValue && value < 1)
{
var message = "Peek batch size is invalid. The value must be greater than zero.";
throw new Exception(message);
}
field = value;
}
}
static ILog Logger = LogManager.GetLogger<QueuePeekerOptions>();
}
}