Skip to content

Commit 71d1769

Browse files
authored
Merge pull request #291 from Project-MONAI/release/2.0.1
Release/2.0.1
2 parents 6fb82bf + 167b523 commit 71d1769

File tree

7 files changed

+49
-30
lines changed

7 files changed

+49
-30
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
steps:
3838
- name: Checkout repository
39-
uses: actions/checkout@v3
39+
uses: actions/checkout@v4
4040
with:
4141
fetch-depth: 0
4242
- uses: actions/setup-dotnet@v3
@@ -52,7 +52,7 @@ jobs:
5252
tools: licensefinder
5353

5454
- name: Enable NuGet cache
55-
uses: actions/[email protected].1
55+
uses: actions/[email protected].2
5656
with:
5757
path: ~/.nuget/packages
5858
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -95,7 +95,7 @@ jobs:
9595
runs-on: ubuntu-latest
9696
steps:
9797
- name: Set up JDK 17
98-
uses: actions/setup-java@v3
98+
uses: actions/setup-java@v4
9999
with:
100100
distribution: 'zulu'
101101
java-version: '17'
@@ -105,14 +105,14 @@ jobs:
105105
dotnet-version: "8.0.x"
106106

107107
- name: Enable NuGet cache
108-
uses: actions/[email protected].1
108+
uses: actions/[email protected].2
109109
with:
110110
path: ~/.nuget/packages
111111
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
112112
restore-keys: |
113113
${{ runner.os }}-nuget
114114
115-
- uses: actions/checkout@v3
115+
- uses: actions/checkout@v4
116116
with:
117117
fetch-depth: 0
118118

@@ -189,7 +189,7 @@ jobs:
189189

190190
steps:
191191
- name: Checkout repository
192-
uses: actions/checkout@v3
192+
uses: actions/checkout@v4
193193
with:
194194
fetch-depth: 0
195195

@@ -198,7 +198,7 @@ jobs:
198198
dotnet-version: "8.0.x"
199199

200200
- name: Enable NuGet cache
201-
uses: actions/[email protected].1
201+
uses: actions/[email protected].2
202202
with:
203203
path: ~/.nuget/packages
204204
key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
@@ -242,15 +242,15 @@ jobs:
242242

243243
- name: Upload Nuget
244244
if: ${{ matrix.os == 'ubuntu-latest' }}
245-
uses: actions/upload-artifact@v3.1.2
245+
uses: actions/upload-artifact@v4.0.0
246246
with:
247247
name: nuget
248248
path: ${{ github.workspace }}/release/*.nupkg
249249
retention-days: 30
250250

251251
- name: Upload Zipped Plug-ins
252252
if: ${{ matrix.os == 'ubuntu-latest' }}
253-
uses: actions/upload-artifact@v3.1.2
253+
uses: actions/upload-artifact@v4.0.0
254254
with:
255255
name: plug-ins
256256
path: ${{ github.workspace }}/src/Plugins/release/*.zip
@@ -315,7 +315,7 @@ jobs:
315315
MAJORMINORPATCH: ${{ needs.build.outputs.majorMinorPatch }}
316316

317317
steps:
318-
- uses: actions/checkout@v3
318+
- uses: actions/checkout@v4
319319
with:
320320
fetch-depth: 0
321321

doc/dependency_decisions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,14 +172,14 @@
172172
- :who: mocsharp
173173
:why: MIT ( https://licenses.nuget.org/MIT)
174174
:versions:
175-
- 8.2.0
175+
- 8.2.1
176176
:when: 2022-11-09 18:57:32.294717110 Z
177177
- - :approve
178178
- Polly.Core
179179
- :who: mocsharp
180180
:why: MIT ( https://licenses.nuget.org/MIT)
181181
:versions:
182-
- 8.2.0
182+
- 8.2.1
183183
:when: 2022-11-09 18:57:32.294717110 Z
184184
- - :approve
185185
- RabbitMQ.Client

src/Plugins/RabbitMQ/ConfigurationKeys.cs

100644100755
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ internal static class ConfigurationKeys
3131
public static readonly string RequeueDelay = "requeueDelay";
3232
public static readonly string UseSSL = "useSSL";
3333
public static readonly string Port = "port";
34-
public static readonly string[] PublisherRequiredKeys = new[] { EndPoint, Username, Password, VirtualHost, Exchange };
35-
public static readonly string[] SubscriberRequiredKeys = new[] { EndPoint, Username, Password, VirtualHost, Exchange, DeadLetterExchange, DeliveryLimit, RequeueDelay };
34+
public static readonly string[] PublisherRequiredKeys = [EndPoint, Username, Password, VirtualHost, Exchange];
35+
public static readonly string[] SubscriberRequiredKeys = [EndPoint, Username, Password, VirtualHost, Exchange, DeadLetterExchange, DeliveryLimit, RequeueDelay];
36+
public static readonly string PrefetchCount = "prefetchCount";
3637
}
3738
}

src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<Compile Include="..\..\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
5656
</ItemGroup>
5757
<ItemGroup>
58-
<PackageReference Include="Polly" Version="8.2.0" />
58+
<PackageReference Include="Polly" Version="8.2.1" />
5959
<PackageReference Include="RabbitMQ.Client" Version="6.8.1" />
6060
</ItemGroup>
6161
<ItemGroup>

src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ public class RabbitMQMessageSubscriberService : IMessageBrokerSubscriberService
4949
private readonly string _portNumber;
5050
private IModel? _channel;
5151
private bool _disposedValue;
52+
private readonly ushort _prefetchCount = 1;
5253

5354
public event ConnectionErrorHandler? OnConnectionError;
5455

@@ -72,19 +73,23 @@ public RabbitMQMessageSubscriberService(IOptions<MessageBrokerServiceConfigurati
7273
_deadLetterExchange = configuration.SubscriberSettings[ConfigurationKeys.DeadLetterExchange];
7374
_deliveryLimit = int.Parse(configuration.SubscriberSettings[ConfigurationKeys.DeliveryLimit], NumberFormatInfo.InvariantInfo);
7475
_requeueDelay = int.Parse(configuration.SubscriberSettings[ConfigurationKeys.RequeueDelay], NumberFormatInfo.InvariantInfo);
76+
if (configuration.SubscriberSettings.TryGetValue(ConfigurationKeys.PrefetchCount, out var value))
77+
{
78+
_prefetchCount = ushort.Parse(value ?? "1", NumberFormatInfo.InvariantInfo);
79+
}
7580

76-
if (configuration.SubscriberSettings.ContainsKey(ConfigurationKeys.UseSSL))
81+
if (configuration.SubscriberSettings.TryGetValue(ConfigurationKeys.UseSSL, out var sslValue))
7782
{
78-
_useSSL = configuration.SubscriberSettings[ConfigurationKeys.UseSSL];
83+
_useSSL = sslValue;
7984
}
8085
else
8186
{
8287
_useSSL = string.Empty;
8388
}
8489

85-
if (configuration.SubscriberSettings.ContainsKey(ConfigurationKeys.Port))
90+
if (configuration.SubscriberSettings.TryGetValue(ConfigurationKeys.Port, out var portValue))
8691
{
87-
_portNumber = configuration.SubscriberSettings[ConfigurationKeys.Port];
92+
_portNumber = portValue;
8893
}
8994
else
9095
{
@@ -112,7 +117,7 @@ private void CreateChannel()
112117
_channel = _rabbitMqConnectionFactory.CreateChannel(ChannelType.Subscriber, _endpoint, _username, _password, _virtualHost, _useSSL, _portNumber) ?? throw new ServiceException("Failed to create a new channel to RabbitMQ");
113118
_channel.ExchangeDeclare(_exchange, ExchangeType.Topic, durable: true, autoDelete: false);
114119
_channel.ExchangeDeclare(_deadLetterExchange, ExchangeType.Topic, durable: true, autoDelete: false);
115-
_channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false);
120+
_channel.BasicQos(prefetchSize: 0, prefetchCount: _prefetchCount, global: false);
116121
_channel.ModelShutdown += Channel_ModelShutdown;
117122
_logger.ConnectedToRabbitMQ(Name, _endpoint, _virtualHost);
118123
});
@@ -234,15 +239,15 @@ private QueueDeclareOk DeclareQueues(string[] topics, string queue, ushort prefe
234239

235240
var queueDeclareResult = _channel!.QueueDeclare(queue: queue, durable: true, exclusive: false, autoDelete: false, arguments: arguments);
236241

237-
var deadLetterExists = QueueExists(deadLetterQueue);
238-
if (deadLetterExists.exists == false)
242+
var (exists, accessable) = QueueExists(deadLetterQueue);
243+
if (exists == false)
239244
{
240245
_channel.QueueDeclare(queue: deadLetterQueue, durable: true, exclusive: false, autoDelete: false);
241246
}
242247

243248
try
244249
{
245-
BindToRoutingKeys(topics, queueDeclareResult.QueueName, deadLetterExists.accessable ? deadLetterQueue : "");
250+
BindToRoutingKeys(topics, queueDeclareResult.QueueName, accessable ? deadLetterQueue : "");
246251
_channel.BasicQos(0, prefetchCount, false);
247252
}
248253
catch (OperationInterruptedException operationInterruptedException)

src/Plugins/RabbitMQ/Tests/Integration/ReliabilityTest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ public ReliabilityTest()
5454
_loggerSubscriber = new Mock<ILogger<RabbitMQMessageSubscriberService>>();
5555
_factory = new RabbitMQConnectionFactory(_logger.Object);
5656

57-
_publishers = new List<IMessageBrokerPublisherService>();
58-
_subscribers = new List<IMessageBrokerSubscriberService>();
57+
_publishers = [];
58+
_subscribers = [];
5959

6060
_options = Options.Create(new MessageBrokerServiceConfiguration());
6161
_options.Value.PublisherSettings[ConfigurationKeys.EndPoint] = RabbitMqConnection.HostName;
@@ -72,7 +72,7 @@ public ReliabilityTest()
7272
_options.Value.SubscriberSettings[ConfigurationKeys.DeliveryLimit] = RabbitMqConnection.DeliveryLimit;
7373
_options.Value.SubscriberSettings[ConfigurationKeys.RequeueDelay] = RabbitMqConnection.RequeueDelay;
7474

75-
_topics = new List<string>();
75+
_topics = [];
7676
_messages = new ConcurrentDictionary<string, int>();
7777
_random = new Random();
7878
SetupTopics();

third-party-licenses.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,9 @@ SOFTWARE.
6060

6161

6262
<details>
63-
<summary>Ardalis.GuardClauses 4.3.0</summary>
6463

64+
<summary>Ardalis.GuardClauses 4.3.0</summary>
6565
## Ardalis.GuardClauses
66-
6766
- Version: 4.3.0
6867
- Authors: Steve Smith (@ardalis)
6968
- Project URL: https://github.com/ardalis/guardclauses
@@ -5537,6 +5536,8 @@ SOFTWARE.
55375536

55385537
```
55395538
.NET Library License Terms | .NET
5539+
MICROSOFT SOFTWARE LICENSE
5540+
TERMS
55405541

55415542

55425543

@@ -12648,7 +12649,6 @@ Insights
1264812649

1264912650
Additional navigation options
1265012651

12651-
1265212652

1265312653

1265412654

@@ -12658,6 +12658,8 @@ Additional navigation options
1265812658

1265912659

1266012660

12661+
Code
12662+
1266112663

1266212664
Code
1266312665

@@ -12672,6 +12674,7 @@ Additional navigation options
1267212674

1267312675
Pull requests
1267412676

12677+
Pull requests
1267512678

1267612679

1267712680

@@ -12681,6 +12684,10 @@ Additional navigation options
1268112684

1268212685

1268312686

12687+
Security
12688+
12689+
12690+
1268412691
Security
1268512692

1268612693

@@ -12723,8 +12730,8 @@ Footer
1272312730

1272412731

1272512732

12726-
1272712733
© 2024 GitHub, Inc.
12734+
1272812735

1272912736

1273012737

@@ -12751,6 +12758,7 @@ Contact
1275112758

1275212759

1275312760

12761+
1275412762
Manage cookies
1275512763

1275612764

@@ -17250,6 +17258,7 @@ consequential or other damages.
1725017258

1725117259

1725217260
<details>
17261+
1725317262
<summary>xunit 2.6.4</summary>
1725417263

1725517264
## xunit
@@ -17382,6 +17391,7 @@ Both sets of code are covered by the following license:
1738217391

1738317392

1738417393
<details>
17394+
1738517395
<summary>xunit.analyzers 1.8.0</summary>
1738617396

1738717397
## xunit.analyzers
@@ -17478,6 +17488,7 @@ Both sets of code are covered by the following license:
1747817488

1747917489

1748017490
<details>
17491+
1748117492
<summary>xunit.core 2.6.4</summary>
1748217493

1748317494
## xunit.core
@@ -17543,6 +17554,7 @@ Both sets of code are covered by the following license:
1754317554

1754417555

1754517556
<details>
17557+
1754617558
<summary>xunit.extensibility.core 2.6.4</summary>
1754717559

1754817560
## xunit.extensibility.core
@@ -17673,6 +17685,7 @@ Both sets of code are covered by the following license:
1767317685

1767417686

1767517687
<details>
17688+
1767617689
<summary>xunit.runner.visualstudio 2.5.6</summary>
1767717690

1767817691
## xunit.runner.visualstudio

0 commit comments

Comments
 (0)