Skip to content

Commit 9cf7320

Browse files
authored
Queue logic updates (#107)
- Re-queue export request instead of reject when disk space is low. - Subscribe with queue names Signed-off-by: Victor Chang <[email protected]>
1 parent d05f1e3 commit 9cf7320

24 files changed

+93
-71
lines changed

docs/setup/schema.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,10 @@ The `InformaticsGateway` configuration section contains the following sub-sectio
8888
"password": "password",
8989
"virtualHost": "monaideploy",
9090
"exchange": "monaideploy",
91-
"exportRequestQueue": "export_tasks"
91+
"exportRequestQueue": "export_tasks",
92+
"deadLetterExchange": "monaideploy-dead-letter",
93+
"deliveryLimit": 3,
94+
"requeueDelay": 30
9295
}
9396
},
9497
"storage": {

src/.sonarlint/Monai.Deploy.InformaticsGateway.slconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"Profiles": {
1010
"CSharp": {
1111
"ProfileKey": "AX96ONQSnTk2GEVJ9ILJ",
12-
"ProfileTimestamp": "2021-11-22T10:44:23Z"
12+
"ProfileTimestamp": "2022-07-05T10:19:10Z"
1313
}
1414
}
1515
}

src/.sonarlint/project-monai_monai-deploy-informatics-gatewaycsharp.ruleset

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
<Rule Id="S2201" Action="Warning" />
102102
<Rule Id="S2219" Action="Info" />
103103
<Rule Id="S2221" Action="None" />
104-
<Rule Id="S2222" Action="None" />
104+
<Rule Id="S2222" Action="Warning" />
105105
<Rule Id="S2223" Action="Warning" />
106106
<Rule Id="S2225" Action="Warning" />
107107
<Rule Id="S2228" Action="None" />
@@ -362,6 +362,12 @@
362362
<Rule Id="S5659" Action="Warning" />
363363
<Rule Id="S5773" Action="Warning" />
364364
<Rule Id="S6354" Action="None" />
365+
<Rule Id="S6419" Action="Warning" />
366+
<Rule Id="S6420" Action="Warning" />
367+
<Rule Id="S6421" Action="None" />
368+
<Rule Id="S6422" Action="Warning" />
369+
<Rule Id="S6423" Action="None" />
370+
<Rule Id="S6424" Action="Warning" />
365371
<Rule Id="S818" Action="Info" />
366372
<Rule Id="S881" Action="None" />
367373
<Rule Id="S907" Action="Warning" />

src/.sonarlint/sonar.settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"sonar.exclusions":[],"sonar.global.exclusions":["**/build-wrapper-dump.json"],"sonar.inclusions":[]}

src/Api/Monai.Deploy.InformaticsGateway.Api.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
<PrivateAssets>All</PrivateAssets>
3030
</PackageReference>
3131
<PackageReference Include="Macross.Json.Extensions" Version="3.0.0" />
32-
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.6" />
33-
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.2" />
34-
<PackageReference Include="Monai.Deploy.Storage" Version="0.1.1" />
32+
<PackageReference Include="Microsoft.EntityFrameworkCore.Abstractions" Version="6.0.7" />
33+
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.3-rc0010" />
34+
<PackageReference Include="Monai.Deploy.Storage" Version="0.2.0-rc0012" />
3535
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
3636
</ItemGroup>
3737

src/Api/Test/Monai.Deploy.InformaticsGateway.Api.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
~ Copyright 2021-2022 MONAI Consortium
33
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,7 +33,7 @@
3333
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3434
</PackageReference>
3535
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
36-
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.18" />
36+
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.24" />
3737
<PackageReference Include="xRetry" Version="1.8.0" />
3838
<PackageReference Include="xunit" Version="2.4.1" />
3939
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

src/CLI/Monai.Deploy.InformaticsGateway.CLI.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252

5353
<ItemGroup>
5454
<PackageReference Include="Crayon" Version="2.0.64" />
55-
<PackageReference Include="Docker.DotNet" Version="3.125.5" />
55+
<PackageReference Include="Docker.DotNet" Version="3.125.10" />
5656
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
5757
<PrivateAssets>All</PrivateAssets>
5858
</PackageReference>
@@ -62,6 +62,6 @@
6262
<PackageReference Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
6363
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
6464
<PackageReference Include="System.CommandLine.Rendering" Version="0.4.0-alpha.22272.1" />
65-
<PackageReference Include="System.IO.Abstractions" Version="17.0.18" />
65+
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" />
6666
</ItemGroup>
6767
</Project>

src/CLI/Test/Monai.Deploy.InformaticsGateway.CLI.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
3636
<PackageReference Include="Moq" Version="4.18.1" />
3737
<PackageReference Include="System.CommandLine.Hosting" Version="0.4.0-alpha.22272.1" />
38-
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.18" />
38+
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.24" />
3939
<PackageReference Include="xRetry" Version="1.8.0" />
4040
<PackageReference Include="xunit" Version="2.4.1" />
4141
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">

src/Common/Monai.Deploy.InformaticsGateway.Common.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
~ Copyright 2021-2022 MONAI Consortium
33
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,7 +32,7 @@
3232
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
3333
<PrivateAssets>All</PrivateAssets>
3434
</PackageReference>
35-
<PackageReference Include="System.IO.Abstractions" Version="17.0.18" />
35+
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" />
3636
<PackageReference Include="System.Threading.Tasks.Dataflow" Version="6.0.0" />
3737
</ItemGroup>
3838

src/Common/Test/Monai.Deploy.InformaticsGateway.Common.Test.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
~ Copyright 2021-2022 MONAI Consortium
33
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -30,7 +30,7 @@
3030
</PackageReference>
3131
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
3232
<PackageReference Include="Moq" Version="4.18.1" />
33-
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.18" />
33+
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.24" />
3434
<PackageReference Include="xunit" Version="2.4.1" />
3535
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
3636
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/Configuration/Monai.Deploy.InformaticsGateway.Configuration.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
</PackageReference>
3131
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
3232
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
33-
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.2" />
34-
<PackageReference Include="Monai.Deploy.Storage" Version="0.1.1" />
35-
<PackageReference Include="System.IO.Abstractions" Version="17.0.18" />
33+
<PackageReference Include="Monai.Deploy.Messaging" Version="0.1.3-rc0010" />
34+
<PackageReference Include="Monai.Deploy.Storage" Version="0.2.0-rc0012" />
35+
<PackageReference Include="System.IO.Abstractions" Version="17.0.24" />
3636
</ItemGroup>
3737

3838
<ItemGroup>

src/Configuration/Test/Monai.Deploy.InformaticsGateway.Configuration.Test.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
</PackageReference>
3636
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
3737
<PackageReference Include="Moq" Version="4.18.1" />
38-
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.18" />
38+
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.24" />
3939
<PackageReference Include="xunit" Version="2.4.1" />
4040
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
4141
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

src/Database/Monai.Deploy.InformaticsGateway.Database.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@
4242
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
4343
<PrivateAssets>All</PrivateAssets>
4444
</PackageReference>
45-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
46-
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.6">
45+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" />
46+
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.7">
4747
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4848
<PrivateAssets>all</PrivateAssets>
4949
</PackageReference>
50-
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.6" />
50+
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.7" />
5151
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" />
5252
<PackageReference Include="Microsoft.Extensions.Configuration.FileExtensions" Version="6.0.0" />
5353
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />

src/DicomWebClient/CLI/Monai.Deploy.InformaticsGateway.DicomWeb.Client.CLI.csproj

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111

1212
<Project Sdk="Microsoft.NET.Sdk">
1313

14+
<ItemGroup>
15+
<AdditionalFiles Include="..\..\.sonarlint\project-monai_monai-deploy-informatics-gateway\CSharp\SonarLint.xml" Link="SonarLint.xml" />
16+
</ItemGroup>
17+
1418
<ItemGroup>
1519
<ProjectReference Include="..\..\Client.Common\Monai.Deploy.InformaticsGateway.Client.Common.csproj" />
1620
<ProjectReference Include="..\Monai.Deploy.InformaticsGateway.DicomWeb.Client.csproj" />
@@ -22,14 +26,15 @@
2226
<AssemblyName>dicomweb-cli</AssemblyName>
2327
<PublishTrimmed>true</PublishTrimmed>
2428
<PublishReadyToRun>true</PublishReadyToRun>
29+
<CodeAnalysisRuleSet>..\..\.sonarlint\project-monai_monai-deploy-informatics-gatewaycsharp.ruleset</CodeAnalysisRuleSet>
2530
</PropertyGroup>
2631

2732
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
2833
<Optimize>true</Optimize>
2934
</PropertyGroup>
3035

3136
<ItemGroup>
32-
<PackageReference Include="ConsoleAppFramework" Version="4.1.0" />
37+
<PackageReference Include="ConsoleAppFramework" Version="4.2.2" />
3338
<PackageReference Include="fo-dicom" Version="5.0.2" />
3439
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
3540
</ItemGroup>

src/InformaticsGateway/Monai.Deploy.InformaticsGateway.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!--
1+
<!--
22
~ Copyright 2022 MONAI Consortium
33
~
44
~ Licensed under the Apache License, Version 2.0 (the "License");
@@ -33,21 +33,21 @@
3333

3434
<ItemGroup>
3535
<PackageReference Include="Ardalis.GuardClauses" Version="4.0.1" />
36-
<PackageReference Include="DotNext.Threading" Version="4.6.0" />
36+
<PackageReference Include="DotNext.Threading" Version="4.6.1" />
3737
<PackageReference Include="fo-dicom" Version="5.0.2" />
38-
<PackageReference Include="Karambolo.Extensions.Logging.File" Version="3.3.0" />
38+
<PackageReference Include="Karambolo.Extensions.Logging.File" Version="3.3.1" />
3939
<PackageReference Include="GitVersion.MsBuild" Version="5.10.3">
4040
<PrivateAssets>All</PrivateAssets>
4141
</PackageReference>
42-
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.6" />
42+
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" />
4343
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
4444
<PackageReference Include="Microsoft.Extensions.Hosting" Version="6.0.1" />
4545
<PackageReference Include="Microsoft.Extensions.Logging" Version="6.0.0" />
4646
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
4747
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
48-
<PackageReference Include="Monai.Deploy.Storage" Version="0.1.1" />
48+
<PackageReference Include="Monai.Deploy.Storage" Version="0.2.0-rc0012" />
4949
<PackageReference Include="Polly" Version="7.2.3" />
50-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
50+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
5151
</ItemGroup>
5252

5353
<ItemGroup>

src/InformaticsGateway/Services/Export/ExportServiceBase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public Task StopAsync(CancellationToken cancellationToken)
118118

119119
private void SetupPolling()
120120
{
121-
_messageSubscriber.Subscribe(RoutingKey, String.Empty, OnMessageReceivedCallback);
121+
_messageSubscriber.Subscribe(RoutingKey, RoutingKey, OnMessageReceivedCallback);
122122
_logger.ExportEventSubscription(ServiceName, RoutingKey);
123123
}
124124

@@ -127,7 +127,7 @@ private void OnMessageReceivedCallback(MessageReceivedEventArgs eventArgs)
127127
if (!_storageInfoProvider.HasSpaceAvailableForExport)
128128
{
129129
_logger.ExportPausedDueToInsufficientStorageSpace(ServiceName, _storageInfoProvider.AvailableFreeSpace);
130-
_messageSubscriber.Reject(eventArgs.Message);
130+
_messageSubscriber.RequeueWithDelay(eventArgs.Message);
131131
return;
132132
}
133133

src/InformaticsGateway/Test/DummyMessagingService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ internal class DummyMessagingService : IMessageBrokerPublisherService, IMessageB
4747
public void Dispose() => throw new NotImplementedException();
4848
public Task Publish(string topic, Message message) => throw new NotImplementedException();
4949
public void Reject(MessageBase message, bool requeue = true) => throw new NotImplementedException();
50+
public Task RequeueWithDelay(MessageBase message) => throw new NotImplementedException();
5051
public void Subscribe(string topic, string queue, Action<MessageReceivedEventArgs> messageReceivedCallback, ushort prefetchCount = 0) => throw new NotImplementedException();
5152
public void Subscribe(string[] topics, string queue, Action<MessageReceivedEventArgs> messageReceivedCallback, ushort prefetchCount = 0) => throw new NotImplementedException();
5253
public void SubscribeAsync(string topic, string queue, Func<MessageReceivedEventArgs, Task> messageReceivedCallback, ushort prefetchCount = 0) => throw new NotImplementedException();

src/InformaticsGateway/Test/Monai.Deploy.InformaticsGateway.Test.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@
3535
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3636
</PackageReference>
3737
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="2.2.0" />
38-
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.6" />
38+
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="6.0.7" />
3939
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
4040
<PackageReference Include="Moq" Version="4.18.1" />
4141
<PackageReference Include="NPOI" Version="2.5.6" />
42-
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.18" />
42+
<PackageReference Include="System.IO.Abstractions.TestingHelpers" Version="17.0.24" />
4343
<PackageReference Include="xRetry" Version="1.8.0" />
4444
<PackageReference Include="xunit" Version="2.4.1" />
4545
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
4646
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
4747
<PrivateAssets>all</PrivateAssets>
4848
</PackageReference>
49-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.3.1" />
49+
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
5050
</ItemGroup>
5151

5252
<ItemGroup>

0 commit comments

Comments
 (0)