diff --git a/src/OpenMessage.AWS.SNS/OpenMessage.AWS.SNS.csproj b/src/OpenMessage.AWS.SNS/OpenMessage.AWS.SNS.csproj index d794d8e..cce401a 100644 --- a/src/OpenMessage.AWS.SNS/OpenMessage.AWS.SNS.csproj +++ b/src/OpenMessage.AWS.SNS/OpenMessage.AWS.SNS.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/OpenMessage.AWS.SQS/OpenMessage.AWS.SQS.csproj b/src/OpenMessage.AWS.SQS/OpenMessage.AWS.SQS.csproj index 7100c02..e9c41b7 100644 --- a/src/OpenMessage.AWS.SQS/OpenMessage.AWS.SQS.csproj +++ b/src/OpenMessage.AWS.SQS/OpenMessage.AWS.SQS.csproj @@ -6,7 +6,7 @@ - + diff --git a/src/OpenMessage.AWS.SQS/SqsBatchedDispatcher.cs b/src/OpenMessage.AWS.SQS/SqsBatchedDispatcher.cs index 3364a99..e36ff3e 100644 --- a/src/OpenMessage.AWS.SQS/SqsBatchedDispatcher.cs +++ b/src/OpenMessage.AWS.SQS/SqsBatchedDispatcher.cs @@ -56,10 +56,13 @@ public override async Task DispatchAsync(Message message, CancellationToken c { Id = Guid.NewGuid().ToString("N"), MessageAttributes = GetMessageProperties(message), - DelaySeconds = DelaySeconds(message), MessageBody = json }; + var delay = DelaySeconds(message); + if (delay.HasValue) + request.DelaySeconds = delay.Value; + var msg = new SendSqsMessageCommand { Message = request, @@ -81,14 +84,14 @@ public override async Task DispatchAsync(Message message, CancellationToken c } } - private static int DelaySeconds(Message message) + private static int? DelaySeconds(Message message) { if (message is ISupportSendDelay delay && delay.SendDelay > TimeSpan.Zero) { return Math.Min(MaximumSqsDelaySeconds, (int) delay.SendDelay.TotalSeconds); } - return 0; + return null; } private Dictionary GetMessageProperties(Message message)