From d6cad01cd0a7e1d8d34f931b872deb13b8f0eb4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Stenr=C3=B8jl?=
<51327761+dstenroejl@users.noreply.github.com>
Date: Fri, 27 Dec 2024 12:47:42 +0100
Subject: [PATCH] feat: Auto register handlers (#57)
* IOrchestrationDescriptionBuilder
* Start/schedule handlers
* Namespace
* Fix naming and design
* TODO's
* Interface for query handler
* Refactor example
* Avoid changning NuGet packages
---
...duleOrchestrationInstanceCommandHandler.cs | 34 +++++++++
...earchOrchestrationInstancesQueryHandler.cs | 34 +++++++++
...tartOrchestrationInstanceCommandHandler.cs | 35 +++++++++
...strationInstanceFromMessageHandlerBase.cs} | 10 +--
.../ProcessManager.Core.csproj | 5 ++
.../InputExample/SearchInputExampleHandler.cs | 6 +-
.../SearchTrigger_Brs_X01_InputExample.cs | 3 +-
...ScheduleTrigger_Brs_X01_InputExample_V1.cs | 4 +-
.../V1/StartInputExampleHandlerV1.cs | 13 ++--
.../StartTrigger_Brs_X01_InputExample_V1.cs | 4 +-
.../RequestCalculatedEnergyTimeSeriesTests.cs | 3 +-
...cs => StartForwardMeteredDataHandlerV1.cs} | 14 ++--
.../V1/StartForwardMeteredDataTriggerV1.cs | 75 -------------------
...rtTrigger_Brs_021_ForwardMeteredData_V1.cs | 46 ++++++++++++
.../BRS_023_027/SearchCalculationHandler.cs | 6 +-
.../BRS_023_027/SearchTrigger_Brs_023_027.cs | 5 +-
.../V1/ScheduleTrigger_Brs_023_027_V1.cs | 4 +-
.../V1/StartCalculationHandlerV1.cs | 13 ++--
.../V1/StartTrigger_Brs_023_027_V1.cs | 4 +-
.../EnqueueMessagesActivity_Brs_026_V1.cs | 2 +-
...EnqueueRejectMessageActivity_Brs_026_V1.cs | 2 +-
...rformAsyncValidationActivity_Brs_026_V1.cs | 2 +-
.../V1/OrchestrationDescriptionBuilder.cs | 2 +-
...ries_V1.cs => Orchestration_Brs_026_V1.cs} | 8 +-
...uestCalculatedEnergyTimeSeriesHandlerV1.cs | 7 +-
...eries_V1.cs => StartTrigger_Brs_026_V1.cs} | 15 ++--
.../ProcessManager.Orchestrations/Program.cs | 2 +-
27 files changed, 224 insertions(+), 134 deletions(-)
create mode 100644 source/ProcessManager.Core/Application/Api/Handlers/IScheduleOrchestrationInstanceCommandHandler.cs
create mode 100644 source/ProcessManager.Core/Application/Api/Handlers/ISearchOrchestrationInstancesQueryHandler.cs
create mode 100644 source/ProcessManager.Core/Application/Api/Handlers/IStartOrchestrationInstanceCommandHandler.cs
rename source/{ProcessManager.Orchestrations/Shared/StartOrchestrationFromMessageHandlerBase.cs => ProcessManager.Core/Application/Api/Handlers/StartOrchestrationInstanceFromMessageHandlerBase.cs} (88%)
rename source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/{StartForwardMeteredDataHandler.cs => StartForwardMeteredDataHandlerV1.cs} (73%)
delete mode 100644 source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataTriggerV1.cs
create mode 100644 source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartTrigger_Brs_021_ForwardMeteredData_V1.cs
rename source/ProcessManager.Orchestrations/Processes/BRS_026/V1/{Orchestration_RequestCalculatedEnergyTimeSeries_V1.cs => Orchestration_Brs_026_V1.cs} (96%)
rename source/ProcessManager.Orchestrations/Processes/BRS_026/V1/{StartTrigger_RequestCalculatedEnergyTimeSeries_V1.cs => StartTrigger_Brs_026_V1.cs} (73%)
diff --git a/source/ProcessManager.Core/Application/Api/Handlers/IScheduleOrchestrationInstanceCommandHandler.cs b/source/ProcessManager.Core/Application/Api/Handlers/IScheduleOrchestrationInstanceCommandHandler.cs
new file mode 100644
index 00000000..6e1257bd
--- /dev/null
+++ b/source/ProcessManager.Core/Application/Api/Handlers/IScheduleOrchestrationInstanceCommandHandler.cs
@@ -0,0 +1,34 @@
+// Copyright 2020 Energinet DataHub A/S
+//
+// Licensed under the Apache License, Version 2.0 (the "License2");
+// 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 Energinet.DataHub.ProcessManager.Abstractions.Api.Model;
+
+namespace Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
+
+///
+/// Interface for handling a command for scheduling an orchestration instance with an input parameter.
+///
+/// The type of the command.
+/// The type of the input parameter DTO.
+public interface IScheduleOrchestrationInstanceCommandHandler
+ where TCommand : ScheduleOrchestrationInstanceCommand
+ where TInputParameterDto : IInputParameterDto
+{
+ ///
+ /// Handles a command for scheduling an orchestration instance.
+ ///
+ /// The command to handle.
+ /// The ID of the orchestration instance.
+ Task HandleAsync(TCommand command);
+}
diff --git a/source/ProcessManager.Core/Application/Api/Handlers/ISearchOrchestrationInstancesQueryHandler.cs b/source/ProcessManager.Core/Application/Api/Handlers/ISearchOrchestrationInstancesQueryHandler.cs
new file mode 100644
index 00000000..f18d0326
--- /dev/null
+++ b/source/ProcessManager.Core/Application/Api/Handlers/ISearchOrchestrationInstancesQueryHandler.cs
@@ -0,0 +1,34 @@
+// Copyright 2020 Energinet DataHub A/S
+//
+// Licensed under the Apache License, Version 2.0 (the "License2");
+// 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 Energinet.DataHub.ProcessManager.Abstractions.Api.Model;
+
+namespace Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
+
+///
+/// Interface for handling a query for searching orchestration instances.
+///
+/// The type of the query.
+/// The result type of each item returned in the result list from the query. Must be a JSON serializable type.
+public interface ISearchOrchestrationInstancesQueryHandler
+ where TQuery : SearchOrchestrationInstancesByCustomQuery
+ where TResultItem : class
+{
+ ///
+ /// Handles a query for searching orchestration instances.
+ ///
+ /// The query to handle.
+ /// Returns a result item for each matching orchestration instance.
+ Task> HandleAsync(TQuery query);
+}
diff --git a/source/ProcessManager.Core/Application/Api/Handlers/IStartOrchestrationInstanceCommandHandler.cs b/source/ProcessManager.Core/Application/Api/Handlers/IStartOrchestrationInstanceCommandHandler.cs
new file mode 100644
index 00000000..95ce7a4e
--- /dev/null
+++ b/source/ProcessManager.Core/Application/Api/Handlers/IStartOrchestrationInstanceCommandHandler.cs
@@ -0,0 +1,35 @@
+// Copyright 2020 Energinet DataHub A/S
+//
+// Licensed under the Apache License, Version 2.0 (the "License2");
+// 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 Energinet.DataHub.ProcessManager.Abstractions.Api.Model;
+using Energinet.DataHub.ProcessManager.Abstractions.Api.Model.OrchestrationInstance;
+
+namespace Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
+
+///
+/// Interface for handling a command for starting an orchestration instance with an input parameter.
+///
+/// The type of the command.
+/// The type of the input parameter DTO.
+public interface IStartOrchestrationInstanceCommandHandler
+ where TCommand : StartOrchestrationInstanceCommand
+ where TInputParameterDto : IInputParameterDto
+{
+ ///
+ /// Handles a command for starting an orchestration instance.
+ ///
+ /// The command to handle.
+ /// The ID of the orchestration instance.
+ Task HandleAsync(TCommand command);
+}
diff --git a/source/ProcessManager.Orchestrations/Shared/StartOrchestrationFromMessageHandlerBase.cs b/source/ProcessManager.Core/Application/Api/Handlers/StartOrchestrationInstanceFromMessageHandlerBase.cs
similarity index 88%
rename from source/ProcessManager.Orchestrations/Shared/StartOrchestrationFromMessageHandlerBase.cs
rename to source/ProcessManager.Core/Application/Api/Handlers/StartOrchestrationInstanceFromMessageHandlerBase.cs
index 8a3b6c9f..0f3b2c72 100644
--- a/source/ProcessManager.Orchestrations/Shared/StartOrchestrationFromMessageHandlerBase.cs
+++ b/source/ProcessManager.Core/Application/Api/Handlers/StartOrchestrationInstanceFromMessageHandlerBase.cs
@@ -19,15 +19,15 @@
using Energinet.DataHub.ProcessManager.Abstractions.Contracts;
using Microsoft.Extensions.Logging;
-namespace Energinet.DataHub.ProcessManager.Orchestrations.Shared;
+namespace Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
-public abstract class StartOrchestrationFromMessageHandlerBase(
+public abstract class StartOrchestrationInstanceFromMessageHandlerBase(
ILogger logger)
where TInputParameterDto : IInputParameterDto
{
private readonly ILogger _logger = logger;
- public Task StartOrchestration(ServiceBusReceivedMessage message)
+ public Task HandleAsync(ServiceBusReceivedMessage message)
{
using var serviceBusMessageLoggerScope = _logger.BeginScope(new
{
@@ -70,10 +70,10 @@ public Task StartOrchestration(ServiceBusReceivedMessage message)
message: $"Unable to parse {nameof(startOrchestrationDto.StartedByActorId)} to guid");
}
- return StartOrchestration(
+ return StartOrchestrationInstanceAsync(
new ActorIdentity(new ActorId(actorId)),
inputParameterDto);
}
- protected abstract Task StartOrchestration(ActorIdentity actorIdentity, TInputParameterDto input);
+ protected abstract Task StartOrchestrationInstanceAsync(ActorIdentity actorIdentity, TInputParameterDto input);
}
diff --git a/source/ProcessManager.Core/ProcessManager.Core.csproj b/source/ProcessManager.Core/ProcessManager.Core.csproj
index c7d4d72c..13fda21f 100644
--- a/source/ProcessManager.Core/ProcessManager.Core.csproj
+++ b/source/ProcessManager.Core/ProcessManager.Core.csproj
@@ -11,6 +11,7 @@
+
@@ -23,4 +24,8 @@
+
+
+
+
diff --git a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchInputExampleHandler.cs b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchInputExampleHandler.cs
index ad8e4f00..1de774e6 100644
--- a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchInputExampleHandler.cs
+++ b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchInputExampleHandler.cs
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+using Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
using Energinet.DataHub.ProcessManagement.Core.Application.Orchestration;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationInstance;
using Energinet.DataHub.ProcessManager.Api.Mappers;
@@ -22,11 +23,12 @@
namespace Energinet.DataHub.ProcessManager.Example.Orchestrations.Processes.BRS_X01.InputExample;
internal class SearchInputExampleHandler(
- IOrchestrationInstanceQueries queries)
+ IOrchestrationInstanceQueries queries) :
+ ISearchOrchestrationInstancesQueryHandler
{
private readonly IOrchestrationInstanceQueries _queries = queries;
- public async Task> SearchAsync(InputExampleQuery query)
+ public async Task> HandleAsync(InputExampleQuery query)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
diff --git a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchTrigger_Brs_X01_InputExample.cs b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchTrigger_Brs_X01_InputExample.cs
index a2e1e5e4..09159488 100644
--- a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchTrigger_Brs_X01_InputExample.cs
+++ b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/SearchTrigger_Brs_X01_InputExample.cs
@@ -39,8 +39,7 @@ public async Task Run(
InputExampleQuery query,
FunctionContext executionContext)
{
- var queryResultItems = await _handler.SearchAsync(query).ConfigureAwait(false);
-
+ var queryResultItems = await _handler.HandleAsync(query).ConfigureAwait(false);
return new OkObjectResult(queryResultItems);
}
}
diff --git a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/ScheduleTrigger_Brs_X01_InputExample_V1.cs b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/ScheduleTrigger_Brs_X01_InputExample_V1.cs
index c39c4fde..7ad23b4d 100644
--- a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/ScheduleTrigger_Brs_X01_InputExample_V1.cs
+++ b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/ScheduleTrigger_Brs_X01_InputExample_V1.cs
@@ -39,7 +39,7 @@ public async Task Run(
ScheduleInputExampleCommandV1 command,
FunctionContext executionContext)
{
- var orchestrationInstanceId = await _handler.ScheduleNewExampleAsync(command).ConfigureAwait(false);
- return new OkObjectResult(orchestrationInstanceId.Value);
+ var orchestrationInstanceId = await _handler.HandleAsync(command).ConfigureAwait(false);
+ return new OkObjectResult(orchestrationInstanceId);
}
}
diff --git a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartInputExampleHandlerV1.cs b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartInputExampleHandlerV1.cs
index c0808073..d0890eb2 100644
--- a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartInputExampleHandlerV1.cs
+++ b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartInputExampleHandlerV1.cs
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+using Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
using Energinet.DataHub.ProcessManagement.Core.Application.Orchestration;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationDescription;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationInstance;
@@ -21,11 +22,13 @@
namespace Energinet.DataHub.ProcessManager.Example.Orchestrations.Processes.BRS_X01.InputExample.V1;
internal class StartInputExampleHandlerV1(
- IStartOrchestrationInstanceCommands manager)
+ IStartOrchestrationInstanceCommands manager) :
+ IStartOrchestrationInstanceCommandHandler,
+ IScheduleOrchestrationInstanceCommandHandler
{
private readonly IStartOrchestrationInstanceCommands _manager = manager;
- public async Task StartNewExampleAsync(StartInputExampleCommandV1 command)
+ public async Task HandleAsync(StartInputExampleCommandV1 command)
{
// Here we show how its possible, based on input, to decide certain steps should be skipped by the orchestration.
IReadOnlyCollection skipStepsBySequence = command.InputParameter.ShouldSkipSkippableStep
@@ -44,10 +47,10 @@ public async Task StartNewExampleAsync(StartInputExampl
skipStepsBySequence: skipStepsBySequence)
.ConfigureAwait(false);
- return orchestrationInstanceId;
+ return orchestrationInstanceId.Value;
}
- public async Task ScheduleNewExampleAsync(ScheduleInputExampleCommandV1 command)
+ public async Task HandleAsync(ScheduleInputExampleCommandV1 command)
{
// Here we show how its possible, based on input, to decide certain steps should be skipped by the orchestration.
IReadOnlyCollection skipStepsBySequence = command.InputParameter.ShouldSkipSkippableStep
@@ -67,6 +70,6 @@ public async Task ScheduleNewExampleAsync(ScheduleInput
skipStepsBySequence: skipStepsBySequence)
.ConfigureAwait(false);
- return orchestrationInstanceId;
+ return orchestrationInstanceId.Value;
}
}
diff --git a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartTrigger_Brs_X01_InputExample_V1.cs b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartTrigger_Brs_X01_InputExample_V1.cs
index 0daa0976..626f3c65 100644
--- a/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartTrigger_Brs_X01_InputExample_V1.cs
+++ b/source/ProcessManager.Example.Orchestrations/Processes/BRS_X01/InputExample/V1/StartTrigger_Brs_X01_InputExample_V1.cs
@@ -39,7 +39,7 @@ public async Task Run(
StartInputExampleCommandV1 command,
FunctionContext executionContext)
{
- var orchestrationInstanceId = await _handler.StartNewExampleAsync(command).ConfigureAwait(false);
- return new OkObjectResult(orchestrationInstanceId.Value);
+ var orchestrationInstanceId = await _handler.HandleAsync(command).ConfigureAwait(false);
+ return new OkObjectResult(orchestrationInstanceId);
}
}
diff --git a/source/ProcessManager.Orchestrations.Tests/Integration/Processes/BRS_026_028/V1/RequestCalculatedEnergyTimeSeriesTests.cs b/source/ProcessManager.Orchestrations.Tests/Integration/Processes/BRS_026_028/V1/RequestCalculatedEnergyTimeSeriesTests.cs
index aed1168f..2213b18f 100644
--- a/source/ProcessManager.Orchestrations.Tests/Integration/Processes/BRS_026_028/V1/RequestCalculatedEnergyTimeSeriesTests.cs
+++ b/source/ProcessManager.Orchestrations.Tests/Integration/Processes/BRS_026_028/V1/RequestCalculatedEnergyTimeSeriesTests.cs
@@ -18,6 +18,7 @@
using Energinet.DataHub.ProcessManager.Client.Extensions.DependencyInjection;
using Energinet.DataHub.ProcessManager.Client.Extensions.Options;
using Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_026.V1.Model;
+using Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_026.V1;
using Energinet.DataHub.ProcessManager.Orchestrations.Tests.Fixtures;
using Energinet.DataHub.ProcessManager.Orchestrations.Tests.Fixtures.Extensions;
using FluentAssertions;
@@ -107,7 +108,7 @@ public async Task RequestCalculatedEnergyTimeSeries_WhenStarted_OrchestrationCom
// Assert
var orchestration = await _fixture.DurableClient.WaitForOrchestationStartedAsync(
createdTimeFrom: orchestrationCreatedAfter,
- name: "Orchestration_RequestCalculatedEnergyTimeSeries_V1");
+ name: nameof(Orchestration_Brs_026_V1));
orchestration.Input.ToString().Should().Contain(businessReason);
var completedOrchestration = await _fixture.DurableClient.WaitForOrchestrationCompletedAsync(
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataHandler.cs b/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataHandlerV1.cs
similarity index 73%
rename from source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataHandler.cs
rename to source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataHandlerV1.cs
index 09a6b1b9..18bb29d5 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataHandler.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataHandlerV1.cs
@@ -12,26 +12,28 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+using Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
using Energinet.DataHub.ProcessManagement.Core.Application.Orchestration;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationDescription;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationInstance;
using Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_021.ForwardMeteredData.V1.Model;
+using Microsoft.Extensions.Logging;
namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_021.ForwardMeteredData.V1;
-public class StartForwardMeteredDataHandler(IStartOrchestrationInstanceCommands commands)
+public class StartForwardMeteredDataHandlerV1(
+ ILogger logger,
+ IStartOrchestrationInstanceCommands commands)
+ : StartOrchestrationInstanceFromMessageHandlerBase(logger)
{
private readonly IStartOrchestrationInstanceCommands _commands = commands;
- ///
- /// Start forward metered data.
- ///
- public async Task StartForwardMeteredDataAsync(MeteredDataForMeasurementPointMessageInputV1 input)
+ protected override async Task StartOrchestrationInstanceAsync(ActorIdentity actorIdentity, MeteredDataForMeasurementPointMessageInputV1 input)
{
var orchestrationDescriptionUniqueName = new Brs_021_ForwardedMeteredData_V1();
await _commands.StartNewOrchestrationInstanceAsync(
- identity: new ActorIdentity(new ActorId(input.AuthenticatedActorId)),
+ identity: actorIdentity,
uniqueName: new OrchestrationDescriptionUniqueName(
orchestrationDescriptionUniqueName.Name,
orchestrationDescriptionUniqueName.Version),
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataTriggerV1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataTriggerV1.cs
deleted file mode 100644
index 45322394..00000000
--- a/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartForwardMeteredDataTriggerV1.cs
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright 2020 Energinet DataHub A/S
-//
-// Licensed under the Apache License, Version 2.0 (the "License2");
-// 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.Text.Json;
-using Azure.Messaging.ServiceBus;
-using Energinet.DataHub.Core.Messaging.Communication.Extensions.Options;
-using Energinet.DataHub.ProcessManager.Abstractions.Contracts;
-using Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_021.ForwardMeteredData.V1.Model;
-using Energinet.DataHub.ProcessManager.Orchestrations.Extensions.Options;
-using Microsoft.Azure.Functions.Worker;
-using Microsoft.Extensions.Logging;
-
-namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_021.ForwardMeteredData.V1;
-
-public class StartForwardMeteredDataTriggerV1(
- ILogger logger,
- StartForwardMeteredDataHandler handler)
-{
- private readonly ILogger _logger = logger;
- private readonly StartForwardMeteredDataHandler _handler = handler;
-
- ///
- /// Start a BRS-021 ForwardMeteredData.
- ///
- [Function(nameof(StartForwardMeteredDataTriggerV1))]
- public async Task Run(
- [ServiceBusTrigger(
- $"%{ProcessManagerTopicOptions.SectionName}:{nameof(ProcessManagerTopicOptions.TopicName)}%",
- $"%{ProcessManagerTopicOptions.SectionName}:{nameof(ProcessManagerTopicOptions.Brs021ForwardMeteredDataSubscriptionName)}%",
- Connection = ServiceBusNamespaceOptions.SectionName)]
- ServiceBusReceivedMessage message)
- {
- using var serviceBusMessageLoggerScope = _logger.BeginScope(new
- {
- ServiceBusMessage = new
- {
- message.MessageId,
- message.CorrelationId,
- message.Subject,
- },
- });
-
- var jsonMessage = message.Body.ToString();
- var startOrchestrationDto = StartOrchestrationDto.Parser.ParseJson(jsonMessage);
- using var startOrchestrationLoggerScope = _logger.BeginScope(new
- {
- StartOrchestration = new
- {
- startOrchestrationDto.OrchestrationName,
- startOrchestrationDto.OrchestrationVersion,
- },
- });
-
- var meteredDataForMeasurementPointMessageInput = JsonSerializer.Deserialize(startOrchestrationDto.JsonInput);
- if (meteredDataForMeasurementPointMessageInput is null)
- {
- _logger.LogWarning($"Unable to deserialize {nameof(startOrchestrationDto.JsonInput)} to {nameof(MeteredDataForMeasurementPointMessageInputV1)} type:{Environment.NewLine}{0}", startOrchestrationDto.JsonInput);
- throw new ArgumentException($"Unable to deserialize {nameof(startOrchestrationDto.JsonInput)} to {nameof(MeteredDataForMeasurementPointMessageInputV1)} type");
- }
-
- await _handler.StartForwardMeteredDataAsync(meteredDataForMeasurementPointMessageInput)
- .ConfigureAwait(false);
- }
-}
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartTrigger_Brs_021_ForwardMeteredData_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartTrigger_Brs_021_ForwardMeteredData_V1.cs
new file mode 100644
index 00000000..c187f079
--- /dev/null
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_021/ForwardMeteredData/V1/StartTrigger_Brs_021_ForwardMeteredData_V1.cs
@@ -0,0 +1,46 @@
+// Copyright 2020 Energinet DataHub A/S
+//
+// Licensed under the Apache License, Version 2.0 (the "License2");
+// 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 Azure.Messaging.ServiceBus;
+using Energinet.DataHub.Core.Messaging.Communication.Extensions.Options;
+using Energinet.DataHub.ProcessManager.Orchestrations.Extensions.Options;
+using Microsoft.Azure.Functions.Worker;
+
+namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_021.ForwardMeteredData.V1;
+
+// TODO: We have decided to route on the "name" part of the "orchestration description unique name",
+// meaning not including the "version" part; this will minimize how often we need to adjust infrastructure
+// with regards to "subscriptions". Hence this trigger should not be located within the "V1".
+// Also we need a generic way to first parse the "version" of a command and then direct the message to
+// the correct "version handler."
+public class StartTrigger_Brs_021_ForwardMeteredData_V1(
+ StartForwardMeteredDataHandlerV1 handler)
+{
+ private readonly StartForwardMeteredDataHandlerV1 _handler = handler;
+
+ ///
+ /// Start a BRS-021 ForwardMeteredData.
+ ///
+ [Function(nameof(StartTrigger_Brs_021_ForwardMeteredData_V1))]
+ public async Task Run(
+ [ServiceBusTrigger(
+ $"%{ProcessManagerTopicOptions.SectionName}:{nameof(ProcessManagerTopicOptions.TopicName)}%",
+ $"%{ProcessManagerTopicOptions.SectionName}:{nameof(ProcessManagerTopicOptions.Brs021ForwardMeteredDataSubscriptionName)}%",
+ Connection = ServiceBusNamespaceOptions.SectionName)]
+ ServiceBusReceivedMessage message)
+ {
+ await _handler.HandleAsync(message)
+ .ConfigureAwait(false);
+ }
+}
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchCalculationHandler.cs b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchCalculationHandler.cs
index 0874b5a5..83989807 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchCalculationHandler.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchCalculationHandler.cs
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+using Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
using Energinet.DataHub.ProcessManagement.Core.Application.Orchestration;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationInstance;
using Energinet.DataHub.ProcessManager.Api.Mappers;
@@ -22,11 +23,12 @@
namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_023_027;
internal class SearchCalculationHandler(
- IOrchestrationInstanceQueries queries)
+ IOrchestrationInstanceQueries queries) :
+ ISearchOrchestrationInstancesQueryHandler
{
private readonly IOrchestrationInstanceQueries _queries = queries;
- public async Task> SearchAsync(CalculationQuery query)
+ public async Task> HandleAsync(CalculationQuery query)
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchTrigger_Brs_023_027.cs b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchTrigger_Brs_023_027.cs
index 28de22f3..2ede7027 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchTrigger_Brs_023_027.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/SearchTrigger_Brs_023_027.cs
@@ -39,8 +39,7 @@ public async Task Run(
CalculationQuery query,
FunctionContext executionContext)
{
- var queryReultItems = await _handler.SearchAsync(query).ConfigureAwait(false);
-
- return new OkObjectResult(queryReultItems);
+ var queryResultItems = await _handler.HandleAsync(query).ConfigureAwait(false);
+ return new OkObjectResult(queryResultItems);
}
}
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/ScheduleTrigger_Brs_023_027_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/ScheduleTrigger_Brs_023_027_V1.cs
index 7e3124e9..21551a7b 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/ScheduleTrigger_Brs_023_027_V1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/ScheduleTrigger_Brs_023_027_V1.cs
@@ -39,7 +39,7 @@ public async Task Run(
ScheduleCalculationCommandV1 command,
FunctionContext executionContext)
{
- var orchestrationInstanceId = await _handler.ScheduleNewCalculationAsync(command).ConfigureAwait(false);
- return new OkObjectResult(orchestrationInstanceId.Value);
+ var orchestrationInstanceId = await _handler.HandleAsync(command).ConfigureAwait(false);
+ return new OkObjectResult(orchestrationInstanceId);
}
}
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartCalculationHandlerV1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartCalculationHandlerV1.cs
index 50193c92..5782bc5c 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartCalculationHandlerV1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartCalculationHandlerV1.cs
@@ -12,6 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
+using Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
using Energinet.DataHub.ProcessManagement.Core.Application.Orchestration;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationDescription;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationInstance;
@@ -23,12 +24,14 @@ namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_023_027.
internal class StartCalculationHandlerV1(
DateTimeZone dateTimeZone,
- IStartOrchestrationInstanceCommands manager)
+ IStartOrchestrationInstanceCommands manager) :
+ IStartOrchestrationInstanceCommandHandler,
+ IScheduleOrchestrationInstanceCommandHandler
{
private readonly DateTimeZone _dateTimeZone = dateTimeZone;
private readonly IStartOrchestrationInstanceCommands _manager = manager;
- public async Task StartNewCalculationAsync(StartCalculationCommandV1 command)
+ public async Task HandleAsync(StartCalculationCommandV1 command)
{
GuardInputParameter(command.InputParameter);
@@ -49,10 +52,10 @@ public async Task StartNewCalculationAsync(StartCalcula
skipStepsBySequence: skipStepsBySequence)
.ConfigureAwait(false);
- return orchestrationInstanceId;
+ return orchestrationInstanceId.Value;
}
- public async Task ScheduleNewCalculationAsync(ScheduleCalculationCommandV1 command)
+ public async Task HandleAsync(ScheduleCalculationCommandV1 command)
{
GuardInputParameter(command.InputParameter);
@@ -74,7 +77,7 @@ public async Task ScheduleNewCalculationAsync(ScheduleC
skipStepsBySequence: skipStepsBySequence)
.ConfigureAwait(false);
- return orchestrationInstanceId;
+ return orchestrationInstanceId.Value;
}
private static bool IsEntireMonth(ZonedDateTime periodStart, ZonedDateTime periodEnd)
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartTrigger_Brs_023_027_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartTrigger_Brs_023_027_V1.cs
index 466c7b90..90dc53ab 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartTrigger_Brs_023_027_V1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_023_027/V1/StartTrigger_Brs_023_027_V1.cs
@@ -39,7 +39,7 @@ public async Task Run(
StartCalculationCommandV1 command,
FunctionContext executionContext)
{
- var orchestrationInstanceId = await _handler.StartNewCalculationAsync(command).ConfigureAwait(false);
- return new OkObjectResult(orchestrationInstanceId.Value);
+ var orchestrationInstanceId = await _handler.HandleAsync(command).ConfigureAwait(false);
+ return new OkObjectResult(orchestrationInstanceId);
}
}
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueMessagesActivity_Brs_026_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueMessagesActivity_Brs_026_V1.cs
index 250bf81e..1d04aa31 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueMessagesActivity_Brs_026_V1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueMessagesActivity_Brs_026_V1.cs
@@ -39,7 +39,7 @@ public async Task Run(
.ConfigureAwait(false);
orchestrationInstance.TransitionStepToRunning(
- Orchestration_RequestCalculatedEnergyTimeSeries_V1.EnqueueMessagesStepSequence,
+ Orchestration_Brs_026_V1.EnqueueMessagesStepSequence,
_clock);
await _progressRepository.UnitOfWork.CommitAsync().ConfigureAwait(false);
await EnqueueMessagesAsync(input).ConfigureAwait(false);
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueRejectMessageActivity_Brs_026_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueRejectMessageActivity_Brs_026_V1.cs
index dc7bc89d..035d15f1 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueRejectMessageActivity_Brs_026_V1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/EnqueueRejectMessageActivity_Brs_026_V1.cs
@@ -38,7 +38,7 @@ public async Task Run(
.ConfigureAwait(false);
orchestrationInstance.TransitionStepToRunning(
- Orchestration_RequestCalculatedEnergyTimeSeries_V1.EnqueueMessagesStepSequence,
+ Orchestration_Brs_026_V1.EnqueueMessagesStepSequence,
_clock);
await _progressRepository.UnitOfWork.CommitAsync().ConfigureAwait(false);
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/PerformAsyncValidationActivity_Brs_026_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/PerformAsyncValidationActivity_Brs_026_V1.cs
index 1ea40f03..342f672f 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/PerformAsyncValidationActivity_Brs_026_V1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Activities/PerformAsyncValidationActivity_Brs_026_V1.cs
@@ -39,7 +39,7 @@ public async Task Run(
.ConfigureAwait(false);
orchestrationInstance.TransitionStepToRunning(
- Orchestration_RequestCalculatedEnergyTimeSeries_V1.AsyncValidationStepSequence,
+ Orchestration_Brs_026_V1.AsyncValidationStepSequence,
_clock);
await _progressRepository.UnitOfWork.CommitAsync().ConfigureAwait(false);
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/OrchestrationDescriptionBuilder.cs b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/OrchestrationDescriptionBuilder.cs
index b85e5643..1d38c4d4 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/OrchestrationDescriptionBuilder.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/OrchestrationDescriptionBuilder.cs
@@ -29,7 +29,7 @@ public OrchestrationDescription Build()
orchestrationDescriptionUniqueName.Name,
orchestrationDescriptionUniqueName.Version),
canBeScheduled: false,
- functionName: nameof(Orchestration_RequestCalculatedEnergyTimeSeries_V1));
+ functionName: nameof(Orchestration_Brs_026_V1));
description.ParameterDefinition.SetFromType();
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Orchestration_RequestCalculatedEnergyTimeSeries_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Orchestration_Brs_026_V1.cs
similarity index 96%
rename from source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Orchestration_RequestCalculatedEnergyTimeSeries_V1.cs
rename to source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Orchestration_Brs_026_V1.cs
index 535935d2..fe371c90 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Orchestration_RequestCalculatedEnergyTimeSeries_V1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/Orchestration_Brs_026_V1.cs
@@ -23,19 +23,19 @@
namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_026.V1;
// TODO: Implement according to guidelines: https://energinet.atlassian.net/wiki/spaces/D3/pages/824803345/Durable+Functions+Development+Guidelines
-internal class Orchestration_RequestCalculatedEnergyTimeSeries_V1
+internal class Orchestration_Brs_026_V1
{
public const int AsyncValidationStepSequence = 1;
public const int EnqueueMessagesStepSequence = 2;
private readonly TaskOptions _defaultRetryOptions;
- public Orchestration_RequestCalculatedEnergyTimeSeries_V1()
+ public Orchestration_Brs_026_V1()
{
_defaultRetryOptions = CreateDefaultRetryOptions();
}
- [Function(nameof(Orchestration_RequestCalculatedEnergyTimeSeries_V1))]
+ [Function(nameof(Orchestration_Brs_026_V1))]
public async Task Run(
[OrchestrationTrigger] TaskOrchestrationContext context)
{
@@ -155,7 +155,7 @@ await context.CallActivityAsync(
if (!wasMessagesEnqueued)
{
- var logger = context.CreateReplaySafeLogger();
+ var logger = context.CreateReplaySafeLogger();
logger.Log(
LogLevel.Warning,
"Timeout while waiting for enqueue messages to complete (InstanceId={OrchestrationInstanceId}).",
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/RequestCalculatedEnergyTimeSeriesHandlerV1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/RequestCalculatedEnergyTimeSeriesHandlerV1.cs
index a3ae6a5d..6f014d60 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/RequestCalculatedEnergyTimeSeriesHandlerV1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/RequestCalculatedEnergyTimeSeriesHandlerV1.cs
@@ -12,12 +12,11 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-using Azure.Messaging.ServiceBus;
+using Energinet.DataHub.ProcessManagement.Core.Application.Api.Handlers;
using Energinet.DataHub.ProcessManagement.Core.Application.Orchestration;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationDescription;
using Energinet.DataHub.ProcessManagement.Core.Domain.OrchestrationInstance;
using Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_026.V1.Model;
-using Energinet.DataHub.ProcessManager.Orchestrations.Shared;
using Microsoft.Extensions.Logging;
namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_026.V1;
@@ -25,11 +24,11 @@ namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_026.V1;
public class RequestCalculatedEnergyTimeSeriesHandlerV1(
ILogger logger,
IStartOrchestrationInstanceCommands commands)
- : StartOrchestrationFromMessageHandlerBase(logger)
+ : StartOrchestrationInstanceFromMessageHandlerBase(logger)
{
private readonly IStartOrchestrationInstanceCommands _commands = commands;
- protected override async Task StartOrchestration(ActorIdentity actorIdentity, RequestCalculatedEnergyTimeSeriesInputV1 input)
+ protected override async Task StartOrchestrationInstanceAsync(ActorIdentity actorIdentity, RequestCalculatedEnergyTimeSeriesInputV1 input)
{
var orchestrationDescriptionUniqueName = new Brs_026_V1();
diff --git a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/StartTrigger_RequestCalculatedEnergyTimeSeries_V1.cs b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/StartTrigger_Brs_026_V1.cs
similarity index 73%
rename from source/ProcessManager.Orchestrations/Processes/BRS_026/V1/StartTrigger_RequestCalculatedEnergyTimeSeries_V1.cs
rename to source/ProcessManager.Orchestrations/Processes/BRS_026/V1/StartTrigger_Brs_026_V1.cs
index 9f9a23ed..84ca950d 100644
--- a/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/StartTrigger_RequestCalculatedEnergyTimeSeries_V1.cs
+++ b/source/ProcessManager.Orchestrations/Processes/BRS_026/V1/StartTrigger_Brs_026_V1.cs
@@ -12,18 +12,19 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-using System.Text.Json;
using Azure.Messaging.ServiceBus;
using Energinet.DataHub.Core.Messaging.Communication.Extensions.Options;
-using Energinet.DataHub.ProcessManager.Abstractions.Contracts;
-using Energinet.DataHub.ProcessManager.Orchestrations.Abstractions.Processes.BRS_026.V1.Model;
using Energinet.DataHub.ProcessManager.Orchestrations.Extensions.Options;
using Microsoft.Azure.Functions.Worker;
-using Microsoft.Extensions.Logging;
namespace Energinet.DataHub.ProcessManager.Orchestrations.Processes.BRS_026.V1;
-public class StartTrigger_RequestCalculatedEnergyTimeSeries_V1(
+// TODO: We have decided to route on the "name" part of the "orchestration description unique name",
+// meaning not including the "version" part; this will minimize how often we need to adjust infrastructure
+// with regards to "subscriptions". Hence this trigger should not be located within the "V1".
+// Also we need a generic way to first parse the "version" of a command and then direct the message to
+// the correct "version handler."
+public class StartTrigger_Brs_026_V1(
RequestCalculatedEnergyTimeSeriesHandlerV1 handler)
{
private readonly RequestCalculatedEnergyTimeSeriesHandlerV1 _handler = handler;
@@ -31,7 +32,7 @@ public class StartTrigger_RequestCalculatedEnergyTimeSeries_V1(
///
/// Start a BRS-026 request.
///
- [Function(nameof(StartTrigger_RequestCalculatedEnergyTimeSeries_V1))]
+ [Function(nameof(StartTrigger_Brs_026_V1))]
public async Task Run(
[ServiceBusTrigger(
$"%{ProcessManagerTopicOptions.SectionName}:{nameof(ProcessManagerTopicOptions.TopicName)}%",
@@ -39,7 +40,7 @@ public async Task Run(
Connection = ServiceBusNamespaceOptions.SectionName)]
ServiceBusReceivedMessage message)
{
- await _handler.StartOrchestration(message)
+ await _handler.HandleAsync(message)
.ConfigureAwait(false);
}
}
diff --git a/source/ProcessManager.Orchestrations/Program.cs b/source/ProcessManager.Orchestrations/Program.cs
index 4f65ade6..c1e624b9 100644
--- a/source/ProcessManager.Orchestrations/Program.cs
+++ b/source/ProcessManager.Orchestrations/Program.cs
@@ -54,7 +54,7 @@
services.AddScoped();
services.AddScoped();
services.AddScoped();
- services.AddScoped();
+ services.AddScoped();
})
.ConfigureLogging((hostingContext, logging) =>
{