-
Notifications
You must be signed in to change notification settings - Fork 0
/
QueueOptions.cs
44 lines (38 loc) · 1.12 KB
/
QueueOptions.cs
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
namespace CloudWorker.MessageQueue;
public class QueueOptions
{
public string? QueueType { get; set; }
public string? QueueName { get; set; }
public string? ConnectionString { get; set; }
//Here no default value in code because some queue (like SBQ) can not set lease by code!
//So this value MUST be provided by configuration!
public int? MessageLease { get; set; } //In seconds
public virtual void Merge(QueueOptions? other)
{
if (other == null)
{
return;
}
if (other.QueueType != null)
{
QueueType = other.QueueType;
}
if (other.QueueName != null)
{
QueueName = other.QueueName;
}
if (other.ConnectionString != null)
{
ConnectionString = other.ConnectionString;
}
if (other.MessageLease != null)
{
MessageLease = other.MessageLease;
}
}
public virtual bool Validate()
{
return !string.IsNullOrWhiteSpace(QueueName) && !string.IsNullOrWhiteSpace(ConnectionString)
&& MessageLease > 0;
}
}