Skip to content

Commit ffd69e9

Browse files
committed
Update to SQS 7.4.0 and v4 SDK
1 parent e6de1e6 commit ffd69e9

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

src/Directory.Packages.props

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
</PropertyGroup>
66
<ItemGroup Label="Versions for direct package references">
77
<PackageVersion Include="Autofac" Version="8.2.0" />
8-
<PackageVersion Include="AWSSDK.CloudWatch" Version="3.7.402.63" />
9-
<PackageVersion Include="AWSSDK.SecurityToken" Version="3.7.401.78" />
8+
<PackageVersion Include="AWSSDK.CloudWatch" Version="4.0.1" />
9+
<PackageVersion Include="AWSSDK.SecurityToken" Version="4.0.0.4" />
1010
<PackageVersion Include="Azure.Identity" Version="1.13.2" />
1111
<PackageVersion Include="Azure.Monitor.Query" Version="1.6.0" />
1212
<PackageVersion Include="Azure.ResourceManager.ServiceBus" Version="1.1.0" />
@@ -31,7 +31,7 @@
3131
<PackageVersion Include="NLog.Extensions.Logging" Version="5.4.0" />
3232
<PackageVersion Include="NServiceBus" Version="9.2.7" />
3333
<PackageVersion Include="NServiceBus.AcceptanceTesting" Version="9.2.6" />
34-
<PackageVersion Include="NServiceBus.AmazonSQS" Version="7.3.0" />
34+
<PackageVersion Include="NServiceBus.AmazonSQS" Version="7.4.0" />
3535
<PackageVersion Include="NServiceBus.CustomChecks" Version="5.0.1" />
3636
<PackageVersion Include="NServiceBus.Extensions.Hosting" Version="3.0.1" />
3737
<PackageVersion Include="NServiceBus.Extensions.Logging" Version="3.0.1" />
@@ -91,4 +91,4 @@
9191
<GlobalPackageReference Include="Microsoft.Build.CopyOnWrite" Version="1.0.334" />
9292
<GlobalPackageReference Include="Particular.Packaging" Version="4.2.2" />
9393
</ItemGroup>
94-
</Project>
94+
</Project>

src/ServiceControl.Transports.SQS/AmazonSQSQuery.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ namespace ServiceControl.Transports.SQS;
1414
using Amazon.CloudWatch.Model;
1515
using Amazon.Runtime;
1616
using Amazon.Runtime.CredentialManagement;
17+
using Amazon.Runtime.Credentials;
1718
using Amazon.SQS;
1819
using Amazon.SQS.Model;
1920
using BrokerThroughput;
@@ -29,7 +30,7 @@ public class AmazonSQSQuery(ILogger<AmazonSQSQuery> logger, TimeProvider timePro
2930
protected override void InitializeCore(ReadOnlyDictionary<string, string> settings)
3031
{
3132
var sqsConnectionString = new SQSTransportConnectionString(transportSettings.ConnectionString);
32-
AWSCredentials credentials = FallbackCredentialsFactory.GetCredentials();
33+
AWSCredentials credentials = DefaultAWSCredentialsIdentityResolver.GetCredentials();
3334
RegionEndpoint? regionEndpoint = null;
3435
if (settings.TryGetValue(AmazonSQSSettings.Profile, out string? profile))
3536
{
@@ -197,8 +198,8 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
197198
{
198199
Namespace = "AWS/SQS",
199200
MetricName = "NumberOfMessagesDeleted",
200-
StartTimeUtc = startDate.ToDateTime(TimeOnly.MinValue),
201-
EndTimeUtc = endDate.ToDateTime(TimeOnly.MaxValue),
201+
StartTime = startDate.ToDateTime(TimeOnly.MinValue),
202+
EndTime = endDate.ToDateTime(TimeOnly.MaxValue),
202203
Period = 24 * 60 * 60, // 1 day
203204
Statistics = ["Sum"],
204205
Dimensions = [
@@ -222,7 +223,10 @@ public override async IAsyncEnumerable<QueueThroughput> GetThroughputPerDay(IBro
222223
// There is a bug in the AWS SDK. The timestamp is actually UTC time, eventhough the DateTime returned type says Local
223224
// See https://github.com/aws/aws-sdk-net/issues/167
224225
// So do not convert the timestamp to UTC time!
225-
data[DateOnly.FromDateTime(datapoint.Timestamp)].TotalThroughput = (long)datapoint.Sum;
226+
if (datapoint.Timestamp.HasValue)
227+
{
228+
data[DateOnly.FromDateTime(datapoint.Timestamp.Value)].TotalThroughput = (long)datapoint.Sum.GetValueOrDefault(0);
229+
}
226230
}
227231

228232
foreach (QueueThroughput queueThroughput in data.Values)

0 commit comments

Comments
 (0)