I'm upgrading an Azure Durable Function project from .NET Core 2.1 to 2.2. I updated all NuGet packages to the latest releases that are compatible with .NET Core 2.2 (to my knowledge). The Durable Client function (StartOrchestration
) is configured with a timer trigger (shown below) which is working as expected.
What isn't working is that the Orchestration Trigger function (SearchOrchestration
) is never called and I have no idea why. Did I update to an invalid NuGet package(s)? Is there something obvious wrong that I'm just not seeing?
For reference, I've been looking at the Bindings for Durable Functions document and it would appear like my code should work... but it doesn't.
The durable function orchestration:
public static class SearchIndexDurableFunctions
{
[FunctionName(nameof(StartOrchestration))]
public static async Task StartOrchestration(
[TimerTrigger("%CronExpression%")]TimerInfo myTimer,
[DurableClient(TaskHub = "%TaskHub:Name%")]IDurableOrchestrationClient starter,
ILogger logger)
{
var nextRunTime = myTimer.Schedule.GetNextOccurrence(DateTime.Now);
logger.LogInformation($">> Next run time will be: {nextRunTime.ToLocalTime()}");
var instanceId = Guid.NewGuid().ToString();
var result = await starter.StartNewAsync(nameof(SearchOrchestration), instanceId);
}
[FunctionName(nameof(SearchOrchestration))]
public static async Task SearchOrchestration(
[OrchestrationTrigger]IDurableOrchestrationContext context,
ILogger logger)
{
try
{
await context.CallActivityAsync(nameof(SearchPartIndexFunctionActivity), null);
await context.CallActivityAsync(nameof(SearchProductIndexFunctionActivity), null);
}
catch (FunctionFailedException ex)
{
logger.LogError(ex, $"Search index orchestration failed.");
}
}
[FunctionName(nameof(SearchPartIndexFunctionActivity))]
public static async Task SearchPartIndexFunctionActivity(
[ActivityTrigger]string input,
ExecutionContext context,
ILogger logger)
{
logger.LogInformation("Started SearchPartIndexFunctionActivity...");
var busLogic = new SearchPartIndexFunctionBase(context, logger);
await busLogic.UpdateIndexAndData();
logger.LogInformation("Finished SearchPartIndexFunctionActivity successfully.");
}
[FunctionName(nameof(SearchProductIndexFunctionActivity))]
public static async Task SearchProductIndexFunctionActivity(
[ActivityTrigger]string input,
ExecutionContext context,
ILogger logger)
{
logger.LogInformation("Started SearchProductIndexFunctionActivity...");
var busLogic = new SearchProductIndexFunctionBase(context, logger);
await busLogic.UpdateIndexAndData();
logger.LogInformation("Finished SearchProductIndexFunctionActivity successfully.");
}
}
The .csproj file showing NuGet package versions:
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netcoreapp2.2</TargetFramework>
<AzureFunctionsVersion>v2</AzureFunctionsVersion>
<AssemblyName>[Company Name].Interface.Search</AssemblyName>
<RootNamespace>[Company Name].Interface.Search</RootNamespace>
<LangVersion>7.2</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper" Version="9.0.0" />
<PackageReference Include="Microsoft.Azure.DocumentDB.Core" Version="2.9.2" />
<PackageReference Include="Microsoft.Azure.Management.Fluent" Version="1.29.0" />
<PackageReference Include="Microsoft.Azure.Management.TrafficManager.Fluent" Version="1.29.0" />
<PackageReference Include="Microsoft.Azure.Search" Version="10.1.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.DurableTask" Version="2.0.0" />
<PackageReference Include="Microsoft.Azure.WebJobs.Extensions.Http" Version="3.0.2" />
<PackageReference Include="Microsoft.Azure.WebJobs.Host.Storage" Version="3.0.14" />
<PackageReference Include="Microsoft.Azure.WebJobs.Script.ExtensionsMetadataGenerator" Version="1.1.3" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.4" />
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="3.0.2" />
<PackageReference Include="[Company Name].Core.Repositories" Version="1.0.20191218.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="local.settings.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToPublishDirectory>Never</CopyToPublishDirectory>
</None>
</ItemGroup>
</Project>