From 4b53983ff939a7b5a6a4a90ec027117869b5770d Mon Sep 17 00:00:00 2001 From: Neil South <104848880+neildsouth@users.noreply.github.com> Date: Mon, 7 Aug 2023 19:19:15 +0100 Subject: [PATCH] Release/0.1.24 (#209) +semver: patch * adding new fields to messages for external app executions Signed-off-by: Neil South * added forgot licence header Signed-off-by: Neil South * added export request to export cmplete message event Signed-off-by: Neil South * Update ExportRequestEvent and update dependencies (#210) * Update dependencies * Remove ExportRequestType enum and replace with a list of plug-in assembly names * Update dependencies decisions * Include taskId in WorkflowRequestEvent to support multiple external app executions Signed-off-by: Victor Chang --------- Signed-off-by: Neil South Signed-off-by: Victor Chang Co-authored-by: Victor Chang --- doc/dependency_decisions.yml | 54 ++++---- .../API/IMessageBrokerSubscriberService.cs | 24 ---- src/Messaging/Common/ServiceException.cs | 39 ++++++ src/Messaging/Events/ExportCompleteEvent.cs | 6 +- src/Messaging/Events/ExportRequestEvent.cs | 9 ++ src/Messaging/Events/WorkflowRequestEvent.cs | 16 +++ src/Messaging/Monai.Deploy.Messaging.csproj | 4 +- .../IServiceCollectionExtensionsTests.cs | 3 + .../Tests/Monai.Deploy.Messaging.Tests.csproj | 8 +- .../Tests/WorkflowRequestMessageTest.cs | 4 +- .../Factory/RabbitMqConnectionFactory.cs | 10 +- .../Monai.Deploy.Messaging.RabbitMQ.csproj | 4 +- .../RabbitMqMessagePublisherService.cs | 8 +- .../RabbitMqMessageSubscriberService.cs | 51 +++---- ...nai.Deploy.Messaging.RabbitMQ.Tests.csproj | 12 +- .../RabbitMqMessageSubscriberServiceTest.cs | 10 +- third-party-licenses.md | 124 +++++++++--------- 17 files changed, 212 insertions(+), 174 deletions(-) create mode 100644 src/Messaging/Common/ServiceException.cs mode change 100644 => 100755 src/Messaging/Events/ExportCompleteEvent.cs mode change 100644 => 100755 src/Messaging/Events/ExportRequestEvent.cs mode change 100644 => 100755 src/Messaging/Events/WorkflowRequestEvent.cs diff --git a/doc/dependency_decisions.yml b/doc/dependency_decisions.yml index 4e2afb6..39508bf 100755 --- a/doc/dependency_decisions.yml +++ b/doc/dependency_decisions.yml @@ -4,7 +4,7 @@ - :who: mocsharp :why: MIT (https://github.com/ardalis/GuardClauses.Analyzers/raw/master/LICENSE) :versions: - - 4.0.1 + - 4.1.1 :when: 2022-08-16 21:39:30.077666354 Z - - :approve - Castle.Core @@ -23,10 +23,10 @@ - - :approve - Microsoft.CodeCoverage - :who: woodheadio - :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) + :why: MIT (https://github.com/microsoft/vstest/raw/v17.7.0/LICENSE) :versions: - - 17.4.1 - - 17.5.0 + - 17.7.0 + - Microsoft.CodeCoverage :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.Extensions.Diagnostics.HealthChecks @@ -34,7 +34,7 @@ :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - 6.0.12 - - 6.0.14 + - 6.0.20 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions @@ -42,7 +42,7 @@ :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - 6.0.12 - - 6.0.14 + - 6.0.20 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.Extensions.Configuration @@ -162,7 +162,7 @@ - :who: mocsharp :why: MIT (https://github.com/dotnet/runtime/raw/main/LICENSE.TXT) :versions: - - 6.0.3 + - 6.0.4 :when: 2022-08-16 21:39:44.471693654 Z - - :approve - Microsoft.Extensions.Logging.Configuration @@ -223,9 +223,9 @@ - - :approve - Microsoft.NET.Test.Sdk - :who: woodheadio - :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) + :why: MIT (https://github.com/microsoft/vstest/raw/v17.7.0/LICENSE) :versions: - - 17.4.1 + - 17.7.0 - 17.5.0 :when: 2023-08-16 16:49:26.950721112 Z - - :approve @@ -245,17 +245,17 @@ - - :approve - Microsoft.TestPlatform.ObjectModel - :who: woodheadio - :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) + :why: MIT (https://github.com/microsoft/vstest/raw/v17.7.0/LICENSE) :versions: - - 17.4.1 + - 17.7.0 - 17.5.0 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - Microsoft.TestPlatform.TestHost - :who: woodheadio - :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) + :why: MIT (https://github.com/microsoft/vstest/raw/v17.7.0/LICENSE) :versions: - - 17.4.1 + - 17.7.0 - 17.5.0 :when: 2023-08-16 16:49:26.950721112 Z - - :approve @@ -292,14 +292,14 @@ - :who: mocsharp :why: Apache-2.0 (https://github.com/NuGet/NuGet.Client/raw/dev/LICENSE.txt) :versions: - - 5.11.0 + - 6.5.0 :when: 2022-08-16 21:39:52.061412838 Z - - :approve - RabbitMQ.Client - :who: mocsharp :why: Apache-2.0 (https://github.com/rabbitmq/rabbitmq-dotnet-client/raw/main/LICENSE-APACHE2) :versions: - - 6.4.0 + - 6.5.0 :when: 2022-08-16 21:39:52.474284611 Z - - :approve - System.AppContext @@ -481,7 +481,7 @@ - :who: mocsharp :why: MIT (https://github.com/dotnet/corefx/raw/master/LICENSE.TXT) :versions: - - 4.5.4 + - 4.5.5 :when: 2022-08-16 21:40:03.543731192 Z - - :approve - System.Net.Http @@ -740,7 +740,7 @@ - :who: mocsharp :why: MIT ( https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) :versions: - - 4.7.1 + - 7.0.0 :when: 2022-08-16 21:40:19.306691187 Z - - :approve - System.Threading.Tasks @@ -782,7 +782,7 @@ - :who: mocsharp :why: MIT (https://github.com/coverlet-coverage/coverlet/raw/master/LICENSE) :versions: - - 3.2.0 + - 6.0.0 :when: 2022-08-16 21:40:21.855388365 Z - - :approve - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl @@ -901,7 +901,7 @@ - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:29.166018542 Z - - :approve - xunit.abstractions @@ -915,49 +915,49 @@ - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit.analyzers/master/LICENSE) :versions: - - 1.0.0 + - 1.2.0 :when: 2022-08-16 21:40:30.047067134 Z - - :approve - xunit.assert - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:30.526718458 Z - - :approve - xunit.core - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:30.973515441 Z - - :approve - xunit.extensibility.core - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:31.401607230 Z - - :approve - xunit.extensibility.execution - :who: mocsharp :why: Apache-2.0 ( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) :versions: - - 2.4.2 + - 2.5.0 :when: 2022-08-16 21:40:31.845685693 Z - - :approve - xunit.runner.visualstudio - :who: mocsharp :why: MIT ( https://licenses.nuget.org/MIT) :versions: - - 2.4.5 + - 2.5.0 :when: 2022-08-16 21:40:32.294717110 Z - - :approve - Polly - :who: mocsharp :why: MIT ( https://licenses.nuget.org/MIT) :versions: - - 7.2.3 + - 7.2.4 :when: 2022-11-09 18:57:32.294717110 Z - - :approve - Microsoft.AspNetCore.Hosting.Abstractions @@ -993,7 +993,7 @@ :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - 6.0.12 - - 6.0.14 + - 6.0.20 :when: 2023-08-16 16:49:26.950721112 Z - - :approve - System.IO.Pipelines diff --git a/src/Messaging/API/IMessageBrokerSubscriberService.cs b/src/Messaging/API/IMessageBrokerSubscriberService.cs index 49c4613..e43de1e 100755 --- a/src/Messaging/API/IMessageBrokerSubscriberService.cs +++ b/src/Messaging/API/IMessageBrokerSubscriberService.cs @@ -31,30 +31,6 @@ public interface IMessageBrokerSubscriberService : IDisposable /// string Name { get; } - /// - /// Subscribe to a message topic & queue and executes messageReceivedCallback for every message that is received. - /// Either provide a topic, a queue or both. - /// A queue is generated if the name of the queue is not provided. - /// - /// Topic/routing key to bind to - /// Name of the queue to consume - /// Action to be performed when message is received - /// Number of unacknowledged messages to receive at once. Defaults to 0. - [Obsolete("This method is obsolete, use SubscribeAsync instead")] - void Subscribe(string topic, string queue, Action messageReceivedCallback, ushort prefetchCount = 0); - - /// - /// Subscribe to a message topic & queue and executes messageReceivedCallback for every message that is received. - /// Either provide a topic, a queue or both. - /// A queue is generated if the name of the queue is not provided. - /// - /// Topics/routing keys to bind to - /// Name of the queue to consume - /// Action to be performed when message is received - /// Number of unacknowledged messages to receive at once. Defaults to 0. - [Obsolete("This method is obsolete, use SubscribeAsync instead")] - void Subscribe(string[] topics, string queue, Action messageReceivedCallback, ushort prefetchCount = 0); - /// /// Subscribe to a message topic & queue and executes messageReceivedCallback asynchronously for every message that is received. /// Either provide a topic, a queue or both. diff --git a/src/Messaging/Common/ServiceException.cs b/src/Messaging/Common/ServiceException.cs new file mode 100644 index 0000000..6bdaf30 --- /dev/null +++ b/src/Messaging/Common/ServiceException.cs @@ -0,0 +1,39 @@ +/* + * Copyright 2023 MONAI Consortium + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +using System.Runtime.Serialization; + +namespace Monai.Deploy.Messaging.Common +{ + public class ServiceException : Exception + { + public ServiceException() + { + } + + public ServiceException(string? message) : base(message) + { + } + + public ServiceException(string? message, Exception? innerException) : base(message, innerException) + { + } + + protected ServiceException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + } +} diff --git a/src/Messaging/Events/ExportCompleteEvent.cs b/src/Messaging/Events/ExportCompleteEvent.cs old mode 100644 new mode 100755 index fe0d2e7..1af942e --- a/src/Messaging/Events/ExportCompleteEvent.cs +++ b/src/Messaging/Events/ExportCompleteEvent.cs @@ -66,9 +66,9 @@ public ExportCompleteEvent() public ExportCompleteEvent(ExportRequestEvent exportRequest, ExportStatus exportStatus, Dictionary fileStatuses) { - Guard.Against.Null(exportRequest); - Guard.Against.Null(exportStatus); - Guard.Against.Null(fileStatuses); + Guard.Against.Null(exportRequest, nameof(exportRequest)); + Guard.Against.Null(exportStatus, nameof(exportStatus)); + Guard.Against.Null(fileStatuses, nameof(fileStatuses)); WorkflowInstanceId = exportRequest.WorkflowInstanceId; ExportTaskId = exportRequest.ExportTaskId; diff --git a/src/Messaging/Events/ExportRequestEvent.cs b/src/Messaging/Events/ExportRequestEvent.cs old mode 100644 new mode 100755 index 71388f3..f6bfef9 --- a/src/Messaging/Events/ExportRequestEvent.cs +++ b/src/Messaging/Events/ExportRequestEvent.cs @@ -75,9 +75,18 @@ public class ExportRequestEvent : EventBase /// public List ErrorMessages { get; private set; } + /// + /// A list of data output plug-in type names to be executed by the export services. + /// Each string must be a fully-qualified type name. + /// E.g. MyCompnay.MyProject.MyNamepsace.MyPlugin, MyCompnay.MyProject.MyNamepsace where + /// MyCompnay.MyProject.MyNamepsace is the name of the assembly (DLL). + /// + public List PluginAssemblies { get; private set; } + public ExportRequestEvent() { ErrorMessages = new List(); + PluginAssemblies = new List(); } public void AddErrorMessages(IList errorMessages) diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs old mode 100644 new mode 100755 index b437233..1f0be31 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -81,6 +81,22 @@ public class WorkflowRequestEvent : EventBase [Required] public DateTime Timestamp { get; set; } + /// + /// Sets the workflow instance ID for the Workflow Manager. + /// This is only applicable to resume events (after external app executions) + /// In standard workflows this will not be set + /// + [JsonProperty(PropertyName = "workflow_instance_id")] + public string? WorkflowInstanceId { get; set; } = default; + + /// + /// Sets the task ID for the Workflow Manager. + /// This is only applicable to resume events (after external app executions) + /// In standard workflows this will not be set + /// + [JsonProperty(PropertyName = "task_id")] + public string? TaskId { get; set; } = default; + /// /// Gets or sets a list of files and metadata files in this request. /// diff --git a/src/Messaging/Monai.Deploy.Messaging.csproj b/src/Messaging/Monai.Deploy.Messaging.csproj index edade87..70325b7 100644 --- a/src/Messaging/Monai.Deploy.Messaging.csproj +++ b/src/Messaging/Monai.Deploy.Messaging.csproj @@ -74,9 +74,9 @@ - + - + diff --git a/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs b/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs index 6c9042a..473ef81 100644 --- a/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs +++ b/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs @@ -203,7 +203,10 @@ internal class GoodSubscriberService : IMessageBrokerSubscriberService { public string Name => throw new NotImplementedException(); +#pragma warning disable CS0067 // The event 'GoodSubscriberService.OnConnectionError' is never used + // event used by users of this library public event ConnectionErrorHandler? OnConnectionError; +#pragma warning restore CS0067 // The event 'GoodSubscriberService.OnConnectionError' is never used public void Acknowledge(MessageBase message) => throw new NotImplementedException(); diff --git a/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj b/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj index 35ddd1f..c1e398d 100644 --- a/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj +++ b/src/Messaging/Tests/Monai.Deploy.Messaging.Tests.csproj @@ -32,14 +32,14 @@ - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/Messaging/Tests/WorkflowRequestMessageTest.cs b/src/Messaging/Tests/WorkflowRequestMessageTest.cs index 09729b6..dcec857 100644 --- a/src/Messaging/Tests/WorkflowRequestMessageTest.cs +++ b/src/Messaging/Tests/WorkflowRequestMessageTest.cs @@ -36,7 +36,9 @@ public void ConvertsJsonMessageToMessage() FileCount = 10, PayloadId = Guid.NewGuid(), Timestamp = DateTime.Now, - Workflows = new List { Guid.NewGuid().ToString() } + Workflows = new List { Guid.NewGuid().ToString() }, + WorkflowInstanceId = Guid.NewGuid().ToString(), + TaskId = Guid.NewGuid().ToString(), }; var files = new List() diff --git a/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs b/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs index 5fcf592..9fa63cd 100755 --- a/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs +++ b/src/Plugins/RabbitMQ/Factory/RabbitMqConnectionFactory.cs @@ -48,10 +48,10 @@ public RabbitMQConnectionFactory(ILogger logger) public IModel CreateChannel(ChannelType type, string hostName, string username, string password, string virtualHost, string useSSL, string portNumber) { - Guard.Against.NullOrWhiteSpace(hostName); - Guard.Against.NullOrWhiteSpace(username); - Guard.Against.NullOrWhiteSpace(password); - Guard.Against.NullOrWhiteSpace(virtualHost); + Guard.Against.NullOrWhiteSpace(hostName, nameof(hostName)); + Guard.Against.NullOrWhiteSpace(username, nameof(username)); + Guard.Against.NullOrWhiteSpace(password, nameof(password)); + Guard.Against.NullOrWhiteSpace(virtualHost, nameof(virtualHost)); var key = $"{type}{hostName}{username}{HashPassword(password)}{virtualHost}"; @@ -154,7 +154,7 @@ private IConnection CreateConnectionOnly(string hostName, string username, strin private static object HashPassword(string password) { - Guard.Against.NullOrWhiteSpace(password); + Guard.Against.NullOrWhiteSpace(password, nameof(password)); var sha256 = SHA256.Create(); var hash = sha256.ComputeHash(Encoding.UTF8.GetBytes(password)); return string.Join("", hash.Select(x => x.ToString("x2", CultureInfo.InvariantCulture))); diff --git a/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj b/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj index 85fa9c6..5451616 100644 --- a/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj +++ b/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj @@ -63,8 +63,8 @@ - - + + diff --git a/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs b/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs index 5059ec9..cf49876 100755 --- a/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs +++ b/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs @@ -49,7 +49,7 @@ public RabbitMQMessagePublisherService(IOptions logger, IRabbitMQConnectionFactory rabbitMqConnectionFactory) { - Guard.Against.Null(options); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _rabbitMqConnectionFactory = rabbitMqConnectionFactory ?? throw new ArgumentNullException(nameof(rabbitMqConnectionFactory)); @@ -83,7 +83,7 @@ public RabbitMQMessagePublisherService(IOptions configuration) { - Guard.Against.Null(configuration); + Guard.Against.Null(configuration, nameof(configuration)); foreach (var key in ConfigurationKeys.PublisherRequiredKeys) { @@ -96,8 +96,8 @@ internal static void ValidateConfiguration(Dictionary configurat public Task Publish(string topic, Message message) { - Guard.Against.NullOrWhiteSpace(topic); - Guard.Against.Null(message); + Guard.Against.NullOrWhiteSpace(topic, nameof(topic)); + Guard.Against.Null(message, nameof(message)); using var loggingScope = _logger.BeginScope(new LoggingDataDictionary { diff --git a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs index e96603d..cc70e32 100755 --- a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs +++ b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs @@ -58,7 +58,7 @@ public RabbitMQMessageSubscriberService(IOptions logger, IRabbitMQConnectionFactory rabbitMqConnectionFactory) { - Guard.Against.Null(options); + Guard.Against.Null(options, nameof(options)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _rabbitMqConnectionFactory = rabbitMqConnectionFactory ?? throw new ArgumentNullException(nameof(rabbitMqConnectionFactory)); @@ -109,7 +109,7 @@ private void CreateChannel() .Execute(() => { _logger.ConnectingToRabbitMQ(Name, _endpoint, _virtualHost); - _channel = _rabbitMqConnectionFactory.CreateChannel(ChannelType.Subscriber, _endpoint, _username, _password, _virtualHost, _useSSL, _portNumber); + _channel = _rabbitMqConnectionFactory.CreateChannel(ChannelType.Subscriber, _endpoint, _username, _password, _virtualHost, _useSSL, _portNumber) ?? throw new ServiceException("Failed to create a new channel to RabbitMQ"); _channel.ExchangeDeclare(_exchange, ExchangeType.Topic, durable: true, autoDelete: false); _channel.ExchangeDeclare(_deadLetterExchange, ExchangeType.Topic, durable: true, autoDelete: false); _channel.BasicQos(prefetchSize: 0, prefetchCount: 1, global: false); @@ -137,7 +137,7 @@ private void Channel_ModelShutdown(object? sender, ShutdownEventArgs e) internal static void ValidateConfiguration(Dictionary configuration) { - Guard.Against.Null(configuration); + Guard.Against.Null(configuration, nameof(configuration)); foreach (var key in ConfigurationKeys.SubscriberRequiredKeys) { @@ -162,23 +162,14 @@ internal static void ValidateConfiguration(Dictionary configurat throw new ConfigurationException($"{ConfigurationKeys.SubscriberServiceName} has int values of less than 1"); } } - [Obsolete("This method is obsolete, use SubscribeAsync instead")] - public void Subscribe(string topic, string queue, Action messageReceivedCallback, ushort prefetchCount = 0) - => Subscribe(new string[] { topic }, queue, messageReceivedCallback, prefetchCount); - - [Obsolete("This method is obsolete, use SubscribeAsync instead")] - public void Subscribe(string[] topics, string queue, Action messageReceivedCallback, ushort prefetchCount = 0) - { - SubscribeAsync(topics, queue, new Func((args) => { messageReceivedCallback.Invoke(args); return Task.FromResult(0); })); - } public void SubscribeAsync(string topic, string queue, Func messageReceivedCallback, ushort prefetchCount = 0) => SubscribeAsync(new string[] { topic }, queue, messageReceivedCallback, prefetchCount); public void SubscribeAsync(string[] topics, string queue, Func messageReceivedCallback, ushort prefetchCount = 0) { - Guard.Against.Null(topics); - Guard.Against.Null(messageReceivedCallback); + Guard.Against.Null(topics, nameof(topics)); + Guard.Against.Null(messageReceivedCallback, nameof(messageReceivedCallback)); var queueDeclareResult = DeclareQueues(topics, queue, prefetchCount); var consumer = CreateConsumer(messageReceivedCallback, queueDeclareResult); @@ -212,7 +203,7 @@ private EventingBasicConsumer CreateConsumer(Func - + - + - - + + runtime; build; native; contentfiles; analyzers; buildtransitive all - + runtime; build; native; contentfiles; analyzers; buildtransitive all diff --git a/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs b/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs index 72a369c..7e3412a 100755 --- a/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs +++ b/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs @@ -133,7 +133,7 @@ public void SubscribesToATopic() var service = new RabbitMQMessageSubscriberService(_options, _logger.Object, _connectionFactory.Object); - service.Subscribe("topic", "queue", (args) => + service.SubscribeAsync("topic", "queue", async (args) => { Assert.Equal(message.ApplicationId, args.Message.ApplicationId); Assert.Equal(message.ContentType, args.Message.ContentType); @@ -143,6 +143,7 @@ public void SubscribesToATopic() Assert.Equal("topic", args.Message.MessageDescription); Assert.Equal(message.MessageId, args.Message.MessageId); Assert.Equal(message.Body, args.Message.Body); + await Task.CompletedTask.ConfigureAwait(false); }); service.SubscribeAsync("topic", "queue", async (args) => @@ -240,7 +241,7 @@ public void SubscribesToATopicAndDeadLetterQueueIsDown() var service = new RabbitMQMessageSubscriberService(_options, _logger.Object, _connectionFactory.Object); - service.Subscribe("topic", "queue", (args) => + service.SubscribeAsync("topic", "queue", async (args) => { Assert.Equal(message.ApplicationId, args.Message.ApplicationId); Assert.Equal(message.ContentType, args.Message.ContentType); @@ -250,6 +251,7 @@ public void SubscribesToATopicAndDeadLetterQueueIsDown() Assert.Equal("topic", args.Message.MessageDescription); Assert.Equal(message.MessageId, args.Message.MessageId); Assert.Equal(message.Body, args.Message.Body); + await Task.CompletedTask; }); service.SubscribeAsync("topic", "queue", async (args) => @@ -349,7 +351,7 @@ public void SubscribesToATopicAndDeadLetterQueueSubscriptionFailsWithGenericExce var act = () => { - service.Subscribe("topic", "queue", (args) => + service.SubscribeAsync("topic", "queue", async (args) => { Assert.Equal(message.ApplicationId, args.Message.ApplicationId); Assert.Equal(message.ContentType, args.Message.ContentType); @@ -359,7 +361,7 @@ public void SubscribesToATopicAndDeadLetterQueueSubscriptionFailsWithGenericExce Assert.Equal("topic", args.Message.MessageDescription); Assert.Equal(message.MessageId, args.Message.MessageId); Assert.Equal(message.Body, args.Message.Body); - + await Task.CompletedTask; }); }; Assert.Throws(act); diff --git a/third-party-licenses.md b/third-party-licenses.md index 83f195d..5b4ad43 100644 --- a/third-party-licenses.md +++ b/third-party-licenses.md @@ -61,14 +61,14 @@ SOFTWARE.
-Ardalis.GuardClauses 4.0.1 +Ardalis.GuardClauses 4.1.1 ## Ardalis.GuardClauses -- Version: 4.0.1 +- Version: 4.1.1 - Authors: Steve Smith (@ardalis) - Project URL: https://github.com/ardalis/guardclauses -- Source: [NuGet](https://www.nuget.org/packages/Ardalis.GuardClauses/4.0.1) +- Source: [NuGet](https://www.nuget.org/packages/Ardalis.GuardClauses/4.1.1) - License: [MIT](https://github.com/ardalis/GuardClauses.Analyzers/raw/master/LICENSE) @@ -171,15 +171,15 @@ SOFTWARE.
-Microsoft.CodeCoverage 17.4.0 +Microsoft.CodeCoverage 17.7.0 ## Microsoft.CodeCoverage -- Version: 17.4.0 +- Version: 17.7.0 - Authors: Microsoft - Owners: Microsoft - Project URL: https://github.com/microsoft/vstest/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.CodeCoverage/17.4.0) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.CodeCoverage/17.7.0) - License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE) @@ -619,14 +619,14 @@ SOFTWARE.
-Microsoft.Extensions.Diagnostics.HealthChecks 6.0.11 +Microsoft.Extensions.Diagnostics.HealthChecks 6.0.20 ## Microsoft.Extensions.Diagnostics.HealthChecks -- Version: 6.0.11 +- Version: 6.0.20 - Authors: Microsoft - Project URL: https://asp.net/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.Extensions.Diagnostics.HealthChecks/6.0.11) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.Extensions.Diagnostics.HealthChecks/6.0.20) - License: [MIT](https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) @@ -660,14 +660,14 @@ SOFTWARE.
-Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions 6.0.11 +Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions 6.0.20 ## Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions -- Version: 6.0.11 +- Version: 6.0.20 - Authors: Microsoft - Project URL: https://asp.net/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions/6.0.11) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions/6.0.20) - License: [MIT](https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) @@ -947,14 +947,14 @@ SOFTWARE.
-Microsoft.Extensions.Logging.Abstractions 6.0.3 +Microsoft.Extensions.Logging.Abstractions 6.0.4 ## Microsoft.Extensions.Logging.Abstractions -- Version: 6.0.3 +- Version: 6.0.4 - Authors: Microsoft - Project URL: https://dot.net/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions/6.0.3) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.Extensions.Logging.Abstractions/6.0.4) - License: [MIT](https://github.com/dotnet/runtime/raw/main/LICENSE.TXT) @@ -1316,15 +1316,15 @@ SOFTWARE.
-Microsoft.NET.Test.Sdk 17.4.0 +Microsoft.NET.Test.Sdk 17.7.0 ## Microsoft.NET.Test.Sdk -- Version: 17.4.0 +- Version: 17.7.0 - Authors: Microsoft - Owners: Microsoft - Project URL: https://github.com/microsoft/vstest/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.4.0) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.7.0) - License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) @@ -1754,15 +1754,15 @@ consequential or other damages.
-Microsoft.TestPlatform.ObjectModel 17.4.0 +Microsoft.TestPlatform.ObjectModel 17.7.0 ## Microsoft.TestPlatform.ObjectModel -- Version: 17.4.0 +- Version: 17.7.0 - Authors: Microsoft - Owners: Microsoft - Project URL: https://github.com/microsoft/vstest/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.4.0) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.7.0) - License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) @@ -1792,15 +1792,15 @@ SOFTWARE.
-Microsoft.TestPlatform.TestHost 17.4.0 +Microsoft.TestPlatform.TestHost 17.7.0 ## Microsoft.TestPlatform.TestHost -- Version: 17.4.0 +- Version: 17.7.0 - Authors: Microsoft - Owners: Microsoft - Project URL: https://github.com/microsoft/vstest/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.4.0) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.7.0) - License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) @@ -2315,14 +2315,14 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-NuGet.Frameworks 5.11.0 +NuGet.Frameworks 6.5.0 ## NuGet.Frameworks -- Version: 5.11.0 +- Version: 6.5.0 - Authors: Microsoft - Project URL: https://aka.ms/nugetprj -- Source: [NuGet](https://www.nuget.org/packages/NuGet.Frameworks/5.11.0) +- Source: [NuGet](https://www.nuget.org/packages/NuGet.Frameworks/6.5.0) - License: [Apache-2.0](https://github.com/NuGet/NuGet.Client/raw/dev/LICENSE.txt) @@ -2348,14 +2348,14 @@ specific language governing permissions and limitations under the License.
-Polly 7.2.3 +Polly 7.2.4 ## Polly -- Version: 7.2.3 +- Version: 7.2.4 - Authors: Michael Wolfenden, App vNext - Project URL: https://github.com/App-vNext/Polly -- Source: [NuGet](https://www.nuget.org/packages/Polly/7.2.3) +- Source: [NuGet](https://www.nuget.org/packages/Polly/7.2.4) - License: [MIT]( https://licenses.nuget.org/MIT) @@ -2380,14 +2380,14 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
-RabbitMQ.Client 6.4.0 +RabbitMQ.Client 6.5.0 ## RabbitMQ.Client -- Version: 6.4.0 +- Version: 6.5.0 - Authors: VMware - Project URL: https://www.rabbitmq.com/dotnet.html -- Source: [NuGet](https://www.nuget.org/packages/RabbitMQ.Client/6.4.0) +- Source: [NuGet](https://www.nuget.org/packages/RabbitMQ.Client/6.5.0) - License: [Apache-2.0](https://github.com/rabbitmq/rabbitmq-dotnet-client/raw/main/LICENSE-APACHE2) @@ -6489,15 +6489,15 @@ consequential or other damages.
-System.Memory 4.5.4 +System.Memory 4.5.5 ## System.Memory -- Version: 4.5.4 +- Version: 4.5.5 - Authors: Microsoft - Owners: microsoft,dotnetframework - Project URL: https://dot.net/ -- Source: [NuGet](https://www.nuget.org/packages/System.Memory/4.5.4) +- Source: [NuGet](https://www.nuget.org/packages/System.Memory/4.5.5) - License: [MIT](https://github.com/dotnet/corefx/raw/master/LICENSE.TXT) @@ -12613,15 +12613,15 @@ consequential or other damages.
-System.Threading.Channels 4.7.1 +System.Threading.Channels 7.0.0 ## System.Threading.Channels -- Version: 4.7.1 +- Version: 7.0.0 - Authors: Microsoft - Owners: microsoft,dotnetframework - Project URL: https://github.com/dotnet/corefx -- Source: [NuGet](https://www.nuget.org/packages/System.Threading.Channels/4.7.1) +- Source: [NuGet](https://www.nuget.org/packages/System.Threading.Channels/7.0.0) - License: [MIT]( https://github.com/dotnet/corefx/blob/master/LICENSE.TXT) @@ -14740,14 +14740,14 @@ consequential or other damages.
-coverlet.collector 3.2.0 +coverlet.collector 6.0.0 ## coverlet.collector -- Version: 3.2.0 +- Version: 6.0.0 - Authors: tonerdo - Project URL: https://github.com/coverlet-coverage/coverlet -- Source: [NuGet](https://www.nuget.org/packages/coverlet.collector/3.2.0) +- Source: [NuGet](https://www.nuget.org/packages/coverlet.collector/6.0.0) - License: [MIT](https://github.com/coverlet-coverage/coverlet/raw/master/LICENSE) @@ -17983,9 +17983,9 @@ consequential or other damages. ## xunit -- Version: 2.4.2 +- Version: 2.5.0 - Authors: jnewkirk,bradwilson -- Source: [NuGet](https://www.nuget.org/packages/xunit/2.4.2) +- Source: [NuGet](https://www.nuget.org/packages/xunit/2.5.0) - License: [Apache-2.0]( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) @@ -18111,13 +18111,13 @@ Both sets of code are covered by the following license:
-xunit.analyzers 1.0.0 +xunit.analyzers 1.2.0 ## xunit.analyzers -- Version: 1.0.0 +- Version: 1.2.0 - Authors: jnewkirk,bradwilson,marcind -- Source: [NuGet](https://www.nuget.org/packages/xunit.analyzers/1.0.0) +- Source: [NuGet](https://www.nuget.org/packages/xunit.analyzers/1.2.0) - License: [Apache-2.0]( https://raw.githubusercontent.com/xunit/xunit.analyzers/master/LICENSE) @@ -18142,13 +18142,13 @@ limitations under the License.
-xunit.assert 2.4.2 +xunit.assert 2.5.0 ## xunit.assert -- Version: 2.4.2 +- Version: 2.5.0 - Authors: jnewkirk,bradwilson -- Source: [NuGet](https://www.nuget.org/packages/xunit.assert/2.4.2) +- Source: [NuGet](https://www.nuget.org/packages/xunit.assert/2.5.0) - License: [Apache-2.0]( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) @@ -18207,13 +18207,13 @@ Both sets of code are covered by the following license:
-xunit.core 2.4.2 +xunit.core 2.5.0 ## xunit.core -- Version: 2.4.2 +- Version: 2.5.0 - Authors: jnewkirk,bradwilson -- Source: [NuGet](https://www.nuget.org/packages/xunit.core/2.4.2) +- Source: [NuGet](https://www.nuget.org/packages/xunit.core/2.5.0) - License: [Apache-2.0]( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) @@ -18272,13 +18272,13 @@ Both sets of code are covered by the following license:
-xunit.extensibility.core 2.4.2 +xunit.extensibility.core 2.5.0 ## xunit.extensibility.core -- Version: 2.4.2 +- Version: 2.5.0 - Authors: jnewkirk,bradwilson -- Source: [NuGet](https://www.nuget.org/packages/xunit.extensibility.core/2.4.2) +- Source: [NuGet](https://www.nuget.org/packages/xunit.extensibility.core/2.5.0) - License: [Apache-2.0]( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) @@ -18337,13 +18337,13 @@ Both sets of code are covered by the following license:
-xunit.extensibility.execution 2.4.2 +xunit.extensibility.execution 2.5.0 ## xunit.extensibility.execution -- Version: 2.4.2 +- Version: 2.5.0 - Authors: jnewkirk,bradwilson -- Source: [NuGet](https://www.nuget.org/packages/xunit.extensibility.execution/2.4.2) +- Source: [NuGet](https://www.nuget.org/packages/xunit.extensibility.execution/2.5.0) - License: [Apache-2.0]( https://raw.githubusercontent.com/xunit/xunit/master/license.txt) @@ -18402,14 +18402,14 @@ Both sets of code are covered by the following license:
-xunit.runner.visualstudio 2.4.5 +xunit.runner.visualstudio 2.5.0 ## xunit.runner.visualstudio -- Version: 2.4.5 +- Version: 2.5.0 - Authors: .NET Foundation and Contributors - Project URL: https://github.com/xunit/visualstudio.xunit -- Source: [NuGet](https://www.nuget.org/packages/xunit.runner.visualstudio/2.4.5) +- Source: [NuGet](https://www.nuget.org/packages/xunit.runner.visualstudio/2.5.0) - License: [MIT]( https://licenses.nuget.org/MIT)