From f0b6067dd2d1a724912323b39943d53732a42c2c Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Wed, 11 Jan 2023 18:49:06 +0000 Subject: [PATCH 01/18] Update dependency decisions Signed-off-by: Victor Chang --- doc/dependency_decisions.yml | 24 +- .../Tests/Unit/ServiceRegistrationTest.cs | 5 +- third-party-licenses.md | 344 +++++++++++++++--- 3 files changed, 311 insertions(+), 62 deletions(-) diff --git a/doc/dependency_decisions.yml b/doc/dependency_decisions.yml index 8e107f3..2c153c5 100644 --- a/doc/dependency_decisions.yml +++ b/doc/dependency_decisions.yml @@ -11,7 +11,7 @@ - :who: mocsharp :why: Apache-2.0 (https://github.com/castleproject/Core/raw/master/LICENSE) :versions: - - 5.1.0 + - 5.1.1 :when: 2022-08-16 21:39:36.541100978 Z - - :approve - JetBrains.Annotations @@ -25,21 +25,21 @@ - :who: mocsharp :why: MIT (https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE) :versions: - - 17.4.0 + - 17.4.1 :when: 2022-08-16 21:39:37.382080790 Z - - :approve - Microsoft.Extensions.Diagnostics.HealthChecks - :who: mocsharp :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - - 6.0.11 + - 6.0.12 :when: 2022-08-29 18:11:22.090772006 Z - - :approve - Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions - :who: mocsharp :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - - 6.0.11 + - 6.0.12 :when: 2022-08-29 18:11:22.090772006 Z - - :approve - Microsoft.Extensions.Configuration @@ -220,9 +220,9 @@ - - :approve - Microsoft.NET.Test.Sdk - :who: mocsharp - :why: MIT (https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) + :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) :versions: - - 17.4.0 + - 17.4.1 :when: 2022-08-16 21:39:48.253593534 Z - - :approve - Microsoft.NETCore.Platforms @@ -241,16 +241,16 @@ - - :approve - Microsoft.TestPlatform.ObjectModel - :who: mocsharp - :why: MIT (https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) + :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) :versions: - - 17.4.0 + - 17.4.1 :when: 2022-08-16 21:39:49.547958989 Z - - :approve - Microsoft.TestPlatform.TestHost - :who: mocsharp - :why: MIT (https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) + :why: MIT (https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) :versions: - - 17.4.0 + - 17.4.1 :when: 2022-08-16 21:39:49.963749572 Z - - :approve - Microsoft.Win32.Primitives @@ -264,7 +264,7 @@ - :who: mocsharp :why: BSD 3-Clause License ( https://raw.githubusercontent.com/moq/moq4/main/License.txt) :versions: - - 4.18.2 + - 4.18.4 :when: 2022-08-16 21:39:50.787673214 Z - - :approve - NETStandard.Library @@ -985,7 +985,7 @@ - :who: mocsharp :why: MIT (https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) :versions: - - 6.0.11 + - 6.0.12 :when: 2022-10-14 23:36:49.751931025 Z - - :approve - System.IO.Pipelines diff --git a/src/Plugins/RabbitMQ/Tests/Unit/ServiceRegistrationTest.cs b/src/Plugins/RabbitMQ/Tests/Unit/ServiceRegistrationTest.cs index 67d142e..ac7b026 100644 --- a/src/Plugins/RabbitMQ/Tests/Unit/ServiceRegistrationTest.cs +++ b/src/Plugins/RabbitMQ/Tests/Unit/ServiceRegistrationTest.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * 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. @@ -32,8 +32,7 @@ public class ValidationTest [Fact(DisplayName = "Validates TaskUpdateEvent")] public void TaskUpdateEventTest() { - //var json = "{\"workflow_instance_id\":\"6caf0cf6-75f8-4120-8117-8f5f0927eb5f\",\"task_id\":\"argo-task\",\"execution_id\":\"1f599e30-626a-4c7b-962a-fc221a574488\",\"correlation_id\":\"e4b06f00-5ce3-4477-86cb-4f3bf20680c2\",\"status\":\"Succeeded\",\"taskStats\":{\"workflowId\":\"6caf0cf6-75f8-4120-8117-8f5f0927eb5f\",\"duration\":-1,\"resourceDuration\":{\"cpu\":12,\"memory\":7},\"nodeInfo\":{\"md-wonderful-bear-f8hjz\":{\"children\":[\"md-wonderful-bear-f8hjz-190249463\"],\"displayName\":\"md-wonderful-bear-f8hjz\",\"finishedAt\":\"2022-07-18T17:13:21+01:00\",\"id\":\"md-wonderful-bear-f8hjz\",\"name\":\"md-wonderful-bear-f8hjz\",\"outboundNodes\":[\"md-wonderful-bear-f8hjz-2400127581\"],\"phase\":\"Succeeded\",\"progress\":\"1/1\",\"resourcesDuration\":{\"cpu\":3,\"memory\":2},\"startedAt\":\"2022-07-18T17:13:11+01:00\",\"templateName\":\"md-workflow-entrypoint\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"Steps\"},\"md-wonderful-bear-f8hjz-190249463\":{\"boundaryID\":\"md-wonderful-bear-f8hjz\",\"children\":[\"md-wonderful-bear-f8hjz-2400127581\"],\"displayName\":\"[0]\",\"finishedAt\":\"2022-07-18T17:13:21+01:00\",\"id\":\"md-wonderful-bear-f8hjz-190249463\",\"name\":\"md-wonderful-bear-f8hjz[0]\",\"phase\":\"Succeeded\",\"progress\":\"1/1\",\"resourcesDuration\":{\"cpu\":3,\"memory\":2},\"startedAt\":\"2022-07-18T17:13:11+01:00\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"StepGroup\"},\"md-wonderful-bear-f8hjz-2400127581\":{\"boundaryID\":\"md-wonderful-bear-f8hjz\",\"displayName\":\"md-workflow-entrypoint\",\"finishedAt\":\"2022-07-18T17:13:18+01:00\",\"hostNodeName\":\"docker-desktop\",\"id\":\"md-wonderful-bear-f8hjz-2400127581\",\"inputs\":{\"parameters\":[{\"name\":\"message\",\"value\":\"{{workflow.parameters.message}}\"}]},\"name\":\"md-wonderful-bear-f8hjz[0].md-workflow-entrypoint\",\"outputs\":{\"artifacts\":[{\"name\":\"main-logs\",\"s3\":{\"key\":\"md-wonderful-bear-f8hjz/md-wonderful-bear-f8hjz-argosay-2400127581/main.log\"}}],\"exitCode\":\"0\"},\"phase\":\"Succeeded\",\"progress\":\"1/1\",\"resourcesDuration\":{\"cpu\":3,\"memory\":2},\"startedAt\":\"2022-07-18T17:13:11+01:00\",\"templateName\":\"argosay\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"Pod\"},\"md-wonderful-bear-f8hjz-2674993913\":{\"boundaryID\":\"md-wonderful-bear-f8hjz-2706448002\",\"children\":[\"md-wonderful-bear-f8hjz-3069151573\"],\"displayName\":\"[1]\",\"finishedAt\":\"2022-07-18T17:13:52+01:00\",\"id\":\"md-wonderful-bear-f8hjz-2674993913\",\"name\":\"md-wonderful-bear-f8hjz.onExit[1]\",\"phase\":\"Succeeded\",\"progress\":\"1/1\",\"resourcesDuration\":{\"cpu\":4,\"memory\":2},\"startedAt\":\"2022-07-18T17:13:42+01:00\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"StepGroup\"},\"md-wonderful-bear-f8hjz-2706448002\":{\"children\":[\"md-wonderful-bear-f8hjz-3681798148\"],\"displayName\":\"md-wonderful-bear-f8hjz.onExit\",\"finishedAt\":\"2022-07-18T17:13:52+01:00\",\"id\":\"md-wonderful-bear-f8hjz-2706448002\",\"name\":\"md-wonderful-bear-f8hjz.onExit\",\"outboundNodes\":[\"md-wonderful-bear-f8hjz-3069151573\"],\"phase\":\"Succeeded\",\"progress\":\"2/2\",\"resourcesDuration\":{\"cpu\":9,\"memory\":5},\"startedAt\":\"2022-07-18T17:13:21+01:00\",\"templateName\":\"exit-message-template\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"Steps\"},\"md-wonderful-bear-f8hjz-3069151573\":{\"boundaryID\":\"md-wonderful-bear-f8hjz-2706448002\",\"displayName\":\"send-message\",\"finishedAt\":\"2022-07-18T17:13:50+01:00\",\"hostNodeName\":\"docker-desktop\",\"id\":\"md-wonderful-bear-f8hjz-3069151573\",\"inputs\":{\"artifacts\":[{\"archive\":{\"none\":{}},\"name\":\"message\",\"path\":\"/tmp/b2d64917-32c5-4c1a-b299-3386dbc144eb.json\",\"s3\":{\"accessKeySecret\":{\"key\":\"accessKey\",\"name\":\"argo-task-637937575309296430\"},\"bucket\":\"test-bucket\",\"endpoint\":\"minio:9000\",\"insecure\":true,\"key\":\"00000000-1000-0000-0000-000000000000/workflows/6caf0cf6-75f8-4120-8117-8f5f0927eb5f/1f599e30-626a-4c7b-962a-fc221a574488/tmp/md-wonderful-bear-f8hjz/messaging/b2d64917-32c5-4c1a-b299-3386dbc144eb.json\",\"secretKeySecret\":{\"key\":\"secretKey\",\"name\":\"argo-task-637937575309296430\"}}}]},\"name\":\"md-wonderful-bear-f8hjz.onExit[1].send-message\",\"outputs\":{\"artifacts\":[{\"name\":\"main-logs\",\"s3\":{\"key\":\"md-wonderful-bear-f8hjz/md-wonderful-bear-f8hjz-send-message-3069151573/main.log\"}}],\"exitCode\":\"0\"},\"phase\":\"Succeeded\",\"progress\":\"1/1\",\"resourcesDuration\":{\"cpu\":4,\"memory\":2},\"startedAt\":\"2022-07-18T17:13:42+01:00\",\"templateName\":\"send-message\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"Pod\"},\"md-wonderful-bear-f8hjz-3681798148\":{\"boundaryID\":\"md-wonderful-bear-f8hjz-2706448002\",\"children\":[\"md-wonderful-bear-f8hjz-743574115\"],\"displayName\":\"[0]\",\"finishedAt\":\"2022-07-18T17:13:42+01:00\",\"id\":\"md-wonderful-bear-f8hjz-3681798148\",\"name\":\"md-wonderful-bear-f8hjz.onExit[0]\",\"phase\":\"Succeeded\",\"progress\":\"2/2\",\"resourcesDuration\":{\"cpu\":9,\"memory\":5},\"startedAt\":\"2022-07-18T17:13:21+01:00\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"StepGroup\"},\"md-wonderful-bear-f8hjz-743574115\":{\"boundaryID\":\"md-wonderful-bear-f8hjz-2706448002\",\"children\":[\"md-wonderful-bear-f8hjz-2674993913\"],\"displayName\":\"generate-message\",\"finishedAt\":\"2022-07-18T17:13:31+01:00\",\"hostNodeName\":\"docker-desktop\",\"id\":\"md-wonderful-bear-f8hjz-743574115\",\"inputs\":{\"parameters\":[{\"name\":\"event\",\"value\":\"{\\\"workflow_instance_id\\\":\\\"6caf0cf6-75f8-4120-8117-8f5f0927eb5f\\\",\\\"task_id\\\":\\\"argo-task\\\",\\\"execution_id\\\":\\\"1f599e30-626a-4c7b-962a-fc221a574488\\\",\\\"correlation_id\\\":\\\"e4b06f00-5ce3-4477-86cb-4f3bf20680c2\\\",\\\"identity\\\":\\\"md-wonderful-bear-f8hjz\\\",\\\"metadata\\\":{},\\\"outputs\\\":[]}\"},{\"name\":\"message\",\"value\":\"\\\"{\\\\\\\"ContentType\\\\\\\":\\\\\\\"application/json\\\\\\\",\\\\\\\"CorrelationID\\\\\\\":\\\\\\\"e4b06f00-5ce3-4477-86cb-4f3bf20680c2\\\\\\\",\\\\\\\"MessageID\\\\\\\":\\\\\\\"b2d64917-32c5-4c1a-b299-3386dbc144eb\\\\\\\",\\\\\\\"Type\\\\\\\":\\\\\\\"TaskCallbackEvent\\\\\\\",\\\\\\\"AppID\\\\\\\":\\\\\\\"Argo\\\\\\\",\\\\\\\"Exchange\\\\\\\":\\\\\\\"monaideploy\\\\\\\",\\\\\\\"RoutingKey\\\\\\\":\\\\\\\"md.tasks.callback\\\\\\\",\\\\\\\"DeliveryMode\\\\\\\":2,\\\\\\\"Body\\\\\\\":\\\\\\\"eyJ3b3JrZmxvd19pbnN0YW5jZV9pZCI6IjZjYWYwY2Y2LTc1ZjgtNDEyMC04MTE3LThmNWYwOTI3ZWI1ZiIsInRhc2tfaWQiOiJhcmdvLXRhc2siLCJleGVjdXRpb25faWQiOiIxZjU5OWUzMC02MjZhLTRjN2ItOTYyYS1mYzIyMWE1NzQ0ODgiLCJjb3JyZWxhdGlvbl9pZCI6ImU0YjA2ZjAwLTVjZTMtNDQ3Ny04NmNiLTRmM2JmMjA2ODBjMiIsImlkZW50aXR5IjoibWQtd29uZGVyZnVsLWJlYXItZjhoanoiLCJtZXRhZGF0YSI6e30sIm91dHB1dHMiOltdfQ==\\\\\\\"}\\\"\"}]},\"name\":\"md-wonderful-bear-f8hjz.onExit[0].generate-message\",\"outputs\":{\"artifacts\":[{\"archive\":{\"none\":{}},\"name\":\"output\",\"path\":\"/tmp\",\"s3\":{\"accessKeySecret\":{\"key\":\"accessKey\",\"name\":\"argo-task-637937575309296430\"},\"bucket\":\"test-bucket\",\"endpoint\":\"minio:9000\",\"insecure\":true,\"key\":\"00000000-1000-0000-0000-000000000000/workflows/6caf0cf6-75f8-4120-8117-8f5f0927eb5f/1f599e30-626a-4c7b-962a-fc221a574488/tmp/md-wonderful-bear-f8hjz/messaging\",\"secretKeySecret\":{\"key\":\"secretKey\",\"name\":\"argo-task-637937575309296430\"}}},{\"name\":\"main-logs\",\"s3\":{\"key\":\"md-wonderful-bear-f8hjz/md-wonderful-bear-f8hjz-generate-message-743574115/main.log\"}}],\"exitCode\":\"0\"},\"phase\":\"Succeeded\",\"progress\":\"1/1\",\"resourcesDuration\":{\"cpu\":5,\"memory\":3},\"startedAt\":\"2022-07-18T17:13:21+01:00\",\"templateName\":\"generate-message\",\"templateScope\":\"local/md-wonderful-bear-f8hjz\",\"type\":\"Pod\"}},\"startedAt\":\"2022-07-18T17:13:11+01:00\",\"finishedAt\":\"2022-07-18T17:13:52+01:00\"},\"reason\":\"None\",\"message\":\"\",\"outputs\":[],\"metadata\":{\"JobIdentity\":\"md-wonderful-bear-f8hjz\"}}"; - var json = """{"taskStats":{"workflowId":"6caf0cf6-75f8-4120-8117-8f5f0927eb5f","resourceDuration.cpu":12,"resourceDuration.memory":7}}"""; + var json = "{'taskStats':{'workflowId':'6caf0cf6-75f8-4120-8117-8f5f0927eb5f','resourceDuration.cpu':12,'resourceDuration.memory':7}}"; var updateEvent = Newtonsoft.Json.JsonConvert.DeserializeObject(json); var message = Assert.Throws(() => updateEvent?.Validate()); var expectedError = "Invalid message: The WorkflowInstanceId field is required. Path: WorkflowInstanceId.,The TaskId field is required. Path: TaskId.,The ExecutionId field is required. Path: ExecutionId.,The CorrelationId field is required. Path: CorrelationId."; diff --git a/third-party-licenses.md b/third-party-licenses.md index f28a267..0483372 100644 --- a/third-party-licenses.md +++ b/third-party-licenses.md @@ -1,5 +1,5 @@ - # Third-Party Licenses @@ -100,14 +99,14 @@ SOFTWARE.
-Castle.Core 5.1.0 +Castle.Core 5.1.1 ## Castle.Core -- Version: 5.1.0 +- Version: 5.1.1 - Authors: Castle Project Contributors - Project URL: http://www.castleproject.org/ -- Source: [NuGet](https://www.nuget.org/packages/Castle.Core/5.1.0) +- Source: [NuGet](https://www.nuget.org/packages/Castle.Core/5.1.1) - License: [Apache-2.0](https://github.com/castleproject/Core/raw/master/LICENSE) @@ -171,15 +170,188 @@ SOFTWARE.
-Microsoft.CodeCoverage 17.4.0 +Microsoft.AspNetCore.Hosting.Abstractions 2.2.0 + +## Microsoft.AspNetCore.Hosting.Abstractions + +- Version: 2.2.0 +- Authors: Microsoft +- Owners: Microsoft +- Project URL: https://asp.net/ +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.AspNetCore.Hosting.Abstractions/2.2.0) +- License: [Apache-2.0]( https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt) + + +``` +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +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. +``` + +
+ + +
+Microsoft.AspNetCore.Hosting.Server.Abstractions 2.2.0 + +## Microsoft.AspNetCore.Hosting.Server.Abstractions + +- Version: 2.2.0 +- Authors: Microsoft +- Owners: Microsoft +- Project URL: https://asp.net/ +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.AspNetCore.Hosting.Server.Abstractions/2.2.0) +- License: [Apache-2.0]( https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt) + + +``` +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +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. +``` + +
+ + +
+Microsoft.AspNetCore.Http.Abstractions 2.2.0 + +## Microsoft.AspNetCore.Http.Abstractions + +- Version: 2.2.0 +- Authors: Microsoft +- Owners: Microsoft +- Project URL: https://asp.net/ +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.AspNetCore.Http.Abstractions/2.2.0) +- License: [Apache-2.0]( https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt) + + +``` +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +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. +``` + +
+ + +
+Microsoft.AspNetCore.Http.Features 2.2.0 + +## Microsoft.AspNetCore.Http.Features + +- Version: 2.2.0 +- Authors: Microsoft +- Owners: Microsoft +- Project URL: https://asp.net/ +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.AspNetCore.Http.Features/2.2.0) +- License: [Apache-2.0]( https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt) + + +``` +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +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. +``` + +
+ + +
+Microsoft.AspNetCore.TestHost 6.0.12 + +## Microsoft.AspNetCore.TestHost + +- Version: 6.0.12 +- Authors: Microsoft +- Project URL: https://asp.net/ +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.AspNetCore.TestHost/6.0.12) +- License: [MIT](https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) + + +``` +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` + +
+ + +
+Microsoft.CodeCoverage 17.4.1 ## Microsoft.CodeCoverage -- Version: 17.4.0 +- Version: 17.4.1 - 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.4.1) - License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.0/LICENSE) @@ -577,6 +749,47 @@ SOFTWARE.
+
+Microsoft.Extensions.DependencyInjection 6.0.1 + +## Microsoft.Extensions.DependencyInjection + +- Version: 6.0.1 +- Authors: Microsoft +- Project URL: https://dot.net/ +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.Extensions.DependencyInjection/6.0.1) +- License: [MIT](https://github.com/dotnet/runtime/raw/main/LICENSE.TXT) + + +``` +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` + +
+ +
Microsoft.Extensions.DependencyInjection.Abstractions 6.0.0 @@ -619,14 +832,14 @@ SOFTWARE.
-Microsoft.Extensions.Diagnostics.HealthChecks 6.0.11 +Microsoft.Extensions.Diagnostics.HealthChecks 6.0.12 ## Microsoft.Extensions.Diagnostics.HealthChecks -- Version: 6.0.11 +- Version: 6.0.12 - 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.12) - License: [MIT](https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) @@ -660,14 +873,14 @@ SOFTWARE.
-Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions 6.0.11 +Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions 6.0.12 ## Microsoft.Extensions.Diagnostics.HealthChecks.Abstractions -- Version: 6.0.11 +- Version: 6.0.12 - 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.12) - License: [MIT](https://github.com/dotnet/aspnetcore/raw/main/LICENSE.txt) @@ -1316,16 +1529,16 @@ SOFTWARE.
-Microsoft.NET.Test.Sdk 17.4.0 +Microsoft.NET.Test.Sdk 17.4.1 ## Microsoft.NET.Test.Sdk -- Version: 17.4.0 +- Version: 17.4.1 - 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) -- License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.NET.Test.Sdk/17.4.1) +- License: [MIT](https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) ``` @@ -1754,16 +1967,16 @@ consequential or other damages.
-Microsoft.TestPlatform.ObjectModel 17.4.0 +Microsoft.TestPlatform.ObjectModel 17.4.1 ## Microsoft.TestPlatform.ObjectModel -- Version: 17.4.0 +- Version: 17.4.1 - Authors: Microsoft - Owners: Microsoft - Project URL: https://github.com/microsoft/vstest/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.4.0) -- License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.ObjectModel/17.4.1) +- License: [MIT](https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) ``` @@ -1792,16 +2005,16 @@ SOFTWARE.
-Microsoft.TestPlatform.TestHost 17.4.0 +Microsoft.TestPlatform.TestHost 17.4.1 ## Microsoft.TestPlatform.TestHost -- Version: 17.4.0 +- Version: 17.4.1 - Authors: Microsoft - Owners: Microsoft - Project URL: https://github.com/microsoft/vstest/ -- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.4.0) -- License: [MIT](https://github.com/microsoft/vstest/raw/v17.3.1/LICENSE) +- Source: [NuGet](https://www.nuget.org/packages/Microsoft.TestPlatform.TestHost/17.4.1) +- License: [MIT](https://github.com/microsoft/vstest/raw/v17.4.1/LICENSE) ``` @@ -2030,14 +2243,14 @@ consequential or other damages.
-Moq 4.18.2 +Moq 4.18.4 ## Moq -- Version: 4.18.2 +- Version: 4.18.4 - Authors: Daniel Cazzulino, kzu - Project URL: https://github.com/moq/moq4 -- Source: [NuGet](https://www.nuget.org/packages/Moq/4.18.2) +- Source: [NuGet](https://www.nuget.org/packages/Moq/4.18.4) - License: [BSD 3-Clause License]( https://raw.githubusercontent.com/moq/moq4/main/License.txt) @@ -5167,7 +5380,7 @@ consequential or other damages.
System.IO.Abstractions 17.2.3 -## TestableIO.System.IO.Abstractions +## System.IO.Abstractions - Version: 17.2.3 - Authors: Tatham Oddie & friends @@ -6088,6 +6301,47 @@ consequential or other damages.
+
+System.IO.Pipelines 6.0.3 + +## System.IO.Pipelines + +- Version: 6.0.3 +- Authors: Microsoft +- Project URL: https://dot.net/ +- Source: [NuGet](https://www.nuget.org/packages/System.IO.Pipelines/6.0.3) +- License: [MIT](https://github.com/dotnet/runtime/raw/main/LICENSE.TXT) + + +``` +The MIT License (MIT) + +Copyright (c) .NET Foundation and Contributors + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +``` + +
+ +
System.Linq 4.3.0 @@ -12673,8 +12927,8 @@ corefx/LICENSE.TXT at master · dotnet/corefx · GitHub -Skip to content +Skip to content @@ -12842,7 +13096,7 @@ Explore -By Plan +For Enterprise @@ -12857,7 +13111,15 @@ By Plan - Compare all + Startups + + + + + + Education + + @@ -13194,15 +13456,7 @@ Code Pull requests -4 - - - - - - -Projects -0 +1 @@ -13240,10 +13494,6 @@ More - Projects - - - Security @@ -13692,7 +13942,7 @@ Footer - © 2022 GitHub, Inc. + © 2023 GitHub, Inc. From 82cbb730cdfa3c511e01429fa262cf841c0c6f43 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Fri, 11 Aug 2023 17:49:27 -0700 Subject: [PATCH 02/18] Release/0.1.24 (#209) (#213) +semver: patch * adding new fields to messages for external app executions * added forgot licence header * added export request to export cmplete message event * 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: Neil South Signed-off-by: Victor Chang --- doc/dependency_decisions.yml | 2 +- .../API/IMessageBrokerSubscriberService.cs | 24 ------------ src/Messaging/Common/ServiceException.cs | 39 +++++++++++++++++++ src/Messaging/Events/ExportRequestEvent.cs | 12 +++--- src/Messaging/Events/WorkflowRequestEvent.cs | 8 ++++ .../IServiceCollectionExtensionsTests.cs | 3 ++ .../Tests/WorkflowRequestMessageTest.cs | 4 +- .../RabbitMqMessageSubscriberService.cs | 14 +------ .../RabbitMqMessageSubscriberServiceTest.cs | 10 +++-- third-party-licenses.md | 1 - 10 files changed, 68 insertions(+), 49 deletions(-) create mode 100644 src/Messaging/Common/ServiceException.cs diff --git a/doc/dependency_decisions.yml b/doc/dependency_decisions.yml index 136e401..4b9fd9b 100755 --- a/doc/dependency_decisions.yml +++ b/doc/dependency_decisions.yml @@ -789,4 +789,4 @@ :why: MIT ( https://licenses.nuget.org/MIT) :versions: - 2.5.0 - :when: 2022-08-16 21:40:32.294717110 Z + :when: 2022-08-16 21:40:32.294717110 Z \ No newline at end of file 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/ExportRequestEvent.cs b/src/Messaging/Events/ExportRequestEvent.cs index 4c2d620..2d6c89e 100755 --- a/src/Messaging/Events/ExportRequestEvent.cs +++ b/src/Messaging/Events/ExportRequestEvent.cs @@ -77,17 +77,17 @@ public class ExportRequestEvent : EventBase public List ErrorMessages { get; private set; } /// - /// Gets or set the ExportRequest type. - /// For standard exports this will be ExportRequestType.None - /// but for exports to external apps this will be ExportRequestType.ExternalProcessing + /// 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). /// - [JsonProperty(PropertyName = "export_request")] - [Required] - public ExportRequestType ExportRequest { get; set; } = default!; + 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 index 6a58f61..1f0be31 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -89,6 +89,14 @@ public class WorkflowRequestEvent : EventBase [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/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/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/Subscriber/RabbitMqMessageSubscriberService.cs b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs index 7a1cda7..017dc64 100755 --- a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs +++ b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs @@ -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); @@ -162,15 +162,6 @@ 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); @@ -212,7 +203,7 @@ private EventingBasicConsumer CreateConsumer(Func + 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 a37caa2..bdd4ee9 100644 --- a/third-party-licenses.md +++ b/third-party-licenses.md @@ -17166,4 +17166,3 @@ Data pulled from spdx/license-list-data on February 9, 2023. ```
- From e941472f6fa3fc4ca6993d17ec9c948a2bd29939 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Fri, 11 Aug 2023 18:09:01 -0700 Subject: [PATCH 03/18] Fix merge issues Signed-off-by: Victor Chang --- src/Messaging/Events/ExportCompleteEvent.cs | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/Messaging/Events/ExportCompleteEvent.cs b/src/Messaging/Events/ExportCompleteEvent.cs index 432b8b5..7893189 100755 --- a/src/Messaging/Events/ExportCompleteEvent.cs +++ b/src/Messaging/Events/ExportCompleteEvent.cs @@ -58,15 +58,6 @@ public class ExportCompleteEvent : EventBase [JsonProperty(PropertyName = "file_statuses")] public Dictionary FileStatuses { get; set; } - /// - /// Gets or set the ExportRequest type. - /// For standard exports this will be ExportRequestType.None - /// but for exports to external apps this will be ExportRequestType.ExternalProcessing - /// - [JsonProperty(PropertyName = "export_request")] - [Required] - public ExportRequestType ExportRequest { get; set; } = default!; - [JsonConstructor] public ExportCompleteEvent() { From 07e219e5427cc0f6459a4eb0f4ffc819590e0f73 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Tue, 22 Aug 2023 09:04:19 -0700 Subject: [PATCH 04/18] gh-127 (#215) New data trigger and data origins to support multiple data sources/modalities Signed-off-by: Victor Chang --- src/Messaging/Events/WorkflowRequestEvent.cs | 66 ++++++++++++++++--- .../Tests/WorkflowRequestMessageTest.cs | 36 +++++++++- 2 files changed, 91 insertions(+), 11 deletions(-) diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 1f0be31..3438f69 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -20,6 +20,56 @@ namespace Monai.Deploy.Messaging.Events { + public class DataOrigin + { + [JsonProperty(PropertyName = "type")] + public DataType DataType { get; set; } + + /// + /// Gets or sets the source of the data: + /// + /// DIMSE: the sender or calling AE Title of the DICOM dataset. + /// ACR inference request: the transaction ID. + /// FHIR/HL7: host name or IP address. + /// DICOMWeb: host name or IP address. + /// + /// + [JsonProperty(PropertyName = "source")] + [Required] + public string Source { get; set; } = default!; + + /// + /// Gets or set the receiving service. + /// + /// DIMSE: the MONAI Deploy AE Title that received the DICOM dataset. + /// ACR inference request: IP address of the receiving service. + /// FHIR/HL7: IP address of the receiving service. + /// DICOMWeb: IP address of the receiving service or the named virtual AE Title. + /// + /// + [JsonProperty(PropertyName = "destination")] + public string Destination { get; set; } = default!; + } + public enum DataType + { + /// + /// Data received via DIMSE services + /// + DIMSE, + /// + /// Data received via DICOMWeb services + /// + DICOMWEB, + /// + /// Data received via FHIR services + /// + FHIR, + /// + /// Data received via HL7 services + /// + HL7, + } + public class WorkflowRequestEvent : EventBase { private readonly List _payload; @@ -60,19 +110,16 @@ public class WorkflowRequestEvent : EventBase public string Bucket { get; set; } = default!; /// - /// For DIMSE, the sender or calling AE Title of the DICOM dataset. - /// For an ACR inference request, the transaction ID. + /// Gets or sets the service that received the original request. /// - [JsonProperty(PropertyName = "calling_aetitle")] - [Required] - public string CallingAeTitle { get; set; } = default!; + [JsonProperty(PropertyName = "trigger")] + public DataOrigin DataTrigger { get; set; } = default!; /// - /// For DIMSE, the MONAI Deploy AE Title received the DICOM dataset. - /// For an ACR inference request, this field is empty. + /// Gets or sets the data origins that were involved in triggering this workflow request. /// - [JsonProperty(PropertyName = "called_aetitle")] - public string CalledAeTitle { get; set; } = default!; + [JsonProperty(PropertyName = "data_origins")] + public List DataOrigins { get; private set; } /// /// Gets or sets the time the data was received. @@ -108,6 +155,7 @@ public WorkflowRequestEvent() { _payload = new List(); Workflows = new List(); + DataOrigins = new List(); } public void AddFiles(IEnumerable files) diff --git a/src/Messaging/Tests/WorkflowRequestMessageTest.cs b/src/Messaging/Tests/WorkflowRequestMessageTest.cs index dcec857..517d478 100644 --- a/src/Messaging/Tests/WorkflowRequestMessageTest.cs +++ b/src/Messaging/Tests/WorkflowRequestMessageTest.cs @@ -30,8 +30,12 @@ public void ConvertsJsonMessageToMessage() var input = new WorkflowRequestEvent() { Bucket = Guid.NewGuid().ToString(), - CalledAeTitle = Guid.NewGuid().ToString(), - CallingAeTitle = Guid.NewGuid().ToString(), + DataTrigger = new DataOrigin + { + DataType = DataType.DIMSE, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + }, CorrelationId = Guid.NewGuid().ToString(), FileCount = 10, PayloadId = Guid.NewGuid(), @@ -40,6 +44,34 @@ public void ConvertsJsonMessageToMessage() WorkflowInstanceId = Guid.NewGuid().ToString(), TaskId = Guid.NewGuid().ToString(), }; + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.DICOMWEB, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.FHIR, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.DIMSE, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); + input.DataOrigins.Add(new DataOrigin + { + DataType = DataType.HL7, + Source = Guid.NewGuid().ToString(), + Destination = Guid.NewGuid().ToString(), + + }); var files = new List() { From 50f2f18bf509a184aead858e26a616664eeaf587 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Thu, 24 Aug 2023 08:38:04 -0700 Subject: [PATCH 05/18] Add ACR enum in DataService (#217) * Add ACR as DataType * Implement GetHashCode() && Equals() * Rename to DataService * Rename JsonProperty for DataService * Add DataService.Unknown * Add .NET JSON support Signed-off-by: Victor Chang --- src/Messaging/Common/BlockStorageInfo.cs | 5 +- src/Messaging/Common/Credentials.cs | 6 ++- src/Messaging/Common/Storage.cs | 9 +++- src/Messaging/Events/EmailRequestEvent.cs | 10 +++- src/Messaging/Events/ExportCompleteEvent.cs | 15 ++++-- src/Messaging/Events/ExportRequestEvent.cs | 17 ++++++- src/Messaging/Events/TaskCallbackEvent.cs | 10 +++- src/Messaging/Events/TaskCancellationEvent.cs | 12 ++++- src/Messaging/Events/TaskDispatchEvent.cs | 18 +++++++- src/Messaging/Events/TaskUpdateEvent.cs | 19 ++++++-- src/Messaging/Events/WorkflowRequestEvent.cs | 46 +++++++++++++++++-- src/Messaging/Monai.Deploy.Messaging.csproj | 1 + .../Tests/WorkflowRequestMessageTest.cs | 10 ++-- .../Monai.Deploy.Messaging.RabbitMQ.csproj | 1 + 14 files changed, 152 insertions(+), 27 deletions(-) diff --git a/src/Messaging/Common/BlockStorageInfo.cs b/src/Messaging/Common/BlockStorageInfo.cs index 4fed0e3..67645f3 100644 --- a/src/Messaging/Common/BlockStorageInfo.cs +++ b/src/Messaging/Common/BlockStorageInfo.cs @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 MONAI Consortium + * Copyright 2021-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. @@ -14,6 +14,7 @@ * limitations under the License. */ +using System.Text.Json.Serialization; using Newtonsoft.Json; namespace Monai.Deploy.Messaging.Common @@ -24,12 +25,14 @@ public class BlockStorageInfo /// Gets or sets the root path to the file. /// [JsonProperty(PropertyName = "path")] + [JsonPropertyName("path")] public string Path { get; set; } = default!; /// /// Gets or sets the root path to the metadata file. /// [JsonProperty(PropertyName = "metadata")] + [JsonPropertyName("metadata")] public string Metadata { get; set; } = default!; } } diff --git a/src/Messaging/Common/Credentials.cs b/src/Messaging/Common/Credentials.cs index de0bdb5..4a9fc16 100644 --- a/src/Messaging/Common/Credentials.cs +++ b/src/Messaging/Common/Credentials.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * Copyright 2022-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. @@ -15,6 +15,7 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Newtonsoft.Json; namespace Monai.Deploy.Messaging.Common @@ -25,6 +26,7 @@ public class Credentials /// Gets or sets the access key or user name of the credentials pair. /// [JsonProperty(PropertyName = "access_key")] + [JsonPropertyName("access_key")] [Required] public string AccessKey { get; set; } @@ -32,6 +34,7 @@ public class Credentials /// Gets or sets the access token or password of the credentials pair. /// [JsonProperty(PropertyName = "access_token")] + [JsonPropertyName("access_token")] [Required] public string AccessToken { get; set; } @@ -39,6 +42,7 @@ public class Credentials /// Gets or sets the session token of the credentials pair. /// [JsonProperty(PropertyName = "session_token")] + [JsonPropertyName("session_token")] public string SessionToken { get; set; } public Credentials() diff --git a/src/Messaging/Common/Storage.cs b/src/Messaging/Common/Storage.cs index 3d71135..3c6ea74 100644 --- a/src/Messaging/Common/Storage.cs +++ b/src/Messaging/Common/Storage.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * Copyright 2022-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. @@ -15,6 +15,7 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Newtonsoft.Json; namespace Monai.Deploy.Messaging.Common @@ -26,6 +27,7 @@ public class Storage : ICloneable /// For Argo, name of the artifact used in the template. /// [JsonProperty(PropertyName = "name")] + [JsonPropertyName("name")] [Required] public string Name { get; set; } @@ -33,6 +35,7 @@ public class Storage : ICloneable /// Gets or sets the endpoint of the storage service. /// [JsonProperty(PropertyName = "endpoint")] + [JsonPropertyName("endpoint")] [Required] public string Endpoint { get; set; } @@ -40,12 +43,14 @@ public class Storage : ICloneable /// Gets or sets credentials for accessing the storage service. /// [JsonProperty(PropertyName = "credentials")] + [JsonPropertyName("credentials")] public Credentials? Credentials { get; set; } /// /// Gets or sets name of the bucket. /// [JsonProperty(PropertyName = "bucket")] + [JsonPropertyName("bucket")] [Required] public string Bucket { get; set; } @@ -53,12 +58,14 @@ public class Storage : ICloneable /// Gets or sets whether the connection should be secured or not. /// [JsonProperty(PropertyName = "secured_connection")] + [JsonPropertyName("secured_connection")] public bool SecuredConnection { get; set; } /// /// Gets or sets the optional relative root path to the data. /// [JsonProperty(PropertyName = "relative_root_path")] + [JsonPropertyName("relative_root_path")] [Required] public string RelativeRootPath { get; set; } diff --git a/src/Messaging/Events/EmailRequestEvent.cs b/src/Messaging/Events/EmailRequestEvent.cs index 195eb37..4ffb2a7 100644 --- a/src/Messaging/Events/EmailRequestEvent.cs +++ b/src/Messaging/Events/EmailRequestEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * Copyright 2022-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. @@ -15,6 +15,7 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Newtonsoft.Json; namespace Monai.Deploy.Messaging.Events @@ -22,29 +23,36 @@ namespace Monai.Deploy.Messaging.Events public class EmailRequestEvent : EventBase { [JsonProperty(PropertyName = "id")] + [JsonPropertyName("id")] [Required] public Guid Id { get; set; } [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] [Required] public string WorkflowInstanceId { get; set; } [JsonProperty(PropertyName = "workflow_name")] + [JsonPropertyName("workflow_name")] [Required] public string WorkflowName { get; set; } [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] [Required] public string TaskId { get; set; } [JsonProperty(PropertyName = "roles")] + [JsonPropertyName("roles")] public string Roles { get; set; } [JsonProperty(PropertyName = "emails")] + [JsonPropertyName("emails")] public string Emails { get; set; } [Required] [JsonProperty(PropertyName = "metadata")] + [JsonPropertyName("metadata")] public Dictionary Metadata { get; set; } public EmailRequestEvent() diff --git a/src/Messaging/Events/ExportCompleteEvent.cs b/src/Messaging/Events/ExportCompleteEvent.cs index 7893189..5a048df 100755 --- a/src/Messaging/Events/ExportCompleteEvent.cs +++ b/src/Messaging/Events/ExportCompleteEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 MONAI Consortium + * Copyright 2021-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. @@ -15,8 +15,8 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Ardalis.GuardClauses; -using Monai.Deploy.Messaging.Common; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -28,6 +28,7 @@ public class ExportCompleteEvent : EventBase /// Gets or sets the workflow instanceID generated by the Workflow Manager. /// [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] [Required] public string WorkflowInstanceId { get; set; } = default!; @@ -35,6 +36,7 @@ public class ExportCompleteEvent : EventBase /// Gets or sets the export task ID generated by the Workflow Manager. /// [JsonProperty(PropertyName = "export_task_id")] + [JsonPropertyName("export_task_id")] [Required] public string ExportTaskId { get; set; } = default!; @@ -42,7 +44,9 @@ public class ExportCompleteEvent : EventBase /// Gets or sets the state of the export task. /// [JsonProperty(PropertyName = "status")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("status")] + [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))] [Required] public ExportStatus Status { get; set; } @@ -50,15 +54,18 @@ public class ExportCompleteEvent : EventBase /// Gets or sets error messages, if any, when exporting. /// [JsonProperty(PropertyName = "message")] + [JsonPropertyName("message")] public string Message { get; set; } = default!; /// /// Gets or sets files exported with its status /// [JsonProperty(PropertyName = "file_statuses")] + [JsonPropertyName("file_statuses")] public Dictionary FileStatuses { get; set; } - [JsonConstructor] + [Newtonsoft.Json.JsonConstructor] + [System.Text.Json.Serialization.JsonConstructor] public ExportCompleteEvent() { Status = ExportStatus.Unknown; diff --git a/src/Messaging/Events/ExportRequestEvent.cs b/src/Messaging/Events/ExportRequestEvent.cs index 2d6c89e..b5fd258 100755 --- a/src/Messaging/Events/ExportRequestEvent.cs +++ b/src/Messaging/Events/ExportRequestEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 MONAI Consortium + * Copyright 2021-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. @@ -15,7 +15,7 @@ */ using System.ComponentModel.DataAnnotations; -using Monai.Deploy.Messaging.Common; +using System.Text.Json.Serialization; using Newtonsoft.Json; namespace Monai.Deploy.Messaging.Events @@ -26,6 +26,7 @@ public class ExportRequestEvent : EventBase /// Gets or sets the workflow instance ID generated by the Workflow Manager. /// [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] [Required] public string WorkflowInstanceId { get; set; } = default!; @@ -33,6 +34,7 @@ public class ExportRequestEvent : EventBase /// Gets or sets the export task ID generated by the Workflow Manager. /// [JsonProperty(PropertyName = "export_task_id")] + [JsonPropertyName("export_task_id")] [Required] public string ExportTaskId { get; set; } = default!; @@ -40,6 +42,7 @@ public class ExportRequestEvent : EventBase /// Gets or sets a list of files to be exported. /// [JsonProperty(PropertyName = "files")] + [JsonPropertyName("files")] [Required, MinLength(1)] public IEnumerable Files { get; set; } = default!; @@ -49,6 +52,7 @@ public class ExportRequestEvent : EventBase /// For ACR, the Transaction ID in the original inference request. /// [JsonProperty(PropertyName = "destinations")] + [JsonPropertyName("destinations")] [Required] public string[] Destinations { get; set; } = default!; @@ -58,22 +62,29 @@ public class ExportRequestEvent : EventBase /// For ACR, use the Transaction ID in the original request. /// [JsonProperty(PropertyName = "correlation_id")] + [JsonPropertyName("correlation_id")] [Required] public string CorrelationId { get; set; } = default!; /// /// Gets or sets the delivery tag or acknowledge token for the task. /// + [JsonProperty(PropertyName = "delivery_tag")] + [JsonPropertyName("delivery_tag")] public string DeliveryTag { get; set; } = default!; /// /// Gets or sets the message ID set by the message broker. /// + [JsonProperty(PropertyName = "message_id")] + [JsonPropertyName("message_id")] public string MessageId { get; set; } = default!; /// /// Gets or sets error messages related to this export task. /// + [JsonProperty(PropertyName = "error_messages")] + [JsonPropertyName("error_messages")] public List ErrorMessages { get; private set; } /// @@ -82,6 +93,8 @@ public class ExportRequestEvent : EventBase /// E.g. MyCompnay.MyProject.MyNamepsace.MyPlugin, MyCompnay.MyProject.MyNamepsace where /// MyCompnay.MyProject.MyNamepsace is the name of the assembly (DLL). /// + [JsonProperty(PropertyName = "plug_in_assemblies")] + [JsonPropertyName("plug_in_assemblies")] public List PluginAssemblies { get; private set; } public ExportRequestEvent() diff --git a/src/Messaging/Events/TaskCallbackEvent.cs b/src/Messaging/Events/TaskCallbackEvent.cs index 0601b88..c088910 100644 --- a/src/Messaging/Events/TaskCallbackEvent.cs +++ b/src/Messaging/Events/TaskCallbackEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * Copyright 2022-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. @@ -15,6 +15,7 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Monai.Deploy.Messaging.Common; using Newtonsoft.Json; @@ -26,6 +27,7 @@ public class TaskCallbackEvent : EventBase /// Gets or sets the ID representing the instance of the workflow. /// [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] [Required] public string WorkflowInstanceId { get; set; } @@ -34,12 +36,14 @@ public class TaskCallbackEvent : EventBase /// [Required] [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] public string TaskId { get; set; } /// /// Gets or sets the execution ID representing the instance of the task. /// [JsonProperty(PropertyName = "execution_id")] + [JsonPropertyName("execution_id")] [Required] public string ExecutionId { get; set; } @@ -47,6 +51,7 @@ public class TaskCallbackEvent : EventBase /// Gets or sets the correlation ID. /// [JsonProperty(PropertyName = "correlation_id")] + [JsonPropertyName("correlation_id")] [Required] public string CorrelationId { get; set; } @@ -54,6 +59,7 @@ public class TaskCallbackEvent : EventBase /// Gets or sets the identity provided by the external service. /// [JsonProperty(PropertyName = "identity")] + [JsonPropertyName("identity")] [Required] public string Identity { get; set; } @@ -61,12 +67,14 @@ public class TaskCallbackEvent : EventBase /// Gets or sets any metadata generated by the task, including any output generated. /// [JsonProperty(PropertyName = "metadata")] + [JsonPropertyName("metadata")] public Dictionary Metadata { get; set; } /// /// Gets or sets the output storage information. /// [JsonProperty(PropertyName = "outputs")] + [JsonPropertyName("outputs")] public List Outputs { get; set; } public TaskCallbackEvent() diff --git a/src/Messaging/Events/TaskCancellationEvent.cs b/src/Messaging/Events/TaskCancellationEvent.cs index 8498384..aae9879 100644 --- a/src/Messaging/Events/TaskCancellationEvent.cs +++ b/src/Messaging/Events/TaskCancellationEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * Copyright 2022-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. @@ -15,7 +15,9 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Newtonsoft.Json; +using Newtonsoft.Json.Converters; namespace Monai.Deploy.Messaging.Events { @@ -25,6 +27,7 @@ public class TaskCancellationEvent : EventBase /// Gets or sets the ID representing the instance of the workflow. /// [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] [Required] public string WorkflowInstanceId { get; set; } = string.Empty; @@ -32,6 +35,7 @@ public class TaskCancellationEvent : EventBase /// Gets or sets the execution ID representing the instance of the task. /// [JsonProperty(PropertyName = "execution_id")] + [JsonPropertyName("execution_id")] [Required] public string ExecutionId { get; set; } = string.Empty; @@ -40,12 +44,14 @@ public class TaskCancellationEvent : EventBase /// [Required] [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] public string TaskId { get; set; } = string.Empty; /// /// Gets or sets the identity provided by the external service. /// [JsonProperty(PropertyName = "identity")] + [JsonPropertyName("identity")] [Required, MaxLength(63)] public string Identity { get; set; } = string.Empty; @@ -53,6 +59,9 @@ public class TaskCancellationEvent : EventBase /// Gets or sets the reason for the cancellation. /// [JsonProperty(PropertyName = "reason")] + [JsonPropertyName("reason")] + [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))] [Required] public FailureReason Reason { get; set; } = FailureReason.Unknown; @@ -60,6 +69,7 @@ public class TaskCancellationEvent : EventBase /// Gets or sets a message relating to the cancellation. /// [JsonProperty(PropertyName = "message")] + [JsonPropertyName("message")] [Required, MaxLength(63)] public string Message { get; set; } = string.Empty; } diff --git a/src/Messaging/Events/TaskDispatchEvent.cs b/src/Messaging/Events/TaskDispatchEvent.cs index 726f7c3..c1aa168 100644 --- a/src/Messaging/Events/TaskDispatchEvent.cs +++ b/src/Messaging/Events/TaskDispatchEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * Copyright 2022-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. @@ -15,6 +15,7 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Monai.Deploy.Messaging.Common; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -27,6 +28,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the ID representing the instance of the workflow. /// [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] [Required] public string WorkflowInstanceId { get; set; } @@ -35,12 +37,14 @@ public class TaskDispatchEvent : EventBase /// [Required] [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] public string TaskId { get; set; } /// /// Gets or sets the execution ID representing the instance of the task. /// [JsonProperty(PropertyName = "execution_id")] + [JsonPropertyName("execution_id")] [Required] public string ExecutionId { get; set; } @@ -48,6 +52,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the payload ID of the current workflow instance. /// [JsonProperty(PropertyName = "payload_id")] + [JsonPropertyName("payload_id")] [Required] public string PayloadId { get; set; } @@ -55,6 +60,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the correlation ID. /// [JsonProperty(PropertyName = "correlation_id")] + [JsonPropertyName("correlation_id")] [Required] public string CorrelationId { get; set; } @@ -62,6 +68,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the type of plug-in the task is associated with. /// [JsonProperty(PropertyName = "type")] + [JsonPropertyName("type")] [Required] public string TaskPluginType { get; set; } @@ -69,13 +76,16 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the task execution arguments. /// [JsonProperty(PropertyName = "task_plugin_arguments")] + [JsonPropertyName("task_plugin_arguments")] public Dictionary TaskPluginArguments { get; set; } /// /// Gets or set the status of the task. /// [JsonProperty(PropertyName = "status")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("status")] + [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))] [Required] public TaskExecutionStatus Status { get; set; } @@ -83,6 +93,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the input storage information. /// [JsonProperty(PropertyName = "inputs")] + [JsonPropertyName("inputs")] [Required, MinLength(1, ErrorMessage = "At least input is required.")] public List Inputs { get; set; } @@ -90,6 +101,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the output storage information. /// [JsonProperty(PropertyName = "outputs")] + [JsonPropertyName("outputs")] [Required] public List Outputs { get; set; } @@ -97,6 +109,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets the intermediate storage information. /// [JsonProperty(PropertyName = "intermediate_storage")] + [JsonPropertyName("intermediate_storage")] [Required] public Storage IntermediateStorage { get; set; } @@ -104,6 +117,7 @@ public class TaskDispatchEvent : EventBase /// Gets or sets any metadata relevant to the task. /// [JsonProperty(PropertyName = "metadata")] + [JsonPropertyName("metadata")] public Dictionary Metadata { get; set; } public TaskDispatchEvent() diff --git a/src/Messaging/Events/TaskUpdateEvent.cs b/src/Messaging/Events/TaskUpdateEvent.cs index 2c2c9fb..b9ea839 100644 --- a/src/Messaging/Events/TaskUpdateEvent.cs +++ b/src/Messaging/Events/TaskUpdateEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2022 MONAI Consortium + * Copyright 2022-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. @@ -15,6 +15,7 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Monai.Deploy.Messaging.Common; using Newtonsoft.Json; using Newtonsoft.Json.Converters; @@ -27,6 +28,7 @@ public class TaskUpdateEvent : EventBase /// Gets or sets the ID representing the instance of the workflow. /// [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] [Required] public string WorkflowInstanceId { get; set; } @@ -35,12 +37,14 @@ public class TaskUpdateEvent : EventBase /// [Required] [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] public string TaskId { get; set; } /// /// Gets or sets the execution ID representing the instance of the task. /// [JsonProperty(PropertyName = "execution_id")] + [JsonPropertyName("execution_id")] [Required] public string ExecutionId { get; set; } @@ -48,6 +52,7 @@ public class TaskUpdateEvent : EventBase /// Gets or sets the correlation ID. /// [JsonProperty(PropertyName = "correlation_id")] + [JsonPropertyName("correlation_id")] [Required] public string CorrelationId { get; set; } @@ -55,7 +60,9 @@ public class TaskUpdateEvent : EventBase /// Gets or set the status of the task. /// [JsonProperty(PropertyName = "status")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("status")] + [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))] [Required] public TaskExecutionStatus Status { get; set; } @@ -63,13 +70,16 @@ public class TaskUpdateEvent : EventBase /// Gets or set the execution stats of the task. /// [JsonProperty(PropertyName = "taskStats")] + [JsonPropertyName("taskStats")] public Dictionary ExecutionStats { get; set; } /// /// Gets or set the failure reason of the task. /// [JsonProperty(PropertyName = "reason")] - [JsonConverter(typeof(StringEnumConverter))] + [JsonPropertyName("reason")] + [Newtonsoft.Json.JsonConverter(typeof(StringEnumConverter))] + [System.Text.Json.Serialization.JsonConverter(typeof(JsonStringEnumConverter))] [Required] public FailureReason Reason { get; set; } @@ -77,18 +87,21 @@ public class TaskUpdateEvent : EventBase /// Gets or set any additional (error) message related to the task. /// [JsonProperty(PropertyName = "message")] + [JsonPropertyName("message")] public string Message { get; set; } /// /// Gets or sets any output artifacts relevent to the output of the task. /// [JsonProperty(PropertyName = "outputs")] + [JsonPropertyName("outputs")] public List Outputs { get; set; } /// /// Gets or sets any metadata relevant to the output of the task. /// [JsonProperty(PropertyName = "metadata")] + [JsonPropertyName("metadata")] public Dictionary Metadata { get; set; } public TaskUpdateEvent() diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 3438f69..982b430 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -1,5 +1,5 @@ /* - * Copyright 2021-2022 MONAI Consortium + * Copyright 2021-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. @@ -15,6 +15,7 @@ */ using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; using Monai.Deploy.Messaging.Common; using Newtonsoft.Json; @@ -22,8 +23,9 @@ namespace Monai.Deploy.Messaging.Events { public class DataOrigin { - [JsonProperty(PropertyName = "type")] - public DataType DataType { get; set; } + [JsonProperty(PropertyName = "dataService")] + [JsonPropertyName("dataService")] + public DataService DataService { get; set; } = DataService.Unknown; /// /// Gets or sets the source of the data: @@ -35,6 +37,7 @@ public class DataOrigin /// /// [JsonProperty(PropertyName = "source")] + [JsonPropertyName("source")] [Required] public string Source { get; set; } = default!; @@ -48,10 +51,28 @@ public class DataOrigin /// /// [JsonProperty(PropertyName = "destination")] + [JsonPropertyName("destination")] public string Destination { get; set; } = default!; + + public override int GetHashCode() + { + return HashCode.Combine(Source, Destination, DataService); + } + + public override bool Equals(object? obj) + { + return obj is DataOrigin dataOrigin && + Source.Equals(dataOrigin.Source, StringComparison.Ordinal) && + Destination.Equals(dataOrigin.Destination, StringComparison.Ordinal) && + DataService.Equals(dataOrigin.DataService); + } } - public enum DataType + public enum DataService { + /// + /// Unknown data service + /// + Unknown, /// /// Data received via DIMSE services /// @@ -59,7 +80,7 @@ public enum DataType /// /// Data received via DICOMWeb services /// - DICOMWEB, + DicomWeb, /// /// Data received via FHIR services /// @@ -68,6 +89,10 @@ public enum DataType /// Data received via HL7 services /// HL7, + /// + /// Data received via ACR API call + /// + ACR, } public class WorkflowRequestEvent : EventBase @@ -78,6 +103,7 @@ public class WorkflowRequestEvent : EventBase /// Gets or sets the ID of the payload which is also used as the root path of the payload. /// [JsonProperty(PropertyName = "payload_id")] + [JsonPropertyName("payload_id")] [Required] public Guid PayloadId { get; set; } @@ -85,12 +111,14 @@ public class WorkflowRequestEvent : EventBase /// Gets or sets the associated workflows to be launched. /// [JsonProperty(PropertyName = "workflows")] + [JsonPropertyName("workflows")] public IEnumerable Workflows { get; set; } /// /// Gets or sets number of files in the payload. /// [JsonProperty(PropertyName = "file_count")] + [JsonPropertyName("file_count")] [Required] public int FileCount { get; set; } @@ -99,6 +127,7 @@ public class WorkflowRequestEvent : EventBase /// For an ACR inference request, the correlation ID is the Transaction ID in the original request. /// [JsonProperty(PropertyName = "correlation_id")] + [JsonPropertyName("correlation_id")] [Required] public string CorrelationId { get; set; } = default!; @@ -106,6 +135,7 @@ public class WorkflowRequestEvent : EventBase /// Gets or set the name of the bucket where the files in are stored. /// [JsonProperty(PropertyName = "bucket")] + [JsonPropertyName("bucket")] [Required] public string Bucket { get; set; } = default!; @@ -113,18 +143,21 @@ public class WorkflowRequestEvent : EventBase /// Gets or sets the service that received the original request. /// [JsonProperty(PropertyName = "trigger")] + [JsonPropertyName("trigger")] public DataOrigin DataTrigger { get; set; } = default!; /// /// Gets or sets the data origins that were involved in triggering this workflow request. /// [JsonProperty(PropertyName = "data_origins")] + [JsonPropertyName("data_origins")] public List DataOrigins { get; private set; } /// /// Gets or sets the time the data was received. /// [JsonProperty(PropertyName = "timestamp")] + [JsonPropertyName("timestamp")] [Required] public DateTime Timestamp { get; set; } @@ -134,6 +167,7 @@ public class WorkflowRequestEvent : EventBase /// In standard workflows this will not be set /// [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] public string? WorkflowInstanceId { get; set; } = default; /// @@ -142,6 +176,7 @@ public class WorkflowRequestEvent : EventBase /// In standard workflows this will not be set /// [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] public string? TaskId { get; set; } = default; /// @@ -149,6 +184,7 @@ public class WorkflowRequestEvent : EventBase /// [JsonProperty(PropertyName = "payload")] [Required, MinLength(1, ErrorMessage = "At least one file is required.")] + [JsonPropertyName("payload")] public IReadOnlyList Payload { get => _payload; } public WorkflowRequestEvent() diff --git a/src/Messaging/Monai.Deploy.Messaging.csproj b/src/Messaging/Monai.Deploy.Messaging.csproj index 4c5df90..3d8f483 100644 --- a/src/Messaging/Monai.Deploy.Messaging.csproj +++ b/src/Messaging/Monai.Deploy.Messaging.csproj @@ -22,6 +22,7 @@ enable false ..\.sonarlint\project-monai_monai-deploy-messagingcsharp.ruleset + true diff --git a/src/Messaging/Tests/WorkflowRequestMessageTest.cs b/src/Messaging/Tests/WorkflowRequestMessageTest.cs index 517d478..22a3553 100644 --- a/src/Messaging/Tests/WorkflowRequestMessageTest.cs +++ b/src/Messaging/Tests/WorkflowRequestMessageTest.cs @@ -32,7 +32,7 @@ public void ConvertsJsonMessageToMessage() Bucket = Guid.NewGuid().ToString(), DataTrigger = new DataOrigin { - DataType = DataType.DIMSE, + DataService = DataService.DIMSE, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), }, @@ -46,28 +46,28 @@ public void ConvertsJsonMessageToMessage() }; input.DataOrigins.Add(new DataOrigin { - DataType = DataType.DICOMWEB, + DataService = DataService.DicomWeb, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), }); input.DataOrigins.Add(new DataOrigin { - DataType = DataType.FHIR, + DataService = DataService.FHIR, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), }); input.DataOrigins.Add(new DataOrigin { - DataType = DataType.DIMSE, + DataService = DataService.DIMSE, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), }); input.DataOrigins.Add(new DataOrigin { - DataType = DataType.HL7, + DataService = DataService.HL7, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), diff --git a/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj b/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj index 4628a97..a8b20e4 100644 --- a/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj +++ b/src/Plugins/RabbitMQ/Monai.Deploy.Messaging.RabbitMQ.csproj @@ -23,6 +23,7 @@ Monai.Deploy.Messaging.RabbitMQ false $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb + true From d6fa301dfaa32f34f580717442ed51045c569b35 Mon Sep 17 00:00:00 2001 From: Victor Chang Date: Tue, 12 Sep 2023 08:20:25 -0700 Subject: [PATCH 06/18] Clean up and reformat (#223) Signed-off-by: Victor Chang --- src/Messaging/Common/ExportRequestType.cs | 1 + src/Messaging/Events/WorkflowRequestEvent.cs | 6 ++++++ .../IServiceCollectionExtensionsTests.cs | 2 ++ src/Messaging/Tests/TaskCallbackEventTest.cs | 1 - .../Tests/WorkflowRequestMessageTest.cs | 4 ---- src/Plugins/RabbitMQ/Logger.cs | 20 +++++++++---------- .../RabbitMqMessagePublisherService.cs | 6 +++--- .../RabbitMqMessageSubscriberService.cs | 13 ++++++------ .../Tests/Integration/ReliabilityTest.cs | 1 - .../RabbitMqMessageSubscriberServiceTest.cs | 1 - 10 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/Messaging/Common/ExportRequestType.cs b/src/Messaging/Common/ExportRequestType.cs index 7309685..1cb3530 100755 --- a/src/Messaging/Common/ExportRequestType.cs +++ b/src/Messaging/Common/ExportRequestType.cs @@ -13,6 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + namespace Monai.Deploy.Messaging.Common { public enum ExportRequestType diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 982b430..27feb7b 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -67,28 +67,34 @@ public override bool Equals(object? obj) DataService.Equals(dataOrigin.DataService); } } + public enum DataService { /// /// Unknown data service /// Unknown, + /// /// Data received via DIMSE services /// DIMSE, + /// /// Data received via DICOMWeb services /// DicomWeb, + /// /// Data received via FHIR services /// FHIR, + /// /// Data received via HL7 services /// HL7, + /// /// Data received via ACR API call /// diff --git a/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs b/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs index 473ef81..32892ea 100644 --- a/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs +++ b/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs @@ -204,8 +204,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/TaskCallbackEventTest.cs b/src/Messaging/Tests/TaskCallbackEventTest.cs index e279a26..21300f9 100644 --- a/src/Messaging/Tests/TaskCallbackEventTest.cs +++ b/src/Messaging/Tests/TaskCallbackEventTest.cs @@ -21,7 +21,6 @@ namespace Monai.Deploy.Messaging.Tests { - public class TaskCallbackEventTest { [Fact(DisplayName = "Validation throws on error")] diff --git a/src/Messaging/Tests/WorkflowRequestMessageTest.cs b/src/Messaging/Tests/WorkflowRequestMessageTest.cs index 22a3553..217be91 100644 --- a/src/Messaging/Tests/WorkflowRequestMessageTest.cs +++ b/src/Messaging/Tests/WorkflowRequestMessageTest.cs @@ -49,28 +49,24 @@ public void ConvertsJsonMessageToMessage() DataService = DataService.DicomWeb, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), - }); input.DataOrigins.Add(new DataOrigin { DataService = DataService.FHIR, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), - }); input.DataOrigins.Add(new DataOrigin { DataService = DataService.DIMSE, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), - }); input.DataOrigins.Add(new DataOrigin { DataService = DataService.HL7, Source = Guid.NewGuid().ToString(), Destination = Guid.NewGuid().ToString(), - }); var files = new List() diff --git a/src/Plugins/RabbitMQ/Logger.cs b/src/Plugins/RabbitMQ/Logger.cs index 5cdcda5..f0e4532 100644 --- a/src/Plugins/RabbitMQ/Logger.cs +++ b/src/Plugins/RabbitMQ/Logger.cs @@ -23,7 +23,7 @@ public static partial class Logger { internal static readonly string LoggingScopeMessageApplication = "Message ID={0}. Application ID={1}."; - [LoggerMessage(EventId = 10000, Level = LogLevel.Information, Message = "Publishing message to {endpoint}/{virtualHost}. Exchange={exchange}, Routing Key={topic}.")] + [LoggerMessage(EventId = 10000, Level = LogLevel.Information, Message = "Publishing message to {endpoint}/{virtualHost}. Exchange: {exchange}, Topic: {topic}.")] public static partial void PublshingRabbitMQ(this ILogger logger, string endpoint, string virtualHost, string exchange, string topic); [LoggerMessage(EventId = 10001, Level = LogLevel.Debug, Message = "{ServiceName} connecting to {endpoint}/{virtualHost}.")] @@ -32,32 +32,32 @@ public static partial class Logger [LoggerMessage(EventId = 10002, Level = LogLevel.Information, Message = "Message received from queue {queue} for {topic}.")] public static partial void MessageReceivedFromQueue(this ILogger logger, string queue, string topic); - [LoggerMessage(EventId = 10003, Level = LogLevel.Information, Message = "Listening for messages from {endpoint}/{virtualHost}. Exchange={exchange}, Queue={queue}, Routing Key={topic}.")] + [LoggerMessage(EventId = 10003, Level = LogLevel.Information, Message = "Listening for messages from {endpoint}/{virtualHost}. Exchange: {exchange}, Queue: {queue}, Topic: {topic}.")] public static partial void SubscribeToRabbitMQQueue(this ILogger logger, string endpoint, string virtualHost, string exchange, string queue, string topic); - [LoggerMessage(EventId = 10004, Level = LogLevel.Information, Message = "Sending message acknowledgement for message {messageId}.")] + [LoggerMessage(EventId = 10004, Level = LogLevel.Information, Message = "Sending message acknowledgment. MessageId: {messageId}.")] public static partial void SendingAcknowledgement(this ILogger logger, string messageId); - [LoggerMessage(EventId = 10005, Level = LogLevel.Information, Message = "Ackowledge sent for message {messageId}. Event Duration {durationMilliseconds}")] + [LoggerMessage(EventId = 10005, Level = LogLevel.Information, Message = "Acknowledgment sent. Message ID: {messageId}. Event Duration: {durationMilliseconds}")] public static partial void AcknowledgementSent(this ILogger logger, string messageId, double durationMilliseconds); - [LoggerMessage(EventId = 10006, Level = LogLevel.Information, Message = "Sending nack message {messageId} and requeuing.")] + [LoggerMessage(EventId = 10006, Level = LogLevel.Information, Message = "Sending nack message. Message ID: {messageId} and requeuing.")] public static partial void SendingNAcknowledgement(this ILogger logger, string messageId); - [LoggerMessage(EventId = 10007, Level = LogLevel.Information, Message = "Nack message sent for message {messageId}, requeue={requeue}.")] + [LoggerMessage(EventId = 10007, Level = LogLevel.Information, Message = "Nack message sent. Message ID: {messageId}. Requeue: @{requeue}.")] public static partial void NAcknowledgementSent(this ILogger logger, string messageId, bool requeue); [LoggerMessage(EventId = 10008, Level = LogLevel.Information, Message = "Closing connections.")] public static partial void ClosingConnections(this ILogger logger); - [LoggerMessage(EventId = 10009, Level = LogLevel.Error, Message = "Invalid or corrupted message received: Queue={queueName}, Topic={topic}, Message ID={messageId}.")] + [LoggerMessage(EventId = 10009, Level = LogLevel.Error, Message = "Invalid or corrupted message received: Queue name: {queueName}. Topic: {topic}. Message ID: {messageId}.")] public static partial void InvalidMessage(this ILogger logger, string queueName, string topic, string messageId, Exception ex); - [LoggerMessage(EventId = 10010, Level = LogLevel.Error, Message = "Exception not handled by the subscriber's callback function: Queue={queueName}, Topic={topic}, Message ID={messageId}.")] + [LoggerMessage(EventId = 10010, Level = LogLevel.Error, Message = "Exception not handled by the subscriber's callback function: Queue name: {queueName}. Topic: {topic}. Message ID: {messageId}.")] public static partial void ErrorNotHandledByCallback(this ILogger logger, string queueName, string topic, string messageId, Exception ex); - [LoggerMessage(EventId = 10011, Level = LogLevel.Error, Message = "Exception thrown: Message ID={messageId}.")] - public static partial void Exception(this ILogger logger, string messageId, Exception ex); + [LoggerMessage(EventId = 10011, Level = LogLevel.Error, Message = "Error requeuing. Message ID: {messageId}.")] + public static partial void ErrorRequeue(this ILogger logger, string messageId, Exception ex); [LoggerMessage(EventId = 10012, Level = LogLevel.Error, Message = "Health check failure.")] public static partial void HealthCheckError(this ILogger logger, Exception ex); diff --git a/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs b/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs index cf49876..295c819 100755 --- a/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs +++ b/src/Plugins/RabbitMQ/Publisher/RabbitMqMessagePublisherService.cs @@ -101,9 +101,9 @@ public Task Publish(string topic, Message message) using var loggingScope = _logger.BeginScope(new LoggingDataDictionary { - ["MessageId"] = message.MessageId, - ["ApplicationId"] = message.ApplicationId, - ["CorrelationId"] = message.CorrelationId + ["@messageId"] = message.MessageId, + ["@applicationId"] = message.ApplicationId, + ["@correlationId"] = message.CorrelationId }); _logger.PublshingRabbitMQ(_endpoint, _virtualHost, _exchange, topic); diff --git a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs index 017dc64..5155850 100755 --- a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs +++ b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs @@ -185,10 +185,10 @@ private EventingBasicConsumer CreateConsumer(Func { - ["MessageId"] = eventArgs.BasicProperties.MessageId, - ["ApplicationId"] = eventArgs.BasicProperties.AppId, - ["CorrelationId"] = eventArgs.BasicProperties.CorrelationId, - ["RecievedTime"] = DateTime.UtcNow + ["@messageId"] = eventArgs.BasicProperties.MessageId, + ["@applicationId"] = eventArgs.BasicProperties.AppId, + ["@correlationId"] = eventArgs.BasicProperties.CorrelationId, + ["@recievedTime"] = DateTime.UtcNow }); _logger.MessageReceivedFromQueue(queueDeclareResult.QueueName, eventArgs.RoutingKey); @@ -274,7 +274,7 @@ public void Acknowledge(MessageBase message) using var loggingScope = _logger.BeginScope(new LoggingDataDictionary { - ["EventDuration"] = eventDuration + ["@eventDuration"] = eventDuration }); _logger.AcknowledgementSent(message.MessageId, eventDuration); } @@ -291,7 +291,7 @@ public async Task RequeueWithDelay(MessageBase message) } catch (Exception e) { - _logger.Exception($"Requeue delay failed.", e); + _logger.ErrorRequeue($"Requeue delay failed.", e); Reject(message, true); } } @@ -379,6 +379,7 @@ private static MessageReceivedEventArgs CreateMessage(string topic, BasicDeliver deliveryTag: eventArgs.DeliveryTag.ToString(CultureInfo.InvariantCulture)), CancellationToken.None); } + private (bool exists, bool accessable) QueueExists(string queueName) { var testChannel = _rabbitMqConnectionFactory.MakeTempChannel(ChannelType.Subscriber, _endpoint, _username, _password, _virtualHost, _useSSL, _portNumber); diff --git a/src/Plugins/RabbitMQ/Tests/Integration/ReliabilityTest.cs b/src/Plugins/RabbitMQ/Tests/Integration/ReliabilityTest.cs index 6bb2448..e49f8cd 100755 --- a/src/Plugins/RabbitMQ/Tests/Integration/ReliabilityTest.cs +++ b/src/Plugins/RabbitMQ/Tests/Integration/ReliabilityTest.cs @@ -144,7 +144,6 @@ public void GivenMessages_WhenPublished_SubscribeShallReceiveAndAckMessages() #pragma warning restore CS1998 // Async method lacks 'await' operators and will run synchronously } - Parallel.For(0, MessageCount, new ParallelOptions { MaxDegreeOfParallelism = MaxDegreeOfParallelism }, i => { var guid = Guid.NewGuid().ToString(); diff --git a/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs b/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs index 7e3412a..a1e1439 100755 --- a/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs +++ b/src/Plugins/RabbitMQ/Tests/Unit/RabbitMqMessageSubscriberServiceTest.cs @@ -375,7 +375,6 @@ await Task.Run(() => s_messageReceived = args.Message; service.Acknowledge(args.Message); }).ConfigureAwait(false); - }); }; Assert.Throws(asyncAct); From 8fec32e0524e3a1f6735705c0ed54d367edb5e54 Mon Sep 17 00:00:00 2001 From: Neil South Date: Wed, 11 Oct 2023 11:28:40 +0100 Subject: [PATCH 07/18] adding new ArtifactsReceivedEvent Signed-off-by: Neil South --- src/Messaging/Common/Artifact.cs | 9 +++++++++ src/Messaging/Events/ArtifactsReceivedEvent.cs | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 src/Messaging/Common/Artifact.cs create mode 100755 src/Messaging/Events/ArtifactsReceivedEvent.cs diff --git a/src/Messaging/Common/Artifact.cs b/src/Messaging/Common/Artifact.cs new file mode 100755 index 0000000..3f1847e --- /dev/null +++ b/src/Messaging/Common/Artifact.cs @@ -0,0 +1,9 @@ + +namespace Monai.Deploy.Messaging.Common +{ + public class Artifact + { + public string Type { get; set; } = string.Empty; + public string Path { get; set; } = string.Empty; + } +} diff --git a/src/Messaging/Events/ArtifactsReceivedEvent.cs b/src/Messaging/Events/ArtifactsReceivedEvent.cs new file mode 100755 index 0000000..f1ba2c1 --- /dev/null +++ b/src/Messaging/Events/ArtifactsReceivedEvent.cs @@ -0,0 +1,12 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Monai.Deploy.Messaging.Events +{ + internal class ArtifactsReceivedEvent + { + } +} From a2f463089a6b77552fa34795af9356edb0e7fe2e Mon Sep 17 00:00:00 2001 From: Neil South Date: Wed, 11 Oct 2023 11:34:57 +0100 Subject: [PATCH 08/18] missed files Signed-off-by: Neil South --- .../Events/ArtifactsReceivedEvent.cs | 45 ++++++++++++++++--- 1 file changed, 39 insertions(+), 6 deletions(-) diff --git a/src/Messaging/Events/ArtifactsReceivedEvent.cs b/src/Messaging/Events/ArtifactsReceivedEvent.cs index f1ba2c1..017141b 100755 --- a/src/Messaging/Events/ArtifactsReceivedEvent.cs +++ b/src/Messaging/Events/ArtifactsReceivedEvent.cs @@ -1,12 +1,45 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; + +using Monai.Deploy.Messaging.Common; +using Newtonsoft.Json; +using System.ComponentModel.DataAnnotations; +using System.Text.Json.Serialization; namespace Monai.Deploy.Messaging.Events { - internal class ArtifactsReceivedEvent + public class ArtifactsReceivedEvent : EventBase { + /// + /// Gets or sets the workflow instanceID generated by the Workflow Manager. + /// + [JsonProperty(PropertyName = "workflow_instance_id")] + [JsonPropertyName("workflow_instance_id")] + [Required] + public string WorkflowInstanceId { get; set; } = default!; + + /// + /// Gets or sets the export task ID generated by the Workflow Manager. + /// + [JsonProperty(PropertyName = "task_id")] + [JsonPropertyName("task_id")] + [Required] + public string TaskId { get; set; } = default!; + + /// + /// Gets or set the correlation ID. + /// For DIMSE, the correlation ID is the UUID associated with the first DICOM association received. + /// For ACR, use the Transaction ID in the original request. + /// + [JsonProperty(PropertyName = "correlation_id")] + [JsonPropertyName("correlation_id")] + [Required] + public string CorrelationId { get; set; } = default!; + + /// + /// Gets or set the list of artifacts. + /// + [JsonProperty(PropertyName = "artifacts")] + [JsonPropertyName("artifacts")] + [Required] + public List Artifacts { get; set; } = new List(); } } From e54294c82165556522e6c3600d05989c898cf868 Mon Sep 17 00:00:00 2001 From: Neil South Date: Wed, 11 Oct 2023 11:44:20 +0100 Subject: [PATCH 09/18] missed file headers Signed-off-by: Neil South --- src/Messaging/Common/Artifact.cs | 17 ++++++++++++++++- src/Messaging/Events/ArtifactsReceivedEvent.cs | 17 ++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Messaging/Common/Artifact.cs b/src/Messaging/Common/Artifact.cs index 3f1847e..e781f65 100755 --- a/src/Messaging/Common/Artifact.cs +++ b/src/Messaging/Common/Artifact.cs @@ -1,4 +1,19 @@ - +/* + * Copyright 2022-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. + */ + namespace Monai.Deploy.Messaging.Common { public class Artifact diff --git a/src/Messaging/Events/ArtifactsReceivedEvent.cs b/src/Messaging/Events/ArtifactsReceivedEvent.cs index 017141b..e7ac819 100755 --- a/src/Messaging/Events/ArtifactsReceivedEvent.cs +++ b/src/Messaging/Events/ArtifactsReceivedEvent.cs @@ -1,4 +1,19 @@ - +/* + * Copyright 2022-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 Monai.Deploy.Messaging.Common; using Newtonsoft.Json; using System.ComponentModel.DataAnnotations; From 5609c11d50ba508205c904fd5f205b4b9d799b39 Mon Sep 17 00:00:00 2001 From: Lillie Dae Date: Wed, 11 Oct 2023 13:52:08 +0100 Subject: [PATCH 10/18] added ArtifactTypeEnum Signed-off-by: Lillie Dae --- .gitignore | 2 + src/Messaging/Common/Artifact.cs | 2 +- src/Messaging/Common/ArtifactTypeEnum.cs | 85 +++++++++++++++++++ src/Messaging/Common/ArtifactTypes.cs | 79 +++++++++++++++++ .../Tests/Common/ArtifactTypesTests.cs | 20 +++++ 5 files changed, 187 insertions(+), 1 deletion(-) create mode 100644 src/Messaging/Common/ArtifactTypeEnum.cs create mode 100644 src/Messaging/Common/ArtifactTypes.cs create mode 100644 src/Messaging/Tests/Common/ArtifactTypesTests.cs diff --git a/.gitignore b/.gitignore index 04343fa..e0e0dd2 100644 --- a/.gitignore +++ b/.gitignore @@ -350,3 +350,5 @@ MigrationBackup/ # Ionide (cross platform F# VS Code tools) working folder .ionide/ + +*/.idea/* diff --git a/src/Messaging/Common/Artifact.cs b/src/Messaging/Common/Artifact.cs index e781f65..ead4b86 100755 --- a/src/Messaging/Common/Artifact.cs +++ b/src/Messaging/Common/Artifact.cs @@ -18,7 +18,7 @@ namespace Monai.Deploy.Messaging.Common { public class Artifact { - public string Type { get; set; } = string.Empty; + public ArtifactTypeEnum Type { get; set; } = ArtifactTypeEnum.Unset; public string Path { get; set; } = string.Empty; } } diff --git a/src/Messaging/Common/ArtifactTypeEnum.cs b/src/Messaging/Common/ArtifactTypeEnum.cs new file mode 100644 index 0000000..3d25524 --- /dev/null +++ b/src/Messaging/Common/ArtifactTypeEnum.cs @@ -0,0 +1,85 @@ +/* + * Copyright 2022-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. + */ + +namespace Monai.Deploy.Messaging.Common +{ + public enum ArtifactTypeEnum + { + Unset, //Unset + AR, //Autorefraction + ASMT, //Content Assessment Results + AU, //Audio + BDUS, //Bone Densitometry (ultrasound) + BI, //Biomagnetic imaging + BMD, //Bone Densitometry (X-Ray) + CR, //Computed Radiography + CT, //Computed Tomography + DG, //Diaphanography + DOC, //Document + DX, //Digital Radiography + ECG, //Electrocardiography + EPS, //Cardiac Electrophysiology + ES, //Endoscopy + FID, //Fiducials + GM, //General Microscopy + HC, //Hard Copy + HD, //Hemodynamic Waveform + IO, //Intra-Oral Radiography + IOL, //Intraocular Lens Data + IVOCT, //Intravascular Optical Coherence Tomography + IVUS, //Intravascular Ultrasound + KER, //Keratometry + KO, //Key Object Selection + LEN, //Lensometry + LS, //Laser surface scan + MG, //Mammography + MR, //Magnetic Resonance + NM, //Nuclear Medicine + OAM, //Ophthalmic Axial Measurements + OCT, //Optical Coherence Tomography (non-Ophthalmic) + OP, //Ophthalmic Photography + OPM, //Ophthalmic Mapping + OPT, //Ophthalmic Tomography + OPV, //Ophthalmic Visual Field + OSS, //Optical Surface Scan + OT, //Other + PLAN, //Plan + PR, //Presentation State + PT, //Positron emission tomography (PET) + PX, //Panoramic X-Ray + REG, //Registration + RESP, //Respiratory Waveform + RF, //Radio Fluoroscopy + RG, //Radiographic imaging (conventional film/screen) + RTDOSE, //Radiotherapy Dose + RTIMAGE, //Radiotherapy Image + RTPLAN, //Radiotherapy Plan + RTRECORD, //RT Treatment Record + RTSTRUCT, //Radiotherapy Structure Set + RWV, //Real World Value Map + SEG, //Segmentation + SM, //Slide Microscopy + SMR, //Stereometric Relationship + SR, //SR Document + SRF, //Subjective Refraction + STAIN, //Automated Slide Stainer + TG, //Thermography + US, //Ultrasound + VA, //Visual Acuity + XA, //X-Ray Angiography + XC, //External-camera Photography + }; +} diff --git a/src/Messaging/Common/ArtifactTypes.cs b/src/Messaging/Common/ArtifactTypes.cs new file mode 100644 index 0000000..97c0908 --- /dev/null +++ b/src/Messaging/Common/ArtifactTypes.cs @@ -0,0 +1,79 @@ +namespace Monai.Deploy.Messaging.Common +{ + public static class ArtifactTypes + { + private static readonly Dictionary ListOfModularity = new() + { + { ArtifactTypeEnum.Unset, "Unset" }, + { ArtifactTypeEnum.AR, "Autorefract (ArtifactType.ion" }, + { ArtifactTypeEnum.ASMT, "Content Assessment Results" }, + { ArtifactTypeEnum.AU, "Audio" }, + { ArtifactTypeEnum.BDUS, "Bone Densitometry (ultrasound)" }, + { ArtifactTypeEnum.BI, "Biomagnetic imaging" }, + { ArtifactTypeEnum.BMD, "Bone Densitometry (X-Ray)" }, + { ArtifactTypeEnum.CR, "Computed Radiography" }, + { ArtifactTypeEnum.CT, "Computed Tomography" }, + { ArtifactTypeEnum.DG, "Diaphanography" }, + { ArtifactTypeEnum.DOC, "Document" }, + { ArtifactTypeEnum.DX, "Digital Radiography" }, + { ArtifactTypeEnum.ECG, "Electrocardiography" }, + { ArtifactTypeEnum.EPS, "Cardiac Electrophysiology" }, + { ArtifactTypeEnum.ES, "Endoscopy" }, + { ArtifactTypeEnum.FID, "Fiducials" }, + { ArtifactTypeEnum.GM, "General Microscopy" }, + { ArtifactTypeEnum.HC, "Hard Copy" }, + { ArtifactTypeEnum.HD, "Hemodynamic Waveform" }, + { ArtifactTypeEnum.IO, "Intra-Oral Radiography" }, + { ArtifactTypeEnum.IOL, "Intraocular Lens Data" }, + { ArtifactTypeEnum.IVOCT, "Intravascular Optical Coherence Tomography" }, + { ArtifactTypeEnum.IVUS, "Intravascular Ultrasound" }, + { ArtifactTypeEnum.KER, "Keratometry" }, + { ArtifactTypeEnum.KO, "Key Object Selection" }, + { ArtifactTypeEnum.LEN, "Lensometry" }, + { ArtifactTypeEnum.LS, "Laser surface scan" }, + { ArtifactTypeEnum.MG, "Mammography" }, + { ArtifactTypeEnum.MR, "Magnetic Resonance" }, + { ArtifactTypeEnum.NM, "Nuclear Medicine" }, + { ArtifactTypeEnum.OAM, "Ophthalmic Axial Measurements" }, + { ArtifactTypeEnum.OCT, "Optical Coherence Tomography (non-Ophthalmic)" }, + { ArtifactTypeEnum.OP, "Ophthalmic Photography" }, + { ArtifactTypeEnum.OPM, "Ophthalmic Mapping" }, + { ArtifactTypeEnum.OPT, "Ophthalmic Tomography" }, + { ArtifactTypeEnum.OPV, "Ophthalmic Visual Field" }, + { ArtifactTypeEnum.OSS, "Optical Surface Scan" }, + { ArtifactTypeEnum.OT, "Other" }, + { ArtifactTypeEnum.PLAN, "Plan" }, + { ArtifactTypeEnum.PR, "Presentation State" }, + { ArtifactTypeEnum.PT, "Positron emission tomography (PET)" }, + { ArtifactTypeEnum.PX, "Panoramic X-Ray" }, + { ArtifactTypeEnum.REG, "Registration" }, + { ArtifactTypeEnum.RESP, "Respiratory Waveform" }, + { ArtifactTypeEnum.RF, "Radio Fluoroscopy" }, + { ArtifactTypeEnum.RG, "Radiographic imaging (conventional film/screen)" }, + { ArtifactTypeEnum.RTDOSE, "Radiotherapy Dose" }, + { ArtifactTypeEnum.RTIMAGE, "Radiotherapy Image" }, + { ArtifactTypeEnum.RTPLAN, "Radiotherapy Plan" }, + { ArtifactTypeEnum.RTRECORD, "RT Treatment Record" }, + { ArtifactTypeEnum.RTSTRUCT, "Radiotherapy Structure Set" }, + { ArtifactTypeEnum.RWV, "Real World Value Map" }, + { ArtifactTypeEnum.SEG, "Segmentation" }, + { ArtifactTypeEnum.SM, "Slide Microscopy" }, + { ArtifactTypeEnum.SMR, "Stereometric Relationship" }, + { ArtifactTypeEnum.SR, "SR Document" }, + { ArtifactTypeEnum.SRF, "Subjective Refraction" }, + { ArtifactTypeEnum.STAIN, "Automated Slide Stainer" }, + { ArtifactTypeEnum.TG, "Thermography" }, + { ArtifactTypeEnum.US, "Ultrasound" }, + { ArtifactTypeEnum.VA, "Visual Acuity" }, + { ArtifactTypeEnum.XA, "X-Ray Angiography" }, + { ArtifactTypeEnum.XC, "External-camera Photography" }, + }; + + public static bool Validate(string artifactType) + { + return ListOfModularity.Any(x => + Enum.TryParse(artifactType, out var artifact) + && x.Key == artifact); + } + } +} diff --git a/src/Messaging/Tests/Common/ArtifactTypesTests.cs b/src/Messaging/Tests/Common/ArtifactTypesTests.cs new file mode 100644 index 0000000..dbfe112 --- /dev/null +++ b/src/Messaging/Tests/Common/ArtifactTypesTests.cs @@ -0,0 +1,20 @@ +using Monai.Deploy.Messaging.Common; +using Xunit; + +namespace Monai.Deploy.Messaging.Tests.Common +{ + public class ArtifactTypesTests + { + [Fact] + public void ArtifactTypeValid_ShouldReturnTrue() + { + Assert.True(ArtifactTypes.Validate("CR")); + } + + [Fact] + public void ArtifactTypeInvalid_ShouldReturnFalse() + { + Assert.False(ArtifactTypes.Validate("false")); + } + } +} From d4fb6a1c027c24dd9ca81e40fbbd68b65d8bc48f Mon Sep 17 00:00:00 2001 From: Lillie Dae Date: Wed, 11 Oct 2023 13:54:33 +0100 Subject: [PATCH 11/18] added ArtifactTypeEnum Signed-off-by: Lillie Dae --- src/Monai.Deploy.Messaging.sln.DotSettings | 83 ++++++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 src/Monai.Deploy.Messaging.sln.DotSettings diff --git a/src/Monai.Deploy.Messaging.sln.DotSettings b/src/Monai.Deploy.Messaging.sln.DotSettings new file mode 100644 index 0000000..baf33b3 --- /dev/null +++ b/src/Monai.Deploy.Messaging.sln.DotSettings @@ -0,0 +1,83 @@ + + AR + AS + ASMT + AU + BDUS + BI + BMD + CD + CF + CP + CR + CS + CT + DD + DF + DG + DM + DOC + DS + DX + EC + ECG + EPS + ES + FA + FID + FS + GM + HC + HD + IO + IOL + IVOCT + IVUS + KER + KO + LEN + LP + LS + MA + MG + MR + MS + NM + OAM + OCT + OP + OPM + OPR + OPT + OPV + OSS + OT + PLAN + PR + PT + PX + REG + RESP + RF + RG + RTDOSE + RTIMAGE + RTPLAN + RTRECORD + RTSTRUCT + RWV + SEG + SM + SMR + SR + SRF + ST + STAIN + TG + US + VA + VF + XA + XC + , + From eb3c3eba8a2bfc4f973d20f84fc3d105b07b08cf Mon Sep 17 00:00:00 2001 From: Neil South Date: Wed, 11 Oct 2023 15:03:02 +0100 Subject: [PATCH 12/18] added fromExternalApp to DataOrigin so we can send to new Que Signed-off-by: Neil South --- src/Messaging/Events/WorkflowRequestEvent.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Messaging/Events/WorkflowRequestEvent.cs b/src/Messaging/Events/WorkflowRequestEvent.cs index 27feb7b..92402df 100755 --- a/src/Messaging/Events/WorkflowRequestEvent.cs +++ b/src/Messaging/Events/WorkflowRequestEvent.cs @@ -54,6 +54,10 @@ public class DataOrigin [JsonPropertyName("destination")] public string Destination { get; set; } = default!; + [JsonProperty(PropertyName = "fromExternalApp")] + [JsonPropertyName("fromExternalApp")] + public bool FromExternalApp { get; set; } = false; + public override int GetHashCode() { return HashCode.Combine(Source, Destination, DataService); From 84d04e1ce917f06a879e38351138b6f96b0ab73f Mon Sep 17 00:00:00 2001 From: Lillie Dae Date: Wed, 11 Oct 2023 15:59:26 +0100 Subject: [PATCH 13/18] minor spelling mistake Signed-off-by: Lillie Dae --- src/Messaging/Common/ArtifactTypes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Messaging/Common/ArtifactTypes.cs b/src/Messaging/Common/ArtifactTypes.cs index 97c0908..56061d8 100644 --- a/src/Messaging/Common/ArtifactTypes.cs +++ b/src/Messaging/Common/ArtifactTypes.cs @@ -5,7 +5,7 @@ public static class ArtifactTypes private static readonly Dictionary ListOfModularity = new() { { ArtifactTypeEnum.Unset, "Unset" }, - { ArtifactTypeEnum.AR, "Autorefract (ArtifactType.ion" }, + { ArtifactTypeEnum.AR, "Autorefract" }, { ArtifactTypeEnum.ASMT, "Content Assessment Results" }, { ArtifactTypeEnum.AU, "Audio" }, { ArtifactTypeEnum.BDUS, "Bone Densitometry (ultrasound)" }, From f2415a5519b8613e169dd97e046e497930a48f26 Mon Sep 17 00:00:00 2001 From: Neil South Date: Wed, 11 Oct 2023 16:09:13 +0100 Subject: [PATCH 14/18] adding XML comments Signed-off-by: Neil South --- .../API/IMessageBrokerSubscriberService.cs | 4 ++-- .../MessageBrokerServiceConfiguration.cs | 4 ++-- src/Messaging/IServiceCollectionExtension.cs | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) mode change 100644 => 100755 src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs mode change 100644 => 100755 src/Messaging/IServiceCollectionExtension.cs diff --git a/src/Messaging/API/IMessageBrokerSubscriberService.cs b/src/Messaging/API/IMessageBrokerSubscriberService.cs index e43de1e..9d22f0e 100755 --- a/src/Messaging/API/IMessageBrokerSubscriberService.cs +++ b/src/Messaging/API/IMessageBrokerSubscriberService.cs @@ -32,7 +32,7 @@ public interface IMessageBrokerSubscriberService : IDisposable string Name { get; } /// - /// Subscribe to a message topic & queue and executes messageReceivedCallback asynchronously for every message that is received. + /// Subscribe to a message topic and queue and executes messageReceivedCallback asynchronously 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. /// @@ -43,7 +43,7 @@ public interface IMessageBrokerSubscriberService : IDisposable void SubscribeAsync(string topic, string queue, Func messageReceivedCallback, ushort prefetchCount = 0); /// - /// Subscribe to a message topic & queue and executes messageReceivedCallback asynchronously for every message that is received. + /// Subscribe to a message topic and queue and executes messageReceivedCallback asynchronously 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. /// diff --git a/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs b/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs old mode 100644 new mode 100755 index 452bcfa..49ac7a0 --- a/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs +++ b/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs @@ -25,7 +25,7 @@ public class MessageBrokerServiceConfiguration /// /// Gets or sets the a fully qualified type name of the message publisher service. - /// The spcified type must implement IMessageBrokerPublisherService interface. + /// The spcified type must implement IMessageBrokerPublisherService interface. /// The default message publisher service configured is RabbitMQ. /// [ConfigurationKeyName("publisherServiceAssemblyName")] @@ -33,7 +33,7 @@ public class MessageBrokerServiceConfiguration /// /// Gets or sets the a fully qualified type name of the message subscriber service. - /// The spcified type must implement IMessageBrokerSubscriberService interface. + /// The spcified type must implement IMessageBrokerSubscriberService interface. /// The default message subscriber service configured is RabbitMQ. /// [ConfigurationKeyName("subscriberServiceAssemblyName")] diff --git a/src/Messaging/IServiceCollectionExtension.cs b/src/Messaging/IServiceCollectionExtension.cs old mode 100644 new mode 100755 index fd7516f..0ffed7b --- a/src/Messaging/IServiceCollectionExtension.cs +++ b/src/Messaging/IServiceCollectionExtension.cs @@ -31,6 +31,10 @@ public static class IServiceCollectionExtensions /// /// Instance of . /// Fully qualified type name of the service to use. + /// bool as to if the healthcheck is be registered + /// + /// + /// /// Instance of . /// public static IServiceCollection AddMonaiDeployMessageBrokerSubscriberService( @@ -48,6 +52,10 @@ public static IServiceCollection AddMonaiDeployMessageBrokerSubscriberService( /// Instance of . /// Fully qualified type name of the service to use. /// Instance of . + /// bool as to if the healthcheck is be registered + /// + /// + /// /// Instance of . /// public static IServiceCollection AddMonaiDeployMessageBrokerSubscriberService( @@ -65,6 +73,10 @@ public static IServiceCollection AddMonaiDeployMessageBrokerSubscriberService( /// /// Instance of . /// Fully qualified type name of the service to use. + /// bool as to if the healthcheck is be registered + /// + /// + /// /// Instance of . /// public static IServiceCollection AddMonaiDeployMessageBrokerPublisherService( @@ -82,6 +94,10 @@ public static IServiceCollection AddMonaiDeployMessageBrokerPublisherService( /// Instance of . /// Fully qualified type name of the service to use. /// Instance of . + /// bool as to if the healthcheck is be registered + /// + /// + /// /// Instance of . /// public static IServiceCollection AddMonaiDeployMessageBrokerPublisherService( From 0d7ffd1444bdbb96ad7a463d0be4da4afa65bcb9 Mon Sep 17 00:00:00 2001 From: Lillie Dae Date: Wed, 11 Oct 2023 16:22:37 +0100 Subject: [PATCH 15/18] minor fix for warning Signed-off-by: Lillie Dae --- src/Messaging/Common/Artifact.cs | 2 +- .../{ArtifactTypeEnum.cs => ArtifactType.cs} | 2 +- src/Messaging/Common/ArtifactTypes.cs | 130 +++++++++--------- .../MessageBrokerServiceConfiguration.cs | 4 +- 4 files changed, 69 insertions(+), 69 deletions(-) rename src/Messaging/Common/{ArtifactTypeEnum.cs => ArtifactType.cs} (98%) diff --git a/src/Messaging/Common/Artifact.cs b/src/Messaging/Common/Artifact.cs index ead4b86..5da5d01 100755 --- a/src/Messaging/Common/Artifact.cs +++ b/src/Messaging/Common/Artifact.cs @@ -18,7 +18,7 @@ namespace Monai.Deploy.Messaging.Common { public class Artifact { - public ArtifactTypeEnum Type { get; set; } = ArtifactTypeEnum.Unset; + public ArtifactType Type { get; set; } = ArtifactType.Unset; public string Path { get; set; } = string.Empty; } } diff --git a/src/Messaging/Common/ArtifactTypeEnum.cs b/src/Messaging/Common/ArtifactType.cs similarity index 98% rename from src/Messaging/Common/ArtifactTypeEnum.cs rename to src/Messaging/Common/ArtifactType.cs index 3d25524..ca8069f 100644 --- a/src/Messaging/Common/ArtifactTypeEnum.cs +++ b/src/Messaging/Common/ArtifactType.cs @@ -16,7 +16,7 @@ namespace Monai.Deploy.Messaging.Common { - public enum ArtifactTypeEnum + public enum ArtifactType { Unset, //Unset AR, //Autorefraction diff --git a/src/Messaging/Common/ArtifactTypes.cs b/src/Messaging/Common/ArtifactTypes.cs index 56061d8..a7dc2b5 100644 --- a/src/Messaging/Common/ArtifactTypes.cs +++ b/src/Messaging/Common/ArtifactTypes.cs @@ -2,77 +2,77 @@ namespace Monai.Deploy.Messaging.Common { public static class ArtifactTypes { - private static readonly Dictionary ListOfModularity = new() + private static readonly Dictionary ListOfModularity = new() { - { ArtifactTypeEnum.Unset, "Unset" }, - { ArtifactTypeEnum.AR, "Autorefract" }, - { ArtifactTypeEnum.ASMT, "Content Assessment Results" }, - { ArtifactTypeEnum.AU, "Audio" }, - { ArtifactTypeEnum.BDUS, "Bone Densitometry (ultrasound)" }, - { ArtifactTypeEnum.BI, "Biomagnetic imaging" }, - { ArtifactTypeEnum.BMD, "Bone Densitometry (X-Ray)" }, - { ArtifactTypeEnum.CR, "Computed Radiography" }, - { ArtifactTypeEnum.CT, "Computed Tomography" }, - { ArtifactTypeEnum.DG, "Diaphanography" }, - { ArtifactTypeEnum.DOC, "Document" }, - { ArtifactTypeEnum.DX, "Digital Radiography" }, - { ArtifactTypeEnum.ECG, "Electrocardiography" }, - { ArtifactTypeEnum.EPS, "Cardiac Electrophysiology" }, - { ArtifactTypeEnum.ES, "Endoscopy" }, - { ArtifactTypeEnum.FID, "Fiducials" }, - { ArtifactTypeEnum.GM, "General Microscopy" }, - { ArtifactTypeEnum.HC, "Hard Copy" }, - { ArtifactTypeEnum.HD, "Hemodynamic Waveform" }, - { ArtifactTypeEnum.IO, "Intra-Oral Radiography" }, - { ArtifactTypeEnum.IOL, "Intraocular Lens Data" }, - { ArtifactTypeEnum.IVOCT, "Intravascular Optical Coherence Tomography" }, - { ArtifactTypeEnum.IVUS, "Intravascular Ultrasound" }, - { ArtifactTypeEnum.KER, "Keratometry" }, - { ArtifactTypeEnum.KO, "Key Object Selection" }, - { ArtifactTypeEnum.LEN, "Lensometry" }, - { ArtifactTypeEnum.LS, "Laser surface scan" }, - { ArtifactTypeEnum.MG, "Mammography" }, - { ArtifactTypeEnum.MR, "Magnetic Resonance" }, - { ArtifactTypeEnum.NM, "Nuclear Medicine" }, - { ArtifactTypeEnum.OAM, "Ophthalmic Axial Measurements" }, - { ArtifactTypeEnum.OCT, "Optical Coherence Tomography (non-Ophthalmic)" }, - { ArtifactTypeEnum.OP, "Ophthalmic Photography" }, - { ArtifactTypeEnum.OPM, "Ophthalmic Mapping" }, - { ArtifactTypeEnum.OPT, "Ophthalmic Tomography" }, - { ArtifactTypeEnum.OPV, "Ophthalmic Visual Field" }, - { ArtifactTypeEnum.OSS, "Optical Surface Scan" }, - { ArtifactTypeEnum.OT, "Other" }, - { ArtifactTypeEnum.PLAN, "Plan" }, - { ArtifactTypeEnum.PR, "Presentation State" }, - { ArtifactTypeEnum.PT, "Positron emission tomography (PET)" }, - { ArtifactTypeEnum.PX, "Panoramic X-Ray" }, - { ArtifactTypeEnum.REG, "Registration" }, - { ArtifactTypeEnum.RESP, "Respiratory Waveform" }, - { ArtifactTypeEnum.RF, "Radio Fluoroscopy" }, - { ArtifactTypeEnum.RG, "Radiographic imaging (conventional film/screen)" }, - { ArtifactTypeEnum.RTDOSE, "Radiotherapy Dose" }, - { ArtifactTypeEnum.RTIMAGE, "Radiotherapy Image" }, - { ArtifactTypeEnum.RTPLAN, "Radiotherapy Plan" }, - { ArtifactTypeEnum.RTRECORD, "RT Treatment Record" }, - { ArtifactTypeEnum.RTSTRUCT, "Radiotherapy Structure Set" }, - { ArtifactTypeEnum.RWV, "Real World Value Map" }, - { ArtifactTypeEnum.SEG, "Segmentation" }, - { ArtifactTypeEnum.SM, "Slide Microscopy" }, - { ArtifactTypeEnum.SMR, "Stereometric Relationship" }, - { ArtifactTypeEnum.SR, "SR Document" }, - { ArtifactTypeEnum.SRF, "Subjective Refraction" }, - { ArtifactTypeEnum.STAIN, "Automated Slide Stainer" }, - { ArtifactTypeEnum.TG, "Thermography" }, - { ArtifactTypeEnum.US, "Ultrasound" }, - { ArtifactTypeEnum.VA, "Visual Acuity" }, - { ArtifactTypeEnum.XA, "X-Ray Angiography" }, - { ArtifactTypeEnum.XC, "External-camera Photography" }, + { ArtifactType.Unset, "Unset" }, + { ArtifactType.AR, "Autorefract" }, + { ArtifactType.ASMT, "Content Assessment Results" }, + { ArtifactType.AU, "Audio" }, + { ArtifactType.BDUS, "Bone Densitometry (ultrasound)" }, + { ArtifactType.BI, "Biomagnetic imaging" }, + { ArtifactType.BMD, "Bone Densitometry (X-Ray)" }, + { ArtifactType.CR, "Computed Radiography" }, + { ArtifactType.CT, "Computed Tomography" }, + { ArtifactType.DG, "Diaphanography" }, + { ArtifactType.DOC, "Document" }, + { ArtifactType.DX, "Digital Radiography" }, + { ArtifactType.ECG, "Electrocardiography" }, + { ArtifactType.EPS, "Cardiac Electrophysiology" }, + { ArtifactType.ES, "Endoscopy" }, + { ArtifactType.FID, "Fiducials" }, + { ArtifactType.GM, "General Microscopy" }, + { ArtifactType.HC, "Hard Copy" }, + { ArtifactType.HD, "Hemodynamic Waveform" }, + { ArtifactType.IO, "Intra-Oral Radiography" }, + { ArtifactType.IOL, "Intraocular Lens Data" }, + { ArtifactType.IVOCT, "Intravascular Optical Coherence Tomography" }, + { ArtifactType.IVUS, "Intravascular Ultrasound" }, + { ArtifactType.KER, "Keratometry" }, + { ArtifactType.KO, "Key Object Selection" }, + { ArtifactType.LEN, "Lensometry" }, + { ArtifactType.LS, "Laser surface scan" }, + { ArtifactType.MG, "Mammography" }, + { ArtifactType.MR, "Magnetic Resonance" }, + { ArtifactType.NM, "Nuclear Medicine" }, + { ArtifactType.OAM, "Ophthalmic Axial Measurements" }, + { ArtifactType.OCT, "Optical Coherence Tomography (non-Ophthalmic)" }, + { ArtifactType.OP, "Ophthalmic Photography" }, + { ArtifactType.OPM, "Ophthalmic Mapping" }, + { ArtifactType.OPT, "Ophthalmic Tomography" }, + { ArtifactType.OPV, "Ophthalmic Visual Field" }, + { ArtifactType.OSS, "Optical Surface Scan" }, + { ArtifactType.OT, "Other" }, + { ArtifactType.PLAN, "Plan" }, + { ArtifactType.PR, "Presentation State" }, + { ArtifactType.PT, "Positron emission tomography (PET)" }, + { ArtifactType.PX, "Panoramic X-Ray" }, + { ArtifactType.REG, "Registration" }, + { ArtifactType.RESP, "Respiratory Waveform" }, + { ArtifactType.RF, "Radio Fluoroscopy" }, + { ArtifactType.RG, "Radiographic imaging (conventional film/screen)" }, + { ArtifactType.RTDOSE, "Radiotherapy Dose" }, + { ArtifactType.RTIMAGE, "Radiotherapy Image" }, + { ArtifactType.RTPLAN, "Radiotherapy Plan" }, + { ArtifactType.RTRECORD, "RT Treatment Record" }, + { ArtifactType.RTSTRUCT, "Radiotherapy Structure Set" }, + { ArtifactType.RWV, "Real World Value Map" }, + { ArtifactType.SEG, "Segmentation" }, + { ArtifactType.SM, "Slide Microscopy" }, + { ArtifactType.SMR, "Stereometric Relationship" }, + { ArtifactType.SR, "SR Document" }, + { ArtifactType.SRF, "Subjective Refraction" }, + { ArtifactType.STAIN, "Automated Slide Stainer" }, + { ArtifactType.TG, "Thermography" }, + { ArtifactType.US, "Ultrasound" }, + { ArtifactType.VA, "Visual Acuity" }, + { ArtifactType.XA, "X-Ray Angiography" }, + { ArtifactType.XC, "External-camera Photography" }, }; public static bool Validate(string artifactType) { return ListOfModularity.Any(x => - Enum.TryParse(artifactType, out var artifact) + Enum.TryParse(artifactType, out var artifact) && x.Key == artifact); } } diff --git a/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs b/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs index 49ac7a0..3a839f2 100755 --- a/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs +++ b/src/Messaging/Configuration/MessageBrokerServiceConfiguration.cs @@ -25,7 +25,7 @@ public class MessageBrokerServiceConfiguration /// /// Gets or sets the a fully qualified type name of the message publisher service. - /// The spcified type must implement IMessageBrokerPublisherService interface. + /// The spcified type must implement IMessageBrokerPublisherService interface. /// The default message publisher service configured is RabbitMQ. /// [ConfigurationKeyName("publisherServiceAssemblyName")] @@ -33,7 +33,7 @@ public class MessageBrokerServiceConfiguration /// /// Gets or sets the a fully qualified type name of the message subscriber service. - /// The spcified type must implement IMessageBrokerSubscriberService interface. + /// The spcified type must implement IMessageBrokerSubscriberService interface. /// The default message subscriber service configured is RabbitMQ. /// [ConfigurationKeyName("subscriberServiceAssemblyName")] From e5f74748feecbd33e747c39b501e899f0d760a4e Mon Sep 17 00:00:00 2001 From: Neil South Date: Wed, 11 Oct 2023 16:27:30 +0100 Subject: [PATCH 16/18] more xml comment fix ups Signed-off-by: Neil South --- src/Plugins/RabbitMQ/Factory/IRabbitMQConnectionFactory.cs | 1 + .../RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Plugins/RabbitMQ/Factory/IRabbitMQConnectionFactory.cs b/src/Plugins/RabbitMQ/Factory/IRabbitMQConnectionFactory.cs index f8b46f6..4ddf43c 100755 --- a/src/Plugins/RabbitMQ/Factory/IRabbitMQConnectionFactory.cs +++ b/src/Plugins/RabbitMQ/Factory/IRabbitMQConnectionFactory.cs @@ -25,6 +25,7 @@ public interface IRabbitMQConnectionFactory /// The connection factory maintains a single connection to the specified /// hostName, username, password, and virtualHost combination. /// + /// channel type, pub or sub /// Host name /// User name /// Password diff --git a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs index 5155850..64d8767 100755 --- a/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs +++ b/src/Plugins/RabbitMQ/Subscriber/RabbitMqMessageSubscriberService.cs @@ -390,7 +390,7 @@ private static MessageReceivedEventArgs CreateMessage(string topic, BasicDeliver } catch (OperationInterruptedException operationInterruptedException) { - ///RabbitMQ node that hosts the previously created dead-letter queue is unavailable + // RabbitMQ node that hosts the previously created dead-letter queue is unavailable if (operationInterruptedException.Message.Contains("down or inaccessible")) { _logger.DetectedInaccessibleNodeThatHousesDeadLetterQueue(queueName); From e580005e9262187f83ab31ff484977c938a5825a Mon Sep 17 00:00:00 2001 From: Neil South Date: Wed, 11 Oct 2023 16:38:33 +0100 Subject: [PATCH 17/18] added missing licence headers Signed-off-by: Neil South --- src/Messaging/Common/ArtifactTypes.cs | 16 ++++++++++++++++ .../Tests/Common/ArtifactTypesTests.cs | 16 ++++++++++++++++ src/Monai.Deploy.Messaging.sln.DotSettings | 18 +++++++++++++++++- 3 files changed, 49 insertions(+), 1 deletion(-) mode change 100644 => 100755 src/Messaging/Common/ArtifactTypes.cs mode change 100644 => 100755 src/Messaging/Tests/Common/ArtifactTypesTests.cs mode change 100644 => 100755 src/Monai.Deploy.Messaging.sln.DotSettings diff --git a/src/Messaging/Common/ArtifactTypes.cs b/src/Messaging/Common/ArtifactTypes.cs old mode 100644 new mode 100755 index a7dc2b5..d708486 --- a/src/Messaging/Common/ArtifactTypes.cs +++ b/src/Messaging/Common/ArtifactTypes.cs @@ -1,3 +1,19 @@ +/* + * Copyright 2022-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. + */ + namespace Monai.Deploy.Messaging.Common { public static class ArtifactTypes diff --git a/src/Messaging/Tests/Common/ArtifactTypesTests.cs b/src/Messaging/Tests/Common/ArtifactTypesTests.cs old mode 100644 new mode 100755 index dbfe112..9f31b72 --- a/src/Messaging/Tests/Common/ArtifactTypesTests.cs +++ b/src/Messaging/Tests/Common/ArtifactTypesTests.cs @@ -1,3 +1,19 @@ +/* + * Copyright 2022-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 Monai.Deploy.Messaging.Common; using Xunit; diff --git a/src/Monai.Deploy.Messaging.sln.DotSettings b/src/Monai.Deploy.Messaging.sln.DotSettings old mode 100644 new mode 100755 index baf33b3..536629b --- a/src/Monai.Deploy.Messaging.sln.DotSettings +++ b/src/Monai.Deploy.Messaging.sln.DotSettings @@ -1,4 +1,20 @@ - + + + + AR AS ASMT From 9a839cd30bef523df93be1fddd6b8a0fad2da5c7 Mon Sep 17 00:00:00 2001 From: Neil South <104848880+neildsouth@users.noreply.github.com> Date: Wed, 11 Oct 2023 17:18:12 +0100 Subject: [PATCH 18/18] Update IServiceCollectionExtensionsTests.cs Signed-off-by: Neil South <104848880+neildsouth@users.noreply.github.com> --- src/Messaging/Tests/IServiceCollectionExtensionsTests.cs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs b/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs index c9137fe..fc1126d 100644 --- a/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs +++ b/src/Messaging/Tests/IServiceCollectionExtensionsTests.cs @@ -207,10 +207,6 @@ internal class GoodSubscriberService : IMessageBrokerSubscriberService // event used by users of this library public event ConnectionErrorHandler? OnConnectionError; -#pragma warning restore CS0067 // The event 'GoodSubscriberService.OnConnectionError' is never used - -#pragma warning restore CS0067 // The event 'GoodSubscriberService.OnConnectionError' is never used - #pragma warning restore CS0067 // The event 'GoodSubscriberService.OnConnectionError' is never used public void Acknowledge(MessageBase message) => throw new NotImplementedException();