Azure / durabletask

Durable Task Framework allows users to write long running persistent workflows in C# using the async/await capabilities.
Apache License 2.0
1.47k stars 287 forks source link

Orchestration with an ID that already ran is not being tracked as existing #1043

Closed msolimanaya closed 4 months ago

msolimanaya commented 4 months ago

The state works as expected when I configure the worker with a store and service bus. If I configure the taskhub worker with the store only, the instance is not tracked and running an orchestration with the same instance ID does not get tracked as existing.

Non working example with store only:

var storageConnectionString = "UseDevelopmentStorage=true;DevelopmentStorageProxyUri=http://127.0.0.1";

var taskHubName = "TestTaskHub";
var azureStorageSettings = new AzureStorageOrchestrationServiceSettings
{
    StorageAccountDetails = new StorageAccountDetails { ConnectionString = storageConnectionString },
    TaskHubName = taskHubName,
};

var service = new AzureStorageOrchestrationService(azureStorageSettings);

   this.taskHubWorker = new TaskHubWorker(service);

Working example with store and service bus:

`   var settings = new ServiceBusOrchestrationServiceSettings();

   IOrchestrationServiceInstanceStore store = new AzureTableInstanceStore("TestTaskHub", "UseDevelopmentStorage=true;DevelopmentStorageProxyUri= http://127.0.0.1;");

   orchestrationService = new ServiceBusOrchestrationService("service bus connection string", "TestTaskHub", store, null, settings);

   taskHubWorker = new TaskHubWorker(orchestrationService);

Rest of code:

   taskHubWorker.AddTaskOrchestrations(typeof(TasksOrchestration));

   taskHubWorker.AddTaskActivities(
  typeof(FirstTask),
       typeof(SecondTask));

   await orchestrationService.CreateIfNotExistsAsync();`