-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathSQSTransportConnectionString.cs
More file actions
71 lines (59 loc) · 2.29 KB
/
SQSTransportConnectionString.cs
File metadata and controls
71 lines (59 loc) · 2.29 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
60
61
62
63
64
65
66
67
68
69
70
71
namespace ServiceControl.Transports.SQS;
using System;
using System.Data.Common;
public class SQSTransportConnectionString
{
public SQSTransportConnectionString(string connectionString)
{
var builder = new DbConnectionStringBuilder { ConnectionString = connectionString };
if (builder.TryGetValue("AccessKeyId", out object accessKeyId))
{
AccessKey = (string)accessKeyId;
}
if (builder.TryGetValue("SecretAccessKey", out object secretAccessKey))
{
SecretKey = (string)secretAccessKey;
}
if (builder.TryGetValue("Region", out object region))
{
Region = (string)region;
}
if (builder.TryGetValue("QueueNamePrefix", out object queueNamePrefix))
{
QueueNamePrefix = (string)queueNamePrefix;
}
if (builder.TryGetValue("TopicNamePrefix", out object topicNamePrefix))
{
TopicNamePrefix = (string)topicNamePrefix;
}
if (builder.TryGetValue("S3BucketForLargeMessages", out object bucketForLargeMessages))
{
S3BucketForLargeMessages = (string)bucketForLargeMessages;
if (!string.IsNullOrEmpty(S3BucketForLargeMessages))
{
if (builder.TryGetValue("S3KeyPrefix", out object keyPrefix))
{
S3KeyPrefix = (string)keyPrefix;
}
}
}
if (builder.TryGetValue("DoNotWrapOutgoingMessages", out object doNotWrapOutgoingMessages) &&
bool.TryParse(doNotWrapOutgoingMessages.ToString(), out bool doNotWrapOutgoingMessagesAsBool))
{
DoNotWrapOutgoingMessages = doNotWrapOutgoingMessagesAsBool;
}
if (builder.TryGetValue("ReservedBytesInMessageSize", out object reservedBytes))
{
ReservedBytesInMessageSize = Convert.ToInt32(reservedBytes);
}
}
public string AccessKey { get; }
public string SecretKey { get; }
public string Region { get; }
public string QueueNamePrefix { get; }
public string TopicNamePrefix { get; }
public string S3BucketForLargeMessages { get; }
public string S3KeyPrefix { get; }
public bool DoNotWrapOutgoingMessages { get; }
public int ReservedBytesInMessageSize { get; }
}