├── .gitattributes
├── .github
└── workflows
│ └── codeQL.yml
├── .gitignore
├── .nuget
└── NuGet.Config
├── Directory.Build.targets
├── Directory.Packages.props
├── DurableTask.sln
├── DurableTask.sln.DotSettings
├── LICENSE
├── README.md
├── SECURITY.md
├── Test
├── DurableTask.AzureStorage.Tests
│ └── Storage
│ │ └── DurableTaskStorageExceptionTests.cs
└── DurableTask.Core.Tests
│ ├── ScheduleTaskOptionsTests.cs
│ ├── TaskOrchestrationContextTests.cs
│ └── VersionSettingsTests.cs
├── docs
└── telemetry
│ └── traces
│ ├── getting-started.md
│ └── semantic-conventions.md
├── eng
├── ci
│ ├── code-mirror.yml
│ ├── official-build.yml
│ └── public-build.yml
└── templates
│ ├── build-steps.yml
│ ├── build.yml
│ └── test.yml
├── logo.png
├── samples
├── Correlation.Samples
│ ├── ContinueAsNewOrchestration.cs
│ ├── CorrelatedExceptionExtensions.cs
│ ├── Correlation.Samples.csproj
│ ├── DurableTaskCorrelationTelemetryInitializer.cs
│ ├── FanOutFanInOrchestrator.cs
│ ├── HelloOrchestrator.cs
│ ├── MultiLayeredOrchestrationWithRetry.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Readme.md
│ ├── RetryOrchestration.cs
│ ├── ScenarioInvoker.cs
│ ├── StringExtensions.cs
│ ├── SubOrchestratorOrchestration.cs
│ ├── TelemetryActivator.cs
│ ├── TerminatedOrchestration.cs
│ ├── TestHelpers.cs
│ ├── TestOrchestrationClient.cs
│ ├── TestOrchestrationHost.cs
│ ├── TraceContextBaseExtensions.cs
│ ├── Traceparent.cs
│ ├── appsettings.json
│ └── docs
│ │ ├── getting-started.md
│ │ ├── images
│ │ ├── class-diagram.png
│ │ ├── end-to-end.png
│ │ ├── overview.png
│ │ ├── search.png
│ │ └── telemetry-tracking.png
│ │ └── overview.md
├── DistributedTraceSample
│ ├── ApplicationInsights
│ │ ├── ApplicationInsightsSample.csproj
│ │ ├── FilterOutStorageTelemetryProcessor.cs
│ │ ├── Program.cs
│ │ ├── Properties
│ │ │ └── launchSettings.json
│ │ └── appsettings.json
│ └── OpenTelemetry
│ │ ├── OpenTelemetrySample.csproj
│ │ ├── Program.cs
│ │ ├── README.md
│ │ └── images
│ │ ├── ApplicationInsightsExporter.png
│ │ ├── ConsoleExporter.png
│ │ └── ZipkinExporter.png
├── DurableTask.Samples
│ ├── App.config
│ ├── AverageCalculator
│ │ ├── AverageCalculatorOrchestration.cs
│ │ └── ComputeSumTask.cs
│ ├── Common.WorkItems
│ │ └── EmailTask.cs
│ ├── Cron
│ │ ├── CronOrchestration.cs
│ │ └── CronTask.cs
│ ├── DurableTask.Samples.csproj
│ ├── ErrorHandling
│ │ ├── ErrorHandlingOrchestration.cs
│ │ └── ErrorHandlingTasks.cs
│ ├── Greetings
│ │ ├── GetUserName.Designer.cs
│ │ ├── GetUserName.cs
│ │ ├── GetUserName.resx
│ │ ├── GetUserTask.cs
│ │ ├── GreetingsOrchestration.cs
│ │ └── SendGreetingTask.cs
│ ├── Greetings2
│ │ └── GreetingsOrchestration.cs
│ ├── Options.cs
│ ├── Program.cs
│ ├── Properties
│ │ └── launchSettings.json
│ ├── Replat
│ │ ├── Application.cs
│ │ ├── ManagementSqlOrchestrationTasks.cs
│ │ ├── MigrateOrchestration.cs
│ │ ├── MigrateOrchestrationData.cs
│ │ ├── MigrateOrchestrationStatus.cs
│ │ └── MigrationTasks.cs
│ ├── Signal
│ │ └── SignalOrchestration.cs
│ └── SumOfSquares
│ │ ├── BagofNumbers.json
│ │ ├── SumOfSquaresOrchestration.cs
│ │ └── SumOfSquaresTask.cs
└── ManagedIdentitySample
│ ├── DTFx.AzureStorage v1.x
│ ├── ManagedIdentity.AzStorageV1.csproj
│ ├── Program.cs
│ └── ReadMe.md
│ └── DTFx.AzureStorage v2.x
│ ├── ManagedIdentity.AzStorageV2.csproj
│ ├── Program.cs
│ └── ReadMe.md
├── src
├── DurableTask.ApplicationInsights
│ ├── DiagnosticActivityExtensions.cs
│ ├── DurableTask.ApplicationInsights.csproj
│ └── DurableTelemetryModule.cs
├── DurableTask.AzureServiceFabric
│ ├── AssemblyInfo.cs
│ ├── AsyncManualResetEvent.cs
│ ├── Constants.cs
│ ├── DurableTask.AzureServiceFabric.csproj
│ ├── ExceptionUtilities.cs
│ ├── Exceptions
│ │ ├── InvalidInstanceIdException.cs
│ │ └── RemoteServiceException.cs
│ ├── Extensions.cs
│ ├── FabricOrchestrationInstanceStore.cs
│ ├── FabricOrchestrationProvider.cs
│ ├── FabricOrchestrationProviderFactory.cs
│ ├── FabricOrchestrationProviderSettings.cs
│ ├── FabricOrchestrationService.cs
│ ├── FabricOrchestrationServiceClient.cs
│ ├── IFabricOrchestrationServiceInstanceStore.cs
│ ├── IFabricProviderClient.cs
│ ├── IPartitionEndpointResolver.cs
│ ├── Message.cs
│ ├── OrchestrationInstanceComparer.cs
│ ├── OrchestrationStatusExtensions.cs
│ ├── PersistentSession.cs
│ ├── README.md
│ ├── Remote
│ │ ├── CreateTaskOrchestrationParameters.cs
│ │ ├── DefaultStringPartitionHashing.cs
│ │ ├── FabricPartitionEndpointResolver.cs
│ │ ├── IPartitionHashing.cs
│ │ ├── PurgeOrchestrationHistoryParameters.cs
│ │ └── RemoteOrchestrationServiceClient.cs
│ ├── Service
│ │ ├── ActivityLoggingMessageHandler.cs
│ │ ├── DefaultDependencyResolver.cs
│ │ ├── FabricOrchestrationServiceController.cs
│ │ ├── IOwinAppBuilder.cs
│ │ ├── IServiceListener.cs
│ │ ├── OwinCommunicationListener.cs
│ │ ├── ProxyServiceExceptionHandler.cs
│ │ ├── ProxyServiceExceptionLogger.cs
│ │ ├── Startup.cs
│ │ ├── TaskHubProxyListener.cs
│ │ └── TaskHubStatefulService.cs
│ ├── Stores
│ │ ├── ActivityProvider.cs
│ │ ├── MessageProviderBase.cs
│ │ ├── ScheduledMessageProvider.cs
│ │ ├── SessionMessageProvider.cs
│ │ └── SessionProvider.cs
│ ├── TaskHelpers
│ │ ├── CountBasedFixedDelayRetryPolicy.cs
│ │ ├── RetryHelper.cs
│ │ └── RetryPolicy.cs
│ ├── TaskMessageItem.cs
│ ├── TimerFiredEventComparer.cs
│ ├── Tracing
│ │ ├── ServiceFabricProviderEventSource.cs
│ │ └── TracingExtensions.cs
│ └── Utils.cs
├── DurableTask.AzureStorage
│ ├── .editorconfig
│ ├── AnalyticsEventSource.cs
│ ├── AssemblyInfo.cs
│ ├── AsyncAutoResetEvent.cs
│ ├── AsyncManualResetEvent.cs
│ ├── AsyncQueue.cs
│ ├── AzureStorageOrchestrationService.cs
│ ├── AzureStorageOrchestrationServiceSettings.cs
│ ├── BackoffPollingHelper.cs
│ ├── DataContractJsonConverter.cs
│ ├── DefaultStorageServiceClientProvider.cs
│ ├── DispatchQueue.cs
│ ├── DurableStatusQueryResult.cs
│ ├── DurableTask.AzureStorage.csproj
│ ├── DurableTask.AzureStorage.sln
│ ├── EntityTrackingStoreQueries.cs
│ ├── Fnv1aHashHelper.cs
│ ├── Http
│ │ ├── LeaseTimeoutHttpPipelinePolicy.cs
│ │ ├── MonitoringHttpPipelinePolicy.cs
│ │ └── ThrottlingHttpPipelinePolicy.cs
│ ├── ICustomTypeBinder.cs
│ ├── IStorageServiceClientProvider.cs
│ ├── Linq
│ │ └── AsyncEnumerableExtensions.cs
│ ├── Logging
│ │ ├── EventIds.cs
│ │ ├── LogEvents.cs
│ │ ├── LogHelper.cs
│ │ └── NoOpLoggerFactory.cs
│ ├── MessageData.cs
│ ├── MessageManager.cs
│ ├── Messaging
│ │ ├── ActivitySession.cs
│ │ ├── ControlQueue.cs
│ │ ├── MessageCollection.cs
│ │ ├── OrchestrationSession.cs
│ │ ├── Session.cs
│ │ ├── TaskHubQueue.cs
│ │ └── WorkItemQueue.cs
│ ├── Monitoring
│ │ ├── AzureStorageOrchestrationServiceStats.cs
│ │ ├── DisconnectedPerformanceMonitor.cs
│ │ ├── PerformanceHeartbeat.cs
│ │ ├── ScaleAction.cs
│ │ └── ScaleRecommendation.cs
│ ├── Net
│ │ └── UriPath.cs
│ ├── OrchestrationInstanceStatus.cs
│ ├── OrchestrationSessionManager.cs
│ ├── Partitioning
│ │ ├── AppLeaseManager.cs
│ │ ├── AppLeaseOptions.cs
│ │ ├── BlobPartitionLease.cs
│ │ ├── BlobPartitionLeaseManager.cs
│ │ ├── CloseReason.cs
│ │ ├── ILeaseManager.cs
│ │ ├── IPartitionManager.cs
│ │ ├── Lease.cs
│ │ ├── LeaseCollectionBalancer.cs
│ │ ├── LeaseCollectionBalancerOptions.cs
│ │ ├── LeaseLostException.cs
│ │ ├── LeaseObserver.cs
│ │ ├── LegacyPartitionManager.cs
│ │ ├── SafePartitionManager.cs
│ │ ├── TablePartitionLease.cs
│ │ ├── TablePartitionManager.cs
│ │ └── TaskHubInfo.cs
│ ├── PurgeHistoryResult.cs
│ ├── README.md
│ ├── Storage
│ │ ├── AzureStorageClient.cs
│ │ ├── Blob.cs
│ │ ├── BlobContainer.cs
│ │ ├── ClientResponseExtensions.cs
│ │ ├── DurableTaskStorageException.cs
│ │ ├── OperationContext.cs
│ │ ├── Queue.cs
│ │ ├── QueueExtensions.cs
│ │ ├── Table.cs
│ │ ├── TableQueryResponse.cs
│ │ ├── TableQueryResults.cs
│ │ ├── TableTransactionResults.cs
│ │ └── TableTransactionResultsBuilder.cs
│ ├── StorageAccountClientProvider.cs
│ ├── StorageServiceClientProvider.cs
│ ├── Tracking
│ │ ├── AzureTableTrackingStore.cs
│ │ ├── ITrackingStore.cs
│ │ ├── InstanceStatus.cs
│ │ ├── InstanceStoreBackedTrackingStore.cs
│ │ ├── KeySanitation.cs
│ │ ├── ODataCondition.cs
│ │ ├── OrchestrationHistory.cs
│ │ ├── OrchestrationInstanceStatusQueryCondition.cs
│ │ ├── TableEntityConverter.cs
│ │ ├── TagsSerializer.cs
│ │ └── TrackingStoreBase.cs
│ ├── TrackingServiceClientProvider.cs
│ └── Utils.cs
├── DurableTask.Core
│ ├── ActivityExecutionResult.cs
│ ├── AssemblyInfo.cs
│ ├── Command
│ │ ├── CreateSubOrchestrationAction.cs
│ │ ├── CreateTimerOrchestratorAction.cs
│ │ ├── OrchestrationCompleteOrchestratorAction.cs
│ │ ├── OrchestratorAction.cs
│ │ ├── OrchestratorActionConverter.cs
│ │ ├── OrchestratorActionType.cs
│ │ ├── ScheduleTaskOrchestratorAction.cs
│ │ └── SendEventOrchestratorAction.cs
│ ├── Common
│ │ ├── CompressionStyle.cs
│ │ ├── DateTimeUtils.cs
│ │ ├── Entities.cs
│ │ ├── Fnv1aHashHelper.cs
│ │ └── Utils.cs
│ ├── CorrelatedExceptionDetails.cs
│ ├── CorrelationTraceClient.cs
│ ├── CorrelationTraceContext.cs
│ ├── DefaultObjectCreator.cs
│ ├── DurableTask.Core.csproj
│ ├── Entities
│ │ ├── ClientEntityHelpers.cs
│ │ ├── EntityBackendProperties.cs
│ │ ├── EntityBackendQueries.cs
│ │ ├── EntityId.cs
│ │ ├── EntityMessageEvent.cs
│ │ ├── EventFormat
│ │ │ ├── EntityMessage.cs
│ │ │ ├── EntityMessageEventNames.cs
│ │ │ ├── ReleaseMessage.cs
│ │ │ ├── RequestMessage.cs
│ │ │ └── ResponseMessage.cs
│ │ ├── IEntityOrchestrationService.cs
│ │ ├── OperationFormat
│ │ │ ├── EntityBatchRequest.cs
│ │ │ ├── EntityBatchResult.cs
│ │ │ ├── OperationAction.cs
│ │ │ ├── OperationActionConverter.cs
│ │ │ ├── OperationActionType.cs
│ │ │ ├── OperationRequest.cs
│ │ │ ├── OperationResult.cs
│ │ │ ├── SendSignalOperationAction.cs
│ │ │ └── StartNewOrchestrationOperationAction.cs
│ │ ├── OrchestrationEntityContext.cs
│ │ ├── Serializer.cs
│ │ ├── StateFormat
│ │ │ ├── EntityStatus.cs
│ │ │ ├── MessageSorter.cs
│ │ │ └── SchedulerState.cs
│ │ ├── TaskEntity.cs
│ │ └── TaskOrchestrationEntityParameters.cs
│ ├── ErrorPropagationMode.cs
│ ├── EventHandlingOnContinueAsNew.cs
│ ├── Exceptions
│ │ ├── EntitySchedulerException.cs
│ │ ├── NonDeterministicOrchestrationException.cs
│ │ ├── OrchestrationAlreadyExistsException.cs
│ │ ├── OrchestrationException.cs
│ │ ├── OrchestrationFailureException.cs
│ │ ├── OrchestrationFrameworkException.cs
│ │ ├── SessionAbortedException.cs
│ │ ├── SubOrchestrationFailedException.cs
│ │ ├── TaskFailedException.cs
│ │ ├── TaskFailedExceptionDeserializationException.cs
│ │ ├── TaskFailureException.cs
│ │ └── TypeMissingException.cs
│ ├── FailureDetails.cs
│ ├── FilterComparisonType.cs
│ ├── FrameworkConstants.cs
│ ├── History
│ │ ├── ContinueAsNewEvent.cs
│ │ ├── EventRaisedEvent.cs
│ │ ├── EventSentEvent.cs
│ │ ├── EventType.cs
│ │ ├── ExecutionCompletedEvent.cs
│ │ ├── ExecutionResumedEvent.cs
│ │ ├── ExecutionStartedEvent.cs
│ │ ├── ExecutionSuspendedEvent.cs
│ │ ├── ExecutionTerminatedEvent.cs
│ │ ├── GenericEvent.cs
│ │ ├── HistoryEvent.cs
│ │ ├── HistoryStateEvent.cs
│ │ ├── OrchestratorCompletedEvent.cs
│ │ ├── OrchestratorStartedEvent.cs
│ │ ├── README.md
│ │ ├── SubOrchestrationInstanceCompletedEvent.cs
│ │ ├── SubOrchestrationInstanceCreatedEvent.cs
│ │ ├── SubOrchestrationInstanceFailedEvent.cs
│ │ ├── TaskCompletedEvent.cs
│ │ ├── TaskFailedEvent.cs
│ │ ├── TaskScheduledEvent.cs
│ │ ├── TimerCreatedEvent.cs
│ │ └── TimerFiredEvent.cs
│ ├── HttpCorrelationProtocolTraceContext.cs
│ ├── INameVersionInfo.cs
│ ├── INameVersionObjectManager.cs
│ ├── IOrchestrationService.cs
│ ├── IOrchestrationServiceClient.cs
│ ├── IOrchestrationServiceInstanceStore.cs
│ ├── IOrchestrationServicePurgeClient.cs
│ ├── IOrchestrationSession.cs
│ ├── ISupportsDurableTraceContext.cs
│ ├── Logging
│ │ ├── EventIds.cs
│ │ ├── IEventSourceEvent.cs
│ │ ├── ILogEvent.cs
│ │ ├── LogEvents.cs
│ │ ├── LogHelper.cs
│ │ ├── LoggingExtensions.cs
│ │ ├── README.md
│ │ ├── StructuredEventSource.cs
│ │ ├── StructuredLogEvent.cs
│ │ └── StructuredLogFieldAttribute.cs
│ ├── Middleware
│ │ ├── DispatchMiddlewareContext.cs
│ │ ├── DispatchMiddlewareDelegate.cs
│ │ └── DispatchMiddlewarePipeline.cs
│ ├── NameValueObjectCreator.cs
│ ├── NameVersionHelper.cs
│ ├── NameVersionObjectManager.cs
│ ├── NullObjectTraceContext.cs
│ ├── ObjectCreator.cs
│ ├── OrchestrationContext.cs
│ ├── OrchestrationExecutionContext.cs
│ ├── OrchestrationExecutionCursor.cs
│ ├── OrchestrationInstance.cs
│ ├── OrchestrationRuntimeState.cs
│ ├── OrchestrationRuntimeStateDump.cs
│ ├── OrchestrationSessionState.cs
│ ├── OrchestrationState.cs
│ ├── OrchestrationStateInstanceFilter.cs
│ ├── OrchestrationStateNameVersionFilter.cs
│ ├── OrchestrationStateQuery.cs
│ ├── OrchestrationStateQueryFilter.cs
│ ├── OrchestrationStateQuerySegment.cs
│ ├── OrchestrationStateStatusFilter.cs
│ ├── OrchestrationStateTimeRangeFilter.cs
│ ├── OrchestrationStateTimeRangeFilterType.cs
│ ├── OrchestrationStatus.cs
│ ├── OrchestrationTags.cs
│ ├── OrchestratorExecutionResult.cs
│ ├── ParentInstance.cs
│ ├── PurgeInstanceFilter.cs
│ ├── PurgeResult.cs
│ ├── Query
│ │ ├── IOrchestrationServiceQueryClient.cs
│ │ ├── OrchestrationQuery.cs
│ │ └── OrchestrationQueryResult.cs
│ ├── ReflectionBasedTaskActivity.cs
│ ├── RetryInterceptor.cs
│ ├── RetryOptions.cs
│ ├── RetryProxy.cs
│ ├── ScheduleProxy.cs
│ ├── ScheduleProxyV2.cs
│ ├── ScheduleTaskOptions.cs
│ ├── Serializing
│ │ ├── DataConverter.cs
│ │ ├── Internal
│ │ │ └── RawInput.cs
│ │ ├── JsonCreationConverter.cs
│ │ ├── JsonDataConverter.cs
│ │ ├── PackageUpgradeSerializationBinder.cs
│ │ └── RuntimeStateStreamConverter.cs
│ ├── Settings
│ │ ├── CompressionSettings.cs
│ │ ├── CorrelationSettings.cs
│ │ ├── ISessionSettings.cs
│ │ ├── TaskActivityDispatcherSettings.cs
│ │ ├── TaskOrchestrationDispatcherSettings.cs
│ │ ├── TrackingDispatcherSettings.cs
│ │ └── VersioningSettings.cs
│ ├── StackExtensions.cs
│ ├── StateMessage.cs
│ ├── Stats
│ │ └── Counter.cs
│ ├── SynchronousTaskScheduler.cs
│ ├── TaskActivity.cs
│ ├── TaskActivityDispatcher.cs
│ ├── TaskActivityWorkItem.cs
│ ├── TaskContext.cs
│ ├── TaskEntityDispatcher.cs
│ ├── TaskHubClient.cs
│ ├── TaskHubWorker.cs
│ ├── TaskMessage.cs
│ ├── TaskOrchestration.cs
│ ├── TaskOrchestrationContext.cs
│ ├── TaskOrchestrationDispatcher.cs
│ ├── TaskOrchestrationExecutor.cs
│ ├── TaskOrchestrationWorkItem.cs
│ ├── TraceConstants.cs
│ ├── TraceContextBase.cs
│ ├── TraceContextFactory.cs
│ ├── Tracing
│ │ ├── DefaultEventSource.cs
│ │ ├── DiagnosticActivityExtensions.cs
│ │ ├── DistributedTraceActivity.cs
│ │ ├── DistributedTraceContext.cs
│ │ ├── FieldInfoExtensionMethods.cs
│ │ ├── Schema.cs
│ │ ├── TraceActivityConstants.cs
│ │ └── TraceHelper.cs
│ ├── Tracking
│ │ ├── IOrchestrationServiceBlobStore.cs
│ │ ├── InstanceEntityBase.cs
│ │ ├── OrchestrationJumpStartInstanceEntity.cs
│ │ ├── OrchestrationStateInstanceEntity.cs
│ │ └── OrchestrationWorkItemInstanceEntity.cs
│ ├── TrackingWorkItem.cs
│ ├── W3CTraceContext.cs
│ ├── WorkItemDispatcher.cs
│ └── WorkItemDispatcherContext.cs
├── DurableTask.Emulator
│ ├── DurableTask.Emulator.csproj
│ ├── LocalOrchestrationService.cs
│ ├── PeekLockQueue.cs
│ ├── PeekLockSessionQueue.cs
│ └── TaskSession.cs
└── DurableTask.ServiceBus
│ ├── AssemblyInfo.cs
│ ├── Common
│ ├── Abstraction
│ │ └── ServiceBusAbstraction.cs
│ ├── BrokeredMessageExtensions.cs
│ └── ServiceBusUtils.cs
│ ├── DurableTask.ServiceBus.csproj
│ ├── ServiceBusConstants.cs
│ ├── ServiceBusOrchestrationService.cs
│ ├── ServiceBusOrchestrationSession.cs
│ ├── Settings
│ ├── JumpStartSettings.cs
│ ├── ServiceBusConnectionSettings.cs
│ ├── ServiceBusMessageSenderSettings.cs
│ ├── ServiceBusMessageSettings.cs
│ ├── ServiceBusOrchestrationServiceSettings.cs
│ └── ServiceBusSessionSettings.cs
│ ├── Stats
│ ├── ServiceBusOrchestrationServiceStats.cs
│ └── ServiceBusQueueStats.cs
│ ├── Tracking
│ ├── AzureStorageBlobStore.cs
│ ├── AzureTableClient.cs
│ ├── AzureTableCompositeTableEntity.cs
│ ├── AzureTableConstants.cs
│ ├── AzureTableInstanceStore.cs
│ ├── AzureTableOrchestrationHistoryEventEntity.cs
│ ├── AzureTableOrchestrationJumpStartEntity.cs
│ ├── AzureTableOrchestrationStateEntity.cs
│ ├── BlobStorageClient.cs
│ ├── BlobStorageClientHelper.cs
│ └── JumpStartManager.cs
│ └── app.config
├── test
├── DurableTask.AzureServiceFabric.Integration.Tests
│ ├── App.config
│ ├── AssemblySetup.cs
│ ├── Constants.cs
│ ├── DeploymentUtil
│ │ ├── ApplicationInfoReader.cs
│ │ └── DeploymentHelper.cs
│ ├── DurableTask.AzureServiceFabric.Integration.Tests.csproj
│ ├── FunctionalTests.cs
│ ├── StressTests.cs
│ ├── Utilities.cs
│ └── WaitForOrchestrationTests.cs
├── DurableTask.AzureServiceFabric.Tests
│ ├── CountBasedFixedDelayRetryPolicyTests.cs
│ ├── DurableTask.AzureServiceFabric.Tests.csproj
│ ├── Measure.cs
│ ├── OrchestrationInstanceComparerTests.cs
│ ├── PersistentSessionTests.cs
│ ├── SerializationPerformanceExperiments.cs
│ ├── TaskMessageItemTests.cs
│ └── TimerFiredEventComparerTests.cs
├── DurableTask.AzureStorage.Tests
│ ├── AsyncAutoResetEventTests.cs
│ ├── AutoStartOrchestrationCreator.cs
│ ├── AzureStorageOrchestrationServiceSettingsTest.cs
│ ├── AzureStorageScaleTests.cs
│ ├── AzureStorageScenarioTests.cs
│ ├── AzureTableTrackingStoreTest.cs
│ ├── Correlation
│ │ ├── CorrelationScenarioTest.cs
│ │ ├── DurableTaskCorrelationTelemetryInitializer.cs
│ │ ├── LIstExtensionsTest.cs
│ │ ├── ListExtensions.cs
│ │ ├── NoOpTelemetryChannel.cs
│ │ ├── StringExtensions.cs
│ │ ├── StringExtensionsTest.cs
│ │ ├── TelemetryActivator.cs
│ │ ├── TraceContextBaseExtensions.cs
│ │ └── Traceparent.cs
│ ├── DataContractJsonConverterTests.cs
│ ├── DurableTask.AzureStorage.Tests.csproj
│ ├── KeySanitationTests.cs
│ ├── MessageManagerTests.cs
│ ├── Net
│ │ └── UriPathTests.cs
│ ├── Obsolete
│ │ └── LegacyTableEntityConverter.cs
│ ├── OrchestrationInstanceStatusQueryConditionTest.cs
│ ├── ScheduleTaskTests.cs
│ ├── StressTests.cs
│ ├── StringExtensionsTest.cs
│ ├── TableEntityConverterTests.cs
│ ├── TestHelpers.cs
│ ├── TestInstance.cs
│ ├── TestOrchestrationClient.cs
│ ├── TestOrchestrationHost.cs
│ ├── TestTablePartitionManager.cs
│ └── large.jpeg
├── DurableTask.Core.Tests
│ ├── AssemblyInfo.cs
│ ├── CommonTests.cs
│ ├── CustomExceptionsTests.cs
│ ├── DispatcherMiddlewareTests.cs
│ ├── DurableTask.Core.Tests.csproj
│ ├── ExceptionHandlingIntegrationTests.cs
│ ├── HttpCorrelationProtocolTraceContextTest.cs
│ ├── MessageSorterTests.cs
│ ├── RetryInterceptorTests.cs
│ ├── StackExtensionsTest.cs
│ ├── TaskHubClientTests.cs
│ ├── TestObjectCreator.cs
│ ├── TestTaskEntityDispatcher.cs
│ ├── TestUtils.cs
│ ├── TraceContextBaseTest.cs
│ ├── W3CTraceContextTest.cs
│ └── app.config
├── DurableTask.Emulator.Tests
│ ├── DurableTask.Emulator.Tests.csproj
│ └── EmulatorFunctionalTests.cs
├── DurableTask.Samples.Tests
│ ├── AverageCalculatorTests.cs
│ ├── CronTest.cs
│ ├── DurableTask.Samples.Tests.csproj
│ ├── MockObjectCreator.cs
│ └── app.config
├── DurableTask.ServiceBus.Tests
│ ├── AzureTableClientTest.cs
│ ├── BlobStorageClientHelperTest.cs
│ ├── BlobStorageClientTest.cs
│ ├── DispatcherTests.cs
│ ├── DurableTask.ServiceBus.Tests.csproj
│ ├── DynamicProxyTests.cs
│ ├── ErrorHandlingTests.cs
│ ├── FunctionalTests.cs
│ ├── InstanceStoreQueryTests.cs
│ ├── OrchestrationHubTableClientTests.cs
│ ├── RuntimeStateStreamConverterTest.cs
│ ├── SampleScenarioTests.cs
│ ├── SerializationTests.cs
│ ├── ServiceBusOrchestrationServiceTests.cs
│ ├── TaskHubClientTests.cs
│ ├── TestData
│ │ ├── SerializedExecutionStartedEvent.json
│ │ ├── SerializedOrchestrationState.json
│ │ ├── SerializedOrchestrationStateWithTags.json
│ │ ├── v1.0
│ │ │ ├── SerializedOrchestrationStateNoTags.json
│ │ │ ├── SerializedRuntimeState.json
│ │ │ └── SerializedTaskMessage.json
│ │ └── vnext
│ │ │ ├── SerializedExecutionStartedEvent.json
│ │ │ └── SerializedStateWithTags.json
│ ├── TestHelpers.cs
│ ├── TestObjectCreator.cs
│ ├── app.config
│ └── testhost.dll.config
├── DurableTask.Stress.Tests
│ ├── DurableTask.Stress.Tests.csproj
│ ├── DurableTask.Stress.Tests.dll.config
│ ├── Options.cs
│ ├── Program.cs
│ ├── app.config
│ └── eventFlowConfig.json
├── DurableTask.Test.Orchestrations
│ ├── AssemblyInfo.cs
│ ├── DurableTask.Test.Orchestrations.csproj
│ ├── Performance
│ │ ├── DriverOrchestration.cs
│ │ ├── DriverOrchestrationData.cs
│ │ ├── ExecutionCountingActivity.cs
│ │ ├── ExecutionCountingOrchestration.cs
│ │ ├── RandomTimeWaitingTask.cs
│ │ ├── RandomTimeWaitingTaskInput.cs
│ │ ├── TestOrchestration.cs
│ │ └── TestOrchestrationData.cs
│ ├── SimpleOrchestrations.cs
│ └── Stress
│ │ ├── DriverOrchestration.cs
│ │ ├── DriverOrchestrationData.cs
│ │ ├── TestOrchestration.cs
│ │ ├── TestOrchestrationData.cs
│ │ ├── TestTask.cs
│ │ └── TestTaskData.cs
└── TestFabricApplication
│ ├── TestApplication.Common
│ ├── OrchestrationTasks
│ │ ├── ITestTasks.cs
│ │ ├── IUserTasks.cs
│ │ ├── TestTasks.cs
│ │ └── UserTasks.cs
│ ├── Orchestrations
│ │ ├── CounterException.cs
│ │ ├── GenerationBasicOrchestration.cs
│ │ ├── OrchestrationRunningIntoRetry.cs
│ │ ├── RecurringOrchestration.cs
│ │ ├── RecurringOrchestrationInput.cs
│ │ ├── RecurringTargetOrchestration.cs
│ │ ├── SimpleOrchestrationWithSubOrchestration.cs
│ │ ├── SimpleOrchestrationWithSubOrchestration2.cs
│ │ ├── SimpleOrchestrationWithTasks.cs
│ │ ├── SimpleOrchestrationWithTimer.cs
│ │ └── SimpleRecurringSubOrchestration.cs
│ └── TestApplication.Common.csproj
│ ├── TestApplication.StatefulService
│ ├── PackageRoot
│ │ ├── Config
│ │ │ └── Settings.xml
│ │ └── ServiceManifest.xml
│ ├── Program.cs
│ ├── TestApplication.StatefulService.csproj
│ └── TestOrchestrationsProvider.cs
│ └── TestApplication
│ ├── ApplicationPackageRoot
│ └── ApplicationManifest.xml
│ ├── ApplicationParameters
│ ├── Cloud.xml
│ ├── Local.1Node.xml
│ └── Local.5Node.xml
│ ├── PublishProfiles
│ ├── Cloud.xml
│ ├── Local.1Node.xml
│ └── Local.5Node.xml
│ ├── Scripts
│ └── Deploy-FabricApplication.ps1
│ ├── TestApplication.sfproj
│ └── packages.config
└── tools
├── DurableTask.props
└── sign.snk
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled source #
2 | ###################
3 | *.com
4 | *.class
5 | *.dll
6 | *.exe
7 | *.o
8 | *.so
9 | *.suo
10 | *.user
11 | bin/
12 | obj/
13 | pkg/
14 | packages/
15 | TestResults/
16 | Debug/
17 |
18 | # Packages #
19 | ############
20 | # it's better to unpack these files and commit the raw source
21 | # git has its own built in compression methods
22 | *.7z
23 | *.dmg
24 | *.gz
25 | *.iso
26 | *.jar
27 | *.rar
28 | *.tar
29 | *.zip
30 |
31 | # Logs and databases #
32 | ######################
33 | .vs/
34 | *.log
35 | *.sql
36 | *.sqlite
37 |
38 | # OS generated files #
39 | ######################
40 | .DS_Store
41 | .DS_Store?
42 | ._*
43 | .Spotlight-V100
44 | .Trashes
45 | Icon?
46 | ehthumbs.db
47 | Thumbs.db
48 | .vs/
49 |
50 | # Publish Web output #
51 | ######################
52 | PublishProfiles/
--------------------------------------------------------------------------------
/.nuget/NuGet.Config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/docs/telemetry/traces/getting-started.md:
--------------------------------------------------------------------------------
1 | # Getting Started - Distributed Tracing
2 |
3 | > ⚠ Important: durable task distributed tracing is currently [experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/document-status.md). The schema is subject to changes until it is marked as stable. These changes may occur in any package update.
4 |
5 | > ⚠ Important: this guide only applies DurableTask users. For Durable Functions, please see [here](https://github.com/Azure/azure-functions-durable-extension/blob/dev/samples/distributed-tracing/v2/DistributedTracingSample/README.md)
6 |
7 | Distributed tracing in DurableTask uses the `ActivitySource` approach, it is both OpenTelemetry and Application Insights compatible.
8 |
9 | ## OpenTelemetry
10 |
11 | Add the `"DurableTask.Core"` source to the OTel trace builder.
12 |
13 | ``` CSharp
14 | Sdk.CreateTracerProviderBuilder()
15 | .AddSource("DurableTask.Core")
16 | .Build()
17 | ```
18 |
19 | See [sample](../../../samples/DistributedTraceSample/OpenTelemetry)
20 |
21 | ## Application Insights
22 |
23 | 1. Add reference to [Microsoft.Azure.DurableTask.ApplicationInsights](https://www.nuget.org/packages/Microsoft.Azure.DurableTask.ApplicationInsights)
24 | 2. Add the `DurableTelemetryModule` to AppInsights: `services.TryAddEnumerable(ServiceDescriptor.Singleton());`
25 |
26 | See [sample](../../../samples/DistributedTraceSample/ApplicationInsights)
27 |
--------------------------------------------------------------------------------
/eng/ci/code-mirror.yml:
--------------------------------------------------------------------------------
1 | trigger:
2 | branches:
3 | include:
4 | # These are the branches we'll mirror to our internal ADO instance
5 | # Keep this set limited as appropriate (don't mirror individual user branches).
6 | - main
7 | - durabletask-core-v2
8 | - vabachu/v320-release
9 |
10 | resources:
11 | repositories:
12 | - repository: eng
13 | type: git
14 | name: engineering
15 | ref: refs/tags/release
16 |
17 | variables:
18 | - template: ci/variables/cfs.yml@eng
19 |
20 | extends:
21 | template: ci/code-mirror.yml@eng
22 |
--------------------------------------------------------------------------------
/eng/ci/official-build.yml:
--------------------------------------------------------------------------------
1 | trigger:
2 | batch: true
3 | branches:
4 | include:
5 | - main
6 | - durabletask-core-v2
7 | - vabachu/v320-release
8 |
9 | # CI only, does not trigger on PRs.
10 | pr: none
11 |
12 | schedules:
13 | # Build nightly to catch any new CVEs and report SDL often.
14 | # We are also required to generated CodeQL reports weekly, so this
15 | # helps us meet that.
16 | - cron: "0 0 * * *"
17 | displayName: Nightly Build
18 | branches:
19 | include:
20 | - main
21 | always: true
22 |
23 | resources:
24 | repositories:
25 | - repository: 1es
26 | type: git
27 | name: 1ESPipelineTemplates/1ESPipelineTemplates
28 | ref: refs/tags/release
29 | - repository: eng
30 | type: git
31 | name: engineering
32 | ref: refs/tags/release
33 |
34 | extends:
35 | template: v1/1ES.Official.PipelineTemplate.yml@1es
36 | parameters:
37 | pool:
38 | name: 1es-pool-azfunc
39 | image: 1es-windows-2022
40 | os: windows
41 |
42 | stages:
43 | - stage: BuildAndSign
44 | dependsOn: []
45 | jobs:
46 | - template: /eng/templates/build.yml@self
47 |
--------------------------------------------------------------------------------
/eng/templates/test.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | - name: testAssembly
3 | type: string
4 | default: ''
5 | - name: artifactName
6 | type: string
7 | default: ''
8 |
9 | steps:
10 | - task: DownloadPipelineArtifact@2
11 | displayName: 'Download Tests Artifact'
12 | inputs:
13 | artifactName: '${{ parameters.artifactName }}'
14 | targetPath: '$(System.DefaultWorkingDirectory)/tests'
15 |
16 | - bash: |
17 | echo "Listing downloaded test DLLs:"
18 | find "$(System.DefaultWorkingDirectory)/tests" -name '*Test*.dll'
19 | displayName: 'List Test DLLs'
20 |
21 | # Install Azurite
22 | - bash: |
23 | echo "Installing azurite"
24 | npm install -g azurite
25 | mkdir azurite1
26 | echo "azurite installed"
27 | azurite --silent --location azurite1 --debug azurite1\debug.txt --queuePort 10001 &
28 | echo "azurite started"
29 | sleep 5
30 | displayName: 'Install and Run Azurite'
31 |
32 | # Run tests
33 | - task: VSTest@2
34 | displayName: 'Run tests'
35 | inputs:
36 | testAssemblyVer2: |
37 | $(System.DefaultWorkingDirectory)/${{ parameters.testAssembly }}
38 | testFiltercriteria: 'TestCategory!=DisabledInCI'
39 | vsTestVersion: 17.0
40 | distributionBatchType: basedOnExecutionTime
41 | platform: 'any cpu'
42 | configuration: 'Debug'
43 | diagnosticsEnabled: True
44 | collectDumpOn: always
45 | rerunFailedTests: true
46 | rerunFailedThreshold: 30
47 | rerunMaxAttempts: 3
48 | runInParallel: true
--------------------------------------------------------------------------------
/logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/logo.png
--------------------------------------------------------------------------------
/samples/Correlation.Samples/CorrelatedExceptionExtensions.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace Correlation.Samples
15 | {
16 | using System;
17 | using System.Collections.Generic;
18 | using System.Text;
19 | using DurableTask.Core;
20 | using Microsoft.ApplicationInsights.DataContracts;
21 |
22 | public static class CorrelatedExceptionExtensions
23 | {
24 | public static ExceptionTelemetry CreateExceptionTelemetry(this CorrelatedExceptionDetails e)
25 | {
26 | var exceptionTelemetry = new ExceptionTelemetry(e.Exception);
27 | exceptionTelemetry.Context.Operation.Id = e.OperationId;
28 | exceptionTelemetry.Context.Operation.ParentId = e.ParentId;
29 | return exceptionTelemetry;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/samples/Correlation.Samples/Correlation.Samples.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | netcoreapp3.1
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | Always
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/samples/Correlation.Samples/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "Correlation.Samples": {
4 | "commandName": "Project",
5 | "environmentVariables": {
6 | "CorrelationProtocol": "W3C"
7 | }
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/samples/Correlation.Samples/Readme.md:
--------------------------------------------------------------------------------
1 | # Distributed Tracing for Durable Task
2 |
3 | Distributed Tracing for Durable Task is a feature for enabling correlation propagation among orchestrations and activities.
4 | The key features of Distributed Tracing for Durable Task are:
5 |
6 | - **End to End Tracing with Application Insights**: Support Complex orchestration scenario. Multi-Layered Sub Orchestration, Fan-out Fan-in, retry, Timer, and more.
7 | - **Support Protocol**: [W3C TraceContext](https://w3c.github.io/trace-context/) and [Http Correlation Protocol](https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md)
8 | - **Suppress Distributed Tracing**: No breaking change for the current implementation
9 |
10 | Currently, we support [DurableTask.AzureStorage](https://w3c.github.io/trace-context/).
11 |
12 | 
13 |
14 | # Getting Started
15 |
16 | If you want to try Distributed Tracing with DurableTask.AzureStorage, you can find a document with a Handful of examples.
17 |
18 | - [Intro](docs/getting-started.md)
19 |
20 | # Developing Provider
21 |
22 | If you want to implement Distributed Tracing for other DurableTask providers, Read [Develop Distributed Tracing](docs/overview.md).
--------------------------------------------------------------------------------
/samples/Correlation.Samples/Traceparent.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace Correlation.Samples
15 | {
16 | public class TraceParent
17 | {
18 | public string Version { get; set; }
19 |
20 | public string TraceId { get; set; }
21 |
22 | public string SpanId { get; set; }
23 |
24 | public string TraceFlags { get; set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/samples/Correlation.Samples/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "StorageConnectionString": "UseDevelopmentStorage=true",
3 | "taskHubName":"SamplesHub"
4 | }
--------------------------------------------------------------------------------
/samples/Correlation.Samples/docs/images/class-diagram.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/Correlation.Samples/docs/images/class-diagram.png
--------------------------------------------------------------------------------
/samples/Correlation.Samples/docs/images/end-to-end.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/Correlation.Samples/docs/images/end-to-end.png
--------------------------------------------------------------------------------
/samples/Correlation.Samples/docs/images/overview.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/Correlation.Samples/docs/images/overview.png
--------------------------------------------------------------------------------
/samples/Correlation.Samples/docs/images/search.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/Correlation.Samples/docs/images/search.png
--------------------------------------------------------------------------------
/samples/Correlation.Samples/docs/images/telemetry-tracking.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/Correlation.Samples/docs/images/telemetry-tracking.png
--------------------------------------------------------------------------------
/samples/DistributedTraceSample/ApplicationInsights/ApplicationInsightsSample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | enable
7 | d4d9b2e3-fb2a-4de6-9747-3d6d3b639d1a
8 | dummy-value
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/samples/DistributedTraceSample/ApplicationInsights/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "ApplicationInsightsSample": {
4 | "commandName": "Project",
5 | "environmentVariables": {
6 | "DOTNET_ENVIRONMENT": "Development"
7 | }
8 | }
9 | }
10 | }
--------------------------------------------------------------------------------
/samples/DistributedTraceSample/ApplicationInsights/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "TaskHub": {
3 | "Name": "appinsightssample",
4 | "ErrorPropagationMode": "UseFailureDetails",
5 | "CreateIfNotExists": true,
6 | "IncludeDetails": "All"
7 | }
8 | }
--------------------------------------------------------------------------------
/samples/DistributedTraceSample/OpenTelemetry/OpenTelemetrySample.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/samples/DistributedTraceSample/OpenTelemetry/images/ApplicationInsightsExporter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/DistributedTraceSample/OpenTelemetry/images/ApplicationInsightsExporter.png
--------------------------------------------------------------------------------
/samples/DistributedTraceSample/OpenTelemetry/images/ConsoleExporter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/DistributedTraceSample/OpenTelemetry/images/ConsoleExporter.png
--------------------------------------------------------------------------------
/samples/DistributedTraceSample/OpenTelemetry/images/ZipkinExporter.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/samples/DistributedTraceSample/OpenTelemetry/images/ZipkinExporter.png
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/AverageCalculator/ComputeSumTask.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.AverageCalculator
15 | {
16 | using System;
17 | using DurableTask.Core;
18 |
19 | public sealed class ComputeSumTask : TaskActivity
20 | {
21 | protected override int Execute(DurableTask.Core.TaskContext context, int[] chunk)
22 | {
23 | if (chunk == null || chunk.Length != 2)
24 | {
25 | throw new ArgumentException("chunk");
26 | }
27 |
28 | Console.WriteLine("Compute Sum for " + chunk[0] + "," + chunk[1]);
29 | var sum = 0;
30 | int start = chunk[0];
31 | int end = chunk[1];
32 | for (int i = start; i <= end; i++)
33 | {
34 | sum += i;
35 | }
36 |
37 | Console.WriteLine("Total Sum for Chunk '" + chunk[0] + "," + chunk[1] + "' is " + sum.ToString());
38 |
39 | return sum;
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Cron/CronTask.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Cron
15 | {
16 | using System;
17 | using System.Threading;
18 | using DurableTask.Core;
19 |
20 | public sealed class CronTask : TaskActivity
21 | {
22 | protected override string Execute(DurableTask.Core.TaskContext context, string input)
23 | {
24 | Console.WriteLine($"Executing Cron Job. Started At: '{DateTime.Now}' Number: {input}");
25 |
26 | Thread.Sleep(2 * 1000);
27 |
28 | string completed = $"Cron Job '{input}' Completed...";
29 | Console.WriteLine(completed);
30 |
31 | return completed;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/DurableTask.Samples.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | true
6 | Exe
7 | net462
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | Form
30 |
31 |
32 |
33 |
34 | PreserveNewest
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Greetings/GetUserName.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Greetings
15 | {
16 | using System.Windows.Forms;
17 |
18 | public partial class GetUserName : Form
19 | {
20 | public GetUserName()
21 | {
22 | InitializeComponent();
23 | }
24 |
25 | public string UserName
26 | {
27 | get => this.txtUserName.Text;
28 | set => this.txtUserName.Text = value;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Greetings/GetUserTask.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Greetings
15 | {
16 | using System;
17 | using System.Windows.Forms;
18 | using DurableTask.Core;
19 |
20 | public sealed class GetUserTask : TaskActivity
21 | {
22 | protected override string Execute(DurableTask.Core.TaskContext context, string input)
23 | {
24 | var userNameDialog = new GetUserName();
25 |
26 | Console.WriteLine("Waiting for user to enter name...");
27 |
28 | var user = "";
29 | DialogResult dialogResult = userNameDialog.ShowDialog();
30 | if (dialogResult == DialogResult.OK)
31 | {
32 | user = userNameDialog.UserName;
33 | }
34 |
35 | Console.WriteLine("User Name Entered: " + user);
36 |
37 | return user;
38 | }
39 | }
40 | }
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Greetings/GreetingsOrchestration.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Greetings
15 | {
16 | using System.Threading.Tasks;
17 | using DurableTask.Core;
18 |
19 | public class GreetingsOrchestration : TaskOrchestration
20 | {
21 | public override async Task RunTask(OrchestrationContext context, string input)
22 | {
23 | string user = await context.ScheduleTask(typeof(GetUserTask));
24 | string greeting = await context.ScheduleTask(typeof(SendGreetingTask), user);
25 | return greeting;
26 | }
27 | }
28 | }
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Greetings/SendGreetingTask.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Greetings
15 | {
16 | using System;
17 | using System.Threading;
18 | using DurableTask.Core;
19 |
20 | public sealed class SendGreetingTask : TaskActivity
21 | {
22 | protected override string Execute(DurableTask.Core.TaskContext context, string user)
23 | {
24 | string message;
25 | if (!string.IsNullOrWhiteSpace(user) && user.Equals("TimedOut"))
26 | {
27 | message = "GetUser Timed out!!!";
28 | Console.WriteLine(message);
29 | }
30 | else
31 | {
32 | Console.WriteLine("Sending greetings to user: " + user + "...");
33 |
34 | Thread.Sleep(5 * 1000);
35 |
36 | message = "Greeting sent to " + user;
37 | Console.WriteLine(message);
38 | }
39 |
40 | return message;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Greetings2/GreetingsOrchestration.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Greetings2
15 | {
16 | using System.Threading.Tasks;
17 | using DurableTask.Core;
18 |
19 | public class GreetingsOrchestration2 : TaskOrchestration
20 | {
21 | public override async Task RunTask(OrchestrationContext context, int secondsToWait)
22 | {
23 | Task user = context.ScheduleTask("DurableTaskSamples.Greetings.GetUserTask", string.Empty);
24 | Task timer = context.CreateTimer(context.CurrentUtcDateTime.AddSeconds(secondsToWait), "TimedOut");
25 |
26 | Task u = await Task.WhenAny(user, timer);
27 | string greeting = await context.ScheduleTask("DurableTaskSamples.Greetings.SendGreetingTask", string.Empty, u.Result);
28 |
29 | return greeting;
30 | }
31 | }
32 | }
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "DurableTask.Samples": {
4 | "commandName": "Project",
5 | "commandLineArgs": "-c -s Greetings"
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/Replat/MigrateOrchestrationData.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Replat
15 | {
16 | public class MigrateOrchestrationData
17 | {
18 | public bool IsDisabled { get; set; }
19 |
20 | public string SubscriptionId { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/SumOfSquares/BagofNumbers.json:
--------------------------------------------------------------------------------
1 | [
2 | 2,
3 | 3,
4 | [ 4, 5 ],
5 | 6,
6 | 7,
7 | 8,
8 | [ 9, 10 ],
9 | [
10 | [ 11, 12, 13 ],
11 | 14,
12 | 15,
13 | [ 16, 17, 18 ]
14 | ],
15 | 19,
16 | 20
17 | ]
--------------------------------------------------------------------------------
/samples/DurableTask.Samples/SumOfSquares/SumOfSquaresTask.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.SumOfSquares
15 | {
16 | using System;
17 | using DurableTask.Core;
18 |
19 | public sealed class SumOfSquaresTask : TaskActivity
20 | {
21 | protected override int Execute(DurableTask.Core.TaskContext context, int chunk)
22 | {
23 | Console.WriteLine($"Square::{chunk}::{chunk * chunk}");
24 | return chunk * chunk;
25 | }
26 | }
27 | }
--------------------------------------------------------------------------------
/samples/ManagedIdentitySample/DTFx.AzureStorage v1.x/ManagedIdentity.AzStorageV1.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Latest
5 | enable
6 | Exe
7 | net6.0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/samples/ManagedIdentitySample/DTFx.AzureStorage v1.x/ReadMe.md:
--------------------------------------------------------------------------------
1 | # Token Credential Sample
2 |
3 | This sample demonstrates how to configure a Identity based connection when using DurableTask.AzureStorage v1.x as the orchestration provider for a Durable Task project.
4 |
5 | > Note:
6 | > Identity based connection **is not supported** with .NET framework 4.x with DurableTask.AzureStorage v1.x
7 |
8 | ## Configuration Prerequisites
9 |
10 | Before running this sample, you must
11 |
12 | 1. Create a new Azure Storage account or reuse an existing one
13 | 2. Create your identity in the Azure Portal. Detailed instructions can be found [here](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=certificate)
14 | 3. Assign Role-based Access Controls (RBAC) of the storage account created in step 1 to the identity created in step 2 with [these instructions](https://learn.microsoft.com/azure/role-based-access-control/role-assignments-portal-managed-identity#Overview).
15 | * Storage Queue Data Contributor
16 | * Storage Blob Data Contributor
17 | * Storage Table Data Contributor
18 | 4. Add the identity required information to your app's configuration.
19 | 5. Set `AccountName` to the name of the storage account. AccountName can be replaced with Storage Account BlobServiceUri, TableServiceUri and QueueServiceUri.
20 |
--------------------------------------------------------------------------------
/samples/ManagedIdentitySample/DTFx.AzureStorage v2.x/ManagedIdentity.AzStorageV2.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Latest
5 | enable
6 | Exe
7 | net8.0
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/samples/ManagedIdentitySample/DTFx.AzureStorage v2.x/ReadMe.md:
--------------------------------------------------------------------------------
1 | # Token Credential Sample
2 |
3 | This sample demonstrates how to configure a Identity based connection when using DurableTask.AzureStorage v2.x as the orchestration provider for a Durable Task project.
4 |
5 | ## Configuration Prerequisites
6 |
7 | Before running this sample, you must
8 |
9 | 1. Create a new Azure Storage account or reuse an existing one
10 | 2. Create your identity in the Azure Portal. Detailed instructions can be found [here](https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-register-app?tabs=certificate)
11 | 3. Assign Role-based Access Controls (RBAC) of the storage account created in step 1 to the identity created in step 2 with [these instructions](https://learn.microsoft.com/azure/role-based-access-control/role-assignments-portal-managed-identity#Overview).
12 | * Storage Queue Data Contributor
13 | * Storage Blob Data Contributor
14 | * Storage Table Data Contributor
15 | 4. Add the identity information to your app or configuration. In the sample here, client secret credential requires clientId, clientSecret and tenantId.
16 | 5. Set `AccountName` to the name of the storage account. AccountName can be replaced with Storage Account BlobServiceUri, TableServiceUri and QueueServiceUri.
17 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System.Runtime.CompilerServices;
15 | using System.Runtime.InteropServices;
16 |
17 | [assembly: ComVisible(false)]
18 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2237:MarkISerializableTypesWithSerializable", Scope = "type", Target = "DurableTask.AzureServiceFabric.Exceptions.RemoteServiceException")]
19 | #if !SIGN_ASSEMBLY
20 | [assembly: InternalsVisibleTo("DurableTask.AzureServiceFabric.Tests")]
21 | #endif
22 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/ExceptionUtilities.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric
15 | {
16 | using System;
17 | using System.Fabric;
18 |
19 | using DurableTask.AzureServiceFabric.Tracing;
20 |
21 | static class ExceptionUtilities
22 | {
23 | public static bool IsRetryableFabricException(Exception e)
24 | {
25 | return e is TimeoutException || e is FabricTransientException;
26 | }
27 |
28 | public static void LogReliableCollectionException(string uniqueIdentifier, int attemptNumber, Exception e, bool isTransient)
29 | {
30 | if (isTransient)
31 | {
32 | ServiceFabricProviderEventSource.Tracing.RetryableFabricException(uniqueIdentifier, attemptNumber, e.ToString());
33 | }
34 | else
35 | {
36 | ServiceFabricProviderEventSource.Tracing.ExceptionInReliableCollectionOperations(uniqueIdentifier, e.ToString());
37 | }
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/Exceptions/InvalidInstanceIdException.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.Exceptions
15 | {
16 | using System;
17 |
18 | ///
19 | /// Exception representing that instanceId is not Valid.
20 | ///
21 | [Serializable]
22 | public class InvalidInstanceIdException : Exception
23 | {
24 | ///
25 | /// Creates an instance of
26 | ///
27 | /// Orchestration instance id
28 | public InvalidInstanceIdException(string instanceId)
29 | : base("Not a valid instanceId: " + instanceId)
30 | {
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/Message.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric
15 | {
16 | using System;
17 |
18 | sealed class Message where TKey : IComparable, IEquatable
19 | {
20 | public Message(TKey key, TValue value)
21 | {
22 | if (key == null)
23 | {
24 | throw new ArgumentNullException(nameof(key));
25 | }
26 |
27 | if (value == null)
28 | {
29 | throw new ArgumentNullException(nameof(value));
30 | }
31 |
32 | Key = key;
33 | Value = value;
34 | }
35 |
36 | public TKey Key { get; private set; }
37 |
38 | public TValue Value { get; private set; }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/OrchestrationStatusExtensions.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric
15 | {
16 | using DurableTask.Core;
17 |
18 | static class OrchestrationStatusExtensions
19 | {
20 | public static bool IsTerminalState(this OrchestrationStatus status)
21 | {
22 | return !status.IsRunningOrPending();
23 | }
24 |
25 | public static bool IsRunningOrPending(this OrchestrationStatus status)
26 | {
27 | return status == OrchestrationStatus.Pending || status == OrchestrationStatus.Running;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/Remote/CreateTaskOrchestrationParameters.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.Models
15 | {
16 | using DurableTask.Core;
17 |
18 | ///
19 | /// Task orchestration creation parameters.
20 | ///
21 | public class CreateTaskOrchestrationParameters
22 | {
23 | ///
24 | /// Task message representing task orchestration.
25 | ///
26 | public TaskMessage TaskMessage { get; set; }
27 |
28 | ///
29 | /// States of previous orchestration executions to be considered while de-duping new orchestrations on the client.
30 | ///
31 | public OrchestrationStatus[] DedupeStatuses { get; set; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/Remote/IPartitionHashing.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.Remote
15 | {
16 | using System.Threading;
17 | using System.Threading.Tasks;
18 |
19 | ///
20 | /// provides long hash code to identify which partition value belongs to.
21 | ///
22 | /// Element type
23 | public interface IPartitionHashing
24 | {
25 | ///
26 | /// Gets Long hash code.
27 | ///
28 | /// Input element
29 | /// Token to inform when a task is cancelled.
30 | /// 64 bit hash code
31 | Task GeneratePartitionHashCodeAsync(T value, CancellationToken cancellationToken);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/Remote/PurgeOrchestrationHistoryParameters.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.Models
15 | {
16 | using System;
17 | using DurableTask.Core;
18 |
19 | ///
20 | /// Purging orchestration history parameters.
21 | ///
22 | public class PurgeOrchestrationHistoryParameters
23 | {
24 | ///
25 | /// Starting date time for purging orchestrations.
26 | ///
27 | public DateTime ThresholdDateTimeUtc { get; set; }
28 |
29 | ///
30 | /// Orchestration start time range filter type.
31 | ///
32 | public OrchestrationStateTimeRangeFilterType TimeRangeFilterType { get; set; }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/Service/IOwinAppBuilder.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.Service
15 | {
16 | using Owin;
17 |
18 | ///
19 | /// Owin application startup interface.
20 | ///
21 | public interface IOwinAppBuilder
22 | {
23 | ///
24 | /// Gets the listening Address.
25 | ///
26 | ///
27 | string GetListeningAddress();
28 |
29 |
30 | ///
31 | /// Starts up an Owin App.
32 | ///
33 | /// an instance of
34 | void Startup(IAppBuilder appBuilder);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/Service/ProxyServiceExceptionLogger.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.Service
15 | {
16 | using System;
17 | using System.Threading;
18 | using System.Threading.Tasks;
19 | using System.Web.Http.ExceptionHandling;
20 |
21 | using DurableTask.AzureServiceFabric.Tracing;
22 |
23 | ///
24 | /// Traces application exceptions.
25 | ///
26 | public class ProxyServiceExceptionLogger : ExceptionLogger
27 | {
28 | ///
29 | public async override Task LogAsync(ExceptionLoggerContext context, CancellationToken cancellationToken)
30 | {
31 | var activityId = Guid.NewGuid().ToString("D");
32 | ServiceFabricProviderEventSource.Tracing.LogProxyServiceError(activityId, context.Request.Method.ToString(), context.Request.RequestUri.AbsolutePath, context.Exception);
33 | await base.LogAsync(context, cancellationToken);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/TaskHelpers/CountBasedFixedDelayRetryPolicy.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.TaskHelpers
15 | {
16 | using System;
17 |
18 | class CountBasedFixedDelayRetryPolicy : IRetryPolicy
19 | {
20 | readonly TimeSpan delay;
21 | int pendingAttempts;
22 |
23 | public CountBasedFixedDelayRetryPolicy(int maxNumberOfAttempts, TimeSpan delay)
24 | {
25 | this.delay = delay;
26 | this.pendingAttempts = maxNumberOfAttempts;
27 | }
28 |
29 | public bool ShouldExecute()
30 | {
31 | return this.pendingAttempts-- > 0;
32 | }
33 |
34 | public TimeSpan GetNextDelay()
35 | {
36 | return this.pendingAttempts < 1 ? TimeSpan.Zero : this.delay;
37 | }
38 |
39 | public static IRetryPolicy GetNewDefaultPolicy()
40 | {
41 | return new CountBasedFixedDelayRetryPolicy(3, TimeSpan.FromMilliseconds(100));
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/TaskHelpers/RetryPolicy.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.TaskHelpers
15 | {
16 | using System;
17 |
18 | interface IRetryPolicy
19 | {
20 | bool ShouldExecute();
21 |
22 | TimeSpan GetNextDelay();
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureServiceFabric/TaskMessageItem.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric
15 | {
16 | using System;
17 | using System.Runtime.Serialization;
18 | using DurableTask.Core;
19 |
20 | [DataContract]
21 | sealed class TaskMessageItem : IExtensibleDataObject
22 | {
23 | public TaskMessageItem(TaskMessage taskMessage)
24 | {
25 | this.TaskMessage = taskMessage ?? throw new ArgumentNullException(nameof(taskMessage));
26 | }
27 |
28 | [DataMember]
29 | public TaskMessage TaskMessage { get; private set; }
30 |
31 | public ExtensionDataObject ExtensionData { get; set; }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System.Runtime.CompilerServices;
15 |
16 | #if !SIGN_ASSEMBLY
17 | [assembly: InternalsVisibleTo("DurableTask.AzureStorage.Tests")]
18 | [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")]
19 | #endif
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/DurableStatusQueryResult.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System;
15 | using System.Collections.Generic;
16 | using System.Text;
17 | using DurableTask.Core;
18 |
19 | namespace DurableTask.AzureStorage
20 | {
21 | ///
22 | /// DurableStatusQueryResult is a result object for OrchestrationInstanceStatusQuery
23 | ///
24 | public class DurableStatusQueryResult
25 | {
26 | ///
27 | /// OrchestrationInstances
28 | ///
29 | public IEnumerable OrchestrationState { get; set; }
30 |
31 | ///
32 | /// ContinuationToken
33 | ///
34 | public string ContinuationToken { get; set; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Messaging/ActivitySession.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureStorage.Messaging
15 | {
16 | using System;
17 |
18 | class ActivitySession : SessionBase
19 | {
20 | readonly int orchestrationEpisode;
21 |
22 | public ActivitySession(
23 | AzureStorageOrchestrationServiceSettings settings,
24 | string storageAccountName,
25 | MessageData message,
26 | Guid traceActivityId)
27 | : base(settings, storageAccountName, message.TaskMessage.OrchestrationInstance, traceActivityId)
28 | {
29 | this.MessageData = message ?? throw new ArgumentNullException(nameof(message));
30 | this.orchestrationEpisode = message.Episode ?? -1;
31 | }
32 |
33 | public MessageData MessageData { get; }
34 |
35 | public override int GetCurrentEpisode()
36 | {
37 | return this.orchestrationEpisode;
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Monitoring/ScaleAction.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace DurableTask.AzureStorage.Monitoring
8 | {
9 | ///
10 | /// Possible scale actions for durable task hub.
11 | ///
12 | public enum ScaleAction
13 | {
14 | ///
15 | /// Do not add or remove workers.
16 | ///
17 | None = 0,
18 |
19 | ///
20 | /// Add workers to the current task hub.
21 | ///
22 | AddWorker,
23 |
24 | ///
25 | /// Remove workers from the current task hub.
26 | ///
27 | RemoveWorker
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Partitioning/CloseReason.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureStorage.Partitioning
15 | {
16 | /// Enumerates the reason for closing of session.
17 | enum CloseReason
18 | {
19 | /// Specifies that the server is shutting down.
20 | Shutdown,
21 |
22 | /// Specifies that the current lease has been lost.
23 | LeaseLost
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Partitioning/IPartitionManager.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureStorage.Partitioning
15 | {
16 | using System.Collections.Generic;
17 | using System.Threading;
18 | using System.Threading.Tasks;
19 |
20 | interface IPartitionManager
21 | {
22 | Task StartAsync();
23 |
24 | Task StopAsync();
25 |
26 | Task CreateLeaseStore();
27 |
28 | Task CreateLease(string leaseName);
29 |
30 | Task DeleteLeases();
31 |
32 | IAsyncEnumerable GetOwnershipBlobLeasesAsync(CancellationToken cancellationToken = default);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Partitioning/TaskHubInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureStorage.Partitioning
15 | {
16 | using System;
17 |
18 | class TaskHubInfo
19 | {
20 | public TaskHubInfo(string TaskHubName, DateTime createdAt, int partitionCount)
21 | {
22 | this.TaskHubName = TaskHubName;
23 | this.CreatedAt = createdAt;
24 | this.PartitionCount = partitionCount;
25 | }
26 |
27 | public string TaskHubName { get; private set; }
28 | public DateTime CreatedAt { get; private set; }
29 | public int PartitionCount { get; private set; }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Storage/OperationContext.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.AzureStorage.Storage
15 | {
16 | using System;
17 | using Azure.Core.Pipeline;
18 |
19 | static class OperationContext
20 | {
21 | public static IDisposable CreateClientRequestScope(Guid? clientRequestId = null)
22 | {
23 | clientRequestId ??= Guid.NewGuid();
24 | return HttpPipeline.CreateClientRequestIdScope(clientRequestId.ToString());
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Storage/TableQueryResults.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.AzureStorage.Storage
15 | {
16 | using System;
17 | using System.Collections.Generic;
18 |
19 | sealed class TableQueryResults
20 | {
21 | public TableQueryResults(IReadOnlyList entities, TimeSpan elapsed, int requestCount)
22 | {
23 | this.Entities = entities ?? throw new ArgumentNullException(nameof(entities));
24 | this.Elapsed = elapsed;
25 | this.RequestCount = requestCount;
26 | }
27 |
28 | public IReadOnlyList Entities { get; }
29 |
30 | public TimeSpan Elapsed { get; }
31 |
32 | public int ElapsedMilliseconds => (int)this.Elapsed.TotalMilliseconds;
33 |
34 | public int RequestCount { get; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Storage/TableTransactionResults.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.AzureStorage.Storage
15 | {
16 | using System;
17 | using System.Collections.Generic;
18 | using Azure;
19 |
20 | sealed class TableTransactionResults
21 | {
22 | public TableTransactionResults(IReadOnlyList responses, TimeSpan elapsed, int requestCount = 1)
23 | {
24 | this.Responses = responses ?? throw new ArgumentNullException(nameof(responses));
25 | this.Elapsed = elapsed;
26 | this.RequestCount = requestCount;
27 | }
28 |
29 | public IReadOnlyList Responses { get; }
30 |
31 | public TimeSpan Elapsed { get; }
32 |
33 | public int ElapsedMilliseconds => (int)this.Elapsed.TotalMilliseconds;
34 |
35 | public int RequestCount { get; }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Tracking/InstanceStatus.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System;
15 | using Azure;
16 | using DurableTask.Core;
17 |
18 | namespace DurableTask.AzureStorage.Tracking
19 | {
20 | class InstanceStatus
21 | {
22 | public InstanceStatus(OrchestrationState state)
23 | : this(state, null)
24 | { }
25 |
26 | public InstanceStatus(OrchestrationState state, ETag? eTag)
27 | {
28 | this.State = state ?? throw new ArgumentNullException(nameof(state));
29 | this.ETag = eTag ?? ETag.All;
30 | }
31 |
32 | public OrchestrationState State { get; }
33 |
34 | public ETag ETag { get; }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/src/DurableTask.AzureStorage/Tracking/TagsSerializer.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System.Collections.Generic;
15 | using Newtonsoft.Json;
16 |
17 | namespace DurableTask.AzureStorage.Tracking
18 | {
19 | internal static class TagsSerializer
20 | {
21 | public static string Serialize(IDictionary tags)
22 | => JsonConvert.SerializeObject(tags);
23 |
24 | public static IDictionary Deserialize(string tags)
25 | => JsonConvert.DeserializeObject>(tags);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/ActivityExecutionResult.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core
15 | {
16 | using DurableTask.Core.History;
17 |
18 | ///
19 | /// The result of an activity execution.
20 | ///
21 | public class ActivityExecutionResult
22 | {
23 | ///
24 | /// This history event associated with the activity execution result.
25 | /// This is expected to be or .
26 | ///
27 | public HistoryEvent? ResponseEvent { get; set; }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System.Runtime.CompilerServices;
15 |
16 | #if !SIGN_ASSEMBLY
17 | [assembly: InternalsVisibleTo("DurableTask.Core.Tests")]
18 | [assembly: InternalsVisibleTo("DurableTask.Framework.Tests")]
19 | [assembly: InternalsVisibleTo("DurableTask.ServiceBus.Tests")]
20 | #endif
21 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Command/CreateTimerOrchestratorAction.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Command
15 | {
16 | using System;
17 |
18 | ///
19 | /// Orchestrator action for creating durable timers.
20 | ///
21 | public class CreateTimerOrchestratorAction : OrchestratorAction
22 | {
23 | // NOTE: Actions must be serializable by a variety of different serializer types to support out-of-process execution.
24 | // To ensure maximum compatibility, all properties should be public and settable by default.
25 |
26 | ///
27 | public override OrchestratorActionType OrchestratorActionType => OrchestratorActionType.CreateTimer;
28 |
29 | ///
30 | /// The time at which the created timer should fire.
31 | ///
32 | public DateTime FireAt { get; set; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Command/OrchestratorAction.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Command
15 | {
16 | using Newtonsoft.Json;
17 |
18 | ///
19 | /// Defines a set of base properties for an orchestrator action.
20 | ///
21 | [JsonConverter(typeof(OrchestrationActionConverter))]
22 | public abstract class OrchestratorAction
23 | {
24 | ///
25 | /// The task ID associated with this orchestrator action.
26 | ///
27 | public int Id { get; set; }
28 |
29 | ///
30 | /// The type of the orchestrator action.
31 | ///
32 | public abstract OrchestratorActionType OrchestratorActionType { get; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Command/OrchestratorActionType.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Command
15 | {
16 | ///
17 | /// Enumeration of orchestrator actions.
18 | ///
19 | public enum OrchestratorActionType
20 | {
21 | ///
22 | /// A new task was scheduled by the orchestrator.
23 | ///
24 | ScheduleOrchestrator,
25 |
26 | ///
27 | /// A sub-orchestration was scheduled by the orchestrator.
28 | ///
29 | CreateSubOrchestration,
30 |
31 | ///
32 | /// A timer was scheduled by the orchestrator.
33 | ///
34 | CreateTimer,
35 |
36 | ///
37 | /// An outgoing external event was scheduled by the orchestrator.
38 | ///
39 | SendEvent,
40 |
41 | ///
42 | /// The orchestrator completed.
43 | ///
44 | OrchestrationComplete,
45 | }
46 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Common/CompressionStyle.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Common
15 | {
16 | ///
17 | /// Compression style
18 | ///
19 | public enum CompressionStyle
20 | {
21 | ///
22 | /// Revert to pre-message compression behavior (not recommended)
23 | ///
24 | Legacy = 0,
25 |
26 | ///
27 | /// Never compress messages
28 | ///
29 | Never,
30 |
31 | ///
32 | /// Always compress messages
33 | ///
34 | Always,
35 |
36 | ///
37 | /// Only compress messages if they are above the threshold
38 | ///
39 | Threshold,
40 | }
41 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Entities/EventFormat/EntityMessage.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Entities.EventFormat
15 | {
16 | using System.Runtime.Serialization;
17 |
18 | ///
19 | /// The format of entity messages is kept json-deserialization-compatible with the original format.
20 | ///
21 | [DataContract]
22 | internal abstract class EntityMessage
23 | {
24 | public abstract string GetShortDescription();
25 |
26 | public override string ToString() => this.GetShortDescription();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Entities/EventFormat/EntityMessageEventNames.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Entities.EventFormat
15 | {
16 | using System;
17 |
18 | ///
19 | /// Determines event names to use for messages sent to and from entities.
20 | ///
21 | internal static class EntityMessageEventNames
22 | {
23 | public static string RequestMessageEventName => "op";
24 |
25 | public static string ReleaseMessageEventName => "release";
26 |
27 | public static string ContinueMessageEventName => "continue";
28 |
29 | public static string ScheduledRequestMessageEventName(DateTime scheduledUtc) => $"op@{scheduledUtc:o}";
30 |
31 | public static string ResponseMessageEventName(Guid requestId) => requestId.ToString();
32 |
33 | public static bool IsRequestMessage(string eventName) => eventName.StartsWith("op");
34 |
35 | public static bool IsReleaseMessage(string eventName) => eventName == "release";
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Entities/EventFormat/ReleaseMessage.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Entities.EventFormat
15 | {
16 | using System.Runtime.Serialization;
17 |
18 | [DataContract]
19 | internal class ReleaseMessage : EntityMessage
20 | {
21 | [DataMember(Name = "parent")]
22 | public string? ParentInstanceId { get; set; }
23 |
24 | [DataMember(Name = "id")]
25 | public string? Id { get; set; }
26 |
27 | public override string GetShortDescription()
28 | {
29 | return $"[Release lock {Id} by {ParentInstanceId}]";
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Entities/OperationFormat/OperationAction.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Entities.OperationFormat
15 | {
16 | using Newtonsoft.Json;
17 |
18 | ///
19 | /// Defines a set of base properties for an operator action.
20 | ///
21 | [JsonConverter(typeof(OperationActionConverter))]
22 | public abstract class OperationAction
23 | {
24 | ///
25 | /// The type of the orchestrator action.
26 | ///
27 | public abstract OperationActionType OperationActionType { get; }
28 | }
29 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Entities/OperationFormat/OperationActionType.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Entities.OperationFormat
15 | {
16 | ///
17 | /// Enumeration of entity operation actions.
18 | ///
19 | public enum OperationActionType
20 | {
21 | ///
22 | /// A signal was sent to an entity
23 | ///
24 | SendSignal,
25 |
26 | ///
27 | /// A new fire-and-forget orchestration was started
28 | ///
29 | StartNewOrchestration,
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Entities/Serializer.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.Core.Entities
15 | {
16 | using Newtonsoft.Json;
17 |
18 | internal static class Serializer
19 | {
20 | ///
21 | /// This serializer is used exclusively for internally defined data structures and cannot be customized by user.
22 | /// This is intentional, to avoid problems caused by our unability to control the exact format.
23 | /// For example, including typenames can cause compatibility problems if the type name is later changed.
24 | ///
25 | public static JsonSerializer InternalSerializer = JsonSerializer.Create(InternalSerializerSettings);
26 |
27 | public static JsonSerializerSettings InternalSerializerSettings
28 | = new JsonSerializerSettings() { TypeNameHandling = TypeNameHandling.None };
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Entities/TaskEntity.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | #nullable enable
15 | namespace DurableTask.Core.Entities
16 | {
17 | using System.Threading.Tasks;
18 | using DurableTask.Core.Entities.OperationFormat;
19 |
20 | ///
21 | /// Abstract base class for entities.
22 | ///
23 | public abstract class TaskEntity
24 | {
25 | ///
26 | /// Execute a batch of operations on an entity.
27 | ///
28 | public abstract Task ExecuteOperationBatchAsync(EntityBatchRequest operations);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/EventHandlingOnContinueAsNew.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// Specifies Behavior to be followed when dealing with unprocessed EventRaisedEvents when an orchestration continues as new
18 | ///
19 | public enum BehaviorOnContinueAsNew
20 | {
21 | ///
22 | /// All pending EventRaisedEvents will be ignored
23 | ///
24 | Ignore,
25 |
26 | ///
27 | ///
28 | ///
29 | Carryover,
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/FilterComparisonType.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// The kind of comparison to be performed in the State Filter.
18 | ///
19 | public enum FilterComparisonType
20 | {
21 | ///
22 | /// Equality Comparison
23 | ///
24 | Equals = 0,
25 |
26 | ///
27 | /// In-Equality Comparison
28 | ///
29 | NotEquals = 1
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/History/ContinueAsNewEvent.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.History
15 | {
16 | using System.Runtime.Serialization;
17 |
18 | ///
19 | /// A history event for continue-as-new
20 | ///
21 | [DataContract]
22 | public class ContinueAsNewEvent : ExecutionCompletedEvent
23 | {
24 | ///
25 | /// Creates a new ExecutionStartedEvent with the supplied parameters
26 | ///
27 | /// The event id of the history event
28 | /// The serialized orchestration input
29 | public ContinueAsNewEvent(int eventId, string input)
30 | : base(eventId, input, OrchestrationStatus.ContinuedAsNew)
31 | {
32 | }
33 |
34 | ///
35 | /// Gets the event type
36 | ///
37 | public override EventType EventType => EventType.ContinueAsNew;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/History/OrchestratorCompletedEvent.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.History
15 | {
16 | using System.Runtime.Serialization;
17 |
18 | ///
19 | /// A history event for orchestrator completed
20 | ///
21 | [DataContract]
22 | public class OrchestratorCompletedEvent : HistoryEvent
23 | {
24 | ///
25 | /// Creates a new with the supplied parameters
26 | ///
27 | /// The event id of the history event
28 | public OrchestratorCompletedEvent(int eventId)
29 | : base(eventId)
30 | {
31 | }
32 |
33 | ///
34 | /// Gets the event type
35 | ///
36 | public override EventType EventType => EventType.OrchestratorCompleted;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/History/OrchestratorStartedEvent.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.History
15 | {
16 | using System.Runtime.Serialization;
17 |
18 | ///
19 | /// A history event for orchestrator started
20 | ///
21 | [DataContract]
22 | public class OrchestratorStartedEvent : HistoryEvent
23 | {
24 | ///
25 | /// Creates a new with the supplied parameters
26 | ///
27 | /// The event id of the history event
28 | public OrchestratorStartedEvent(int eventId)
29 | : base(eventId)
30 | {
31 | }
32 |
33 | ///
34 | /// Gets the event type
35 | ///
36 | public override EventType EventType => EventType.OrchestratorStarted;
37 | }
38 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/INameVersionInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// Interface for name and version class to be used in lookup mappings
18 | ///
19 | public interface INameVersionInfo
20 | {
21 | ///
22 | /// The name of the method
23 | ///
24 | string Name { get; }
25 |
26 | ///
27 | /// The version of the method
28 | ///
29 | string Version { get; }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/IOrchestrationSession.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System.Collections.Generic;
17 | using System.Threading.Tasks;
18 |
19 | ///
20 | /// Interface allowing providers to implement extended sessions (aka "sticky sessions").
21 | ///
22 | public interface IOrchestrationSession
23 | {
24 | ///
25 | /// When implemented, fetches a new batch of messages for a particular work item.
26 | ///
27 | ///
28 | /// Implementors of this method should feel free to block until new messages are available,
29 | /// or until an internal wait period has expired. In either case, null can be returned
30 | /// and the dispatcher will shut down the session.
31 | ///
32 | Task> FetchNewOrchestrationMessagesAsync(TaskOrchestrationWorkItem workItem);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Logging/IEventSourceEvent.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Logging
15 | {
16 | ///
17 | /// Interface for all log messages that are written to the an event source tracer.
18 | ///
19 | public interface IEventSourceEvent
20 | {
21 | ///
22 | /// Writes the event to the event source log.
23 | ///
24 | void WriteEventSource();
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Logging/ILogEvent.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Logging
15 | {
16 | using Microsoft.Extensions.Logging;
17 |
18 | ///
19 | /// Basic interface that defines the basic requirements for all DurableTask
20 | /// log messages for compatibility.
21 | ///
22 | public interface ILogEvent
23 | {
24 | ///
25 | /// The ID of the log event. This must match one of the values in .
26 | ///
27 | EventId EventId { get; }
28 |
29 | ///
30 | /// The level of the log event.
31 | ///
32 | LogLevel Level { get; }
33 |
34 | ///
35 | /// Gets the message to write to the infrastructure.
36 | /// This method will not be called if the corresponding event is filtered out.
37 | ///
38 | string FormattedMessage { get; }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Middleware/DispatchMiddlewareDelegate.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Middleware
15 | {
16 | using System.Threading.Tasks;
17 |
18 | ///
19 | /// A function that runs in the task execution middleware pipeline.
20 | ///
21 | /// The for the task execution.
22 | /// A task that represents the completion of the durable task execution.
23 | public delegate Task DispatchMiddlewareDelegate(DispatchMiddlewareContext context);
24 | }
25 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/ObjectCreator.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// Abstract class for object creation based on name and version
18 | ///
19 | /// The type to create
20 | public abstract class ObjectCreator : INameVersionInfo
21 | {
22 | ///
23 | /// The name of the method
24 | ///
25 | public string Name { get; protected set; }
26 |
27 | ///
28 | /// The version of the method
29 | ///
30 | public string Version { get; protected set; }
31 |
32 | ///
33 | /// Instance creator method
34 | ///
35 | /// An instance of the type T
36 | public abstract T Create();
37 | }
38 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/OrchestrationExecutionContext.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | namespace DurableTask.Core
14 | {
15 | using System.Collections.Generic;
16 | using System.Runtime.Serialization;
17 |
18 | ///
19 | /// Context associated with the orchestration being executed.
20 | ///
21 | [DataContract]
22 | public class OrchestrationExecutionContext
23 | {
24 | ///
25 | /// Gets the orchestration tags
26 | ///
27 | [DataMember]
28 | public IDictionary OrchestrationTags { get; internal set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/OrchestrationStateNameVersionFilter.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// Filter for Orchestration Name and Version
18 | ///
19 | public class OrchestrationStateNameVersionFilter : OrchestrationStateQueryFilter
20 | {
21 | ///
22 | /// Gets or sets the orchestration Name for the filter
23 | ///
24 | public string Name { get; set; }
25 |
26 | ///
27 | /// Gets or sets the orchestration Version for the filter
28 | ///
29 | public string Version { get; set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/OrchestrationStateQueryFilter.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// Abstract class for an orchestration state query filter
18 | ///
19 | public abstract class OrchestrationStateQueryFilter
20 | {
21 | }
22 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/OrchestrationStateQuerySegment.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System.Collections.Generic;
17 |
18 | ///
19 | /// Partial query results for an orchestration state query
20 | ///
21 | public class OrchestrationStateQuerySegment
22 | {
23 | ///
24 | /// The continuation token to obtain more results
25 | ///
26 | public string ContinuationToken;
27 |
28 | ///
29 | /// The results for the partial query
30 | ///
31 | public IEnumerable Results;
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/OrchestrationStateStatusFilter.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// Filter for Orchestration Status
18 | ///
19 | public class OrchestrationStateStatusFilter : OrchestrationStateQueryFilter
20 | {
21 | ///
22 | /// Gets or sets the Status for the filter
23 | ///
24 | public OrchestrationStatus Status { get; set; }
25 |
26 | ///
27 | /// Type of comparison to be formed with the state
28 | ///
29 | public FilterComparisonType ComparisonType { get; set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/OrchestrationStateTimeRangeFilter.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System;
17 |
18 | ///
19 | /// Filter for Orchestration State time range on a time range type
20 | ///
21 | public class OrchestrationStateTimeRangeFilter : OrchestrationStateQueryFilter
22 | {
23 | ///
24 | /// Gets or sets the StartTime for the filter
25 | ///
26 | public DateTime StartTime { get; set; }
27 |
28 | ///
29 | /// Gets or sets the EndTime for the filter
30 | ///
31 | public DateTime EndTime { get; set; }
32 |
33 | ///
34 | /// Gets or sets the time range filter type for the filter
35 | ///
36 | public OrchestrationStateTimeRangeFilterType FilterType { get; set; }
37 | }
38 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/OrchestrationStateTimeRangeFilterType.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | ///
17 | /// Enumeration of the types of time filters for orchestration state queries
18 | ///
19 | public enum OrchestrationStateTimeRangeFilterType
20 | {
21 | ///
22 | /// Filter based on creation time
23 | ///
24 | OrchestrationCreatedTimeFilter,
25 |
26 | ///
27 | /// Filter based on completion time
28 | ///
29 | OrchestrationCompletedTimeFilter,
30 |
31 | ///
32 | /// Filter based on last update time
33 | ///
34 | OrchestrationLastUpdatedTimeFilter,
35 | }
36 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Query/IOrchestrationServiceQueryClient.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // ----------------------------------------------------------------------------------
11 |
12 | namespace DurableTask.Core.Query
13 | {
14 | using System.Threading.Tasks;
15 | using System.Threading;
16 |
17 | ///
18 | /// Interface to allow query multi-instance status with filter.
19 | ///
20 | public interface IOrchestrationServiceQueryClient
21 | {
22 | ///
23 | /// Gets the status of all orchestration instances with paging that match the specified conditions.
24 | ///
25 | /// Return orchestration instances that match the specified query.
26 | /// Cancellation token that can be used to cancel the query operation.
27 | /// Returns each page of orchestration status for all instances and continuation token of next page.
28 | Task GetOrchestrationWithQueryAsync(OrchestrationQuery query, CancellationToken cancellationToken);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/ScheduleProxyV2.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System.Reflection;
17 | using Castle.DynamicProxy;
18 |
19 | internal class ScheduleProxyV2 : ScheduleProxy, IInterceptor
20 | {
21 | private readonly string declaringTypeFullName;
22 |
23 | public ScheduleProxyV2(OrchestrationContext context, string declaringTypeFullName)
24 | : base(context)
25 | {
26 | this.declaringTypeFullName = declaringTypeFullName;
27 | }
28 |
29 | protected override string NormalizeMethodName(MethodInfo method)
30 | {
31 | // uses declaring type defined externally because MethodInfo members, such as Method.DeclaringType, could return the base type that the method inherits from
32 | return string.IsNullOrEmpty(this.declaringTypeFullName) ? method.Name : NameVersionHelper.GetFullyQualifiedMethodName(this.declaringTypeFullName, method);
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Settings/CompressionSettings.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Settings
15 | {
16 | using DurableTask.Core.Common;
17 |
18 | ///
19 | /// Compression settings
20 | ///
21 | public struct CompressionSettings
22 | {
23 | ///
24 | /// Type of compression
25 | ///
26 | public CompressionStyle Style { get; set; }
27 |
28 | ///
29 | /// Compression threshold in bytes; if specified by compression criteria, compression will not be done
30 | /// if size is below this value
31 | ///
32 | public int ThresholdInBytes { get; set; }
33 | }
34 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Settings/ISessionSettings.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Settings
15 | {
16 | ///
17 | /// Settings to configure the Service Bus session.
18 | ///
19 | public interface ISessionSettings
20 | {
21 | ///
22 | /// The max allowed session size in service bus. Default is 230K.
23 | ///
24 | int SessionMaxSizeInBytes { get; set; }
25 |
26 | ///
27 | /// The max allowed session size for external storage. Default is 10M.
28 | ///
29 | int SessionOverflowThresholdInBytes { get; set; }
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/StackExtensions.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System.Collections.Generic;
17 | using System.Linq;
18 |
19 | ///
20 | /// Extension methods for Stack
21 | ///
22 | public static class StackExtensions
23 | {
24 | ///
25 | /// Clone the Stack instance with the right order.
26 | ///
27 | /// Type of the Stack
28 | /// Stack instance
29 | ///
30 | public static Stack Clone(this Stack original)
31 | {
32 | return new Stack(original.Reverse());
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/StateMessage.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System;
17 | using System.Runtime.Serialization;
18 |
19 | ///
20 | /// Deprecated Wrapper for the OrchestrationState in the Tracking Queue
21 | ///
22 | [Obsolete("This has been Replaced by a combination of the HistoryStateEvent and TaskMessage")]
23 | [DataContract]
24 | public class StateMessage
25 | {
26 | ///
27 | /// The Orchestration State
28 | ///
29 | [DataMember] public OrchestrationState State;
30 | }
31 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/SynchronousTaskScheduler.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System.Collections.Generic;
17 | using System.Linq;
18 | using System.Threading.Tasks;
19 |
20 | internal class SynchronousTaskScheduler : TaskScheduler
21 | {
22 | public override int MaximumConcurrencyLevel => 1;
23 |
24 | protected override void QueueTask(Task task)
25 | {
26 | TryExecuteTask(task);
27 | }
28 |
29 | protected override bool TryExecuteTaskInline(
30 | Task task,
31 | bool taskWasPreviouslyQueued)
32 | {
33 | return TryExecuteTask(task);
34 | }
35 |
36 | protected override IEnumerable GetScheduledTasks()
37 | {
38 | return Enumerable.Empty();
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/TaskActivityWorkItem.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System;
17 | using System.Diagnostics;
18 |
19 | ///
20 | /// An active instance / work item of a task activity
21 | ///
22 | public class TaskActivityWorkItem
23 | {
24 | ///
25 | /// The Id of the work work item, likely related to the task message
26 | ///
27 | public string Id;
28 |
29 | ///
30 | /// The datetime this work item is locked until
31 | ///
32 | public DateTime LockedUntilUtc;
33 |
34 | ///
35 | /// The task message associated with this work item
36 | ///
37 | public TaskMessage TaskMessage;
38 |
39 | ///
40 | /// The TraceContext which is included on the queue.
41 | ///
42 | public TraceContextBase TraceContextBase;
43 | }
44 | }
--------------------------------------------------------------------------------
/src/DurableTask.Core/Tracing/DistributedTraceActivity.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System;
15 | using System.Diagnostics;
16 | using System.Threading;
17 | using Newtonsoft.Json;
18 |
19 | namespace DurableTask.Core.Tracing
20 | {
21 | ///
22 | /// Manage Activity for orchestration execution.
23 | ///
24 | internal class DistributedTraceActivity
25 | {
26 | private static readonly AsyncLocal CurrentActivity = new AsyncLocal();
27 |
28 | ///
29 | /// Share the Activity across an orchestration execution.
30 | ///
31 | internal static Activity Current
32 | {
33 | get { return CurrentActivity.Value; }
34 | set { CurrentActivity.Value = value; }
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Tracing/TraceActivityConstants.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Tracing
15 | {
16 | internal class TraceActivityConstants
17 | {
18 | public const string Client = "client";
19 | public const string Orchestration = "orchestration";
20 | public const string Activity = "activity";
21 | public const string Event = "event";
22 | public const string Timer = "timer";
23 | public const string Entity = "entity";
24 |
25 | public const string CreateOrchestration = "create_orchestration";
26 | public const string OrchestrationEvent = "orchestration_event";
27 |
28 | public const string CallEntity = "call_entity";
29 | public const string SignalEntity = "signal_entity";
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Tracking/InstanceEntityBase.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Tracking
15 | {
16 | ///
17 | /// Base class for history tracking events
18 | ///
19 | public class InstanceEntityBase
20 | {
21 | ///
22 | /// Sequence number for ordering of messages in history tracking
23 | ///
24 | public long SequenceNumber;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Tracking/OrchestrationJumpStartInstanceEntity.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Tracking
15 | {
16 | using System;
17 |
18 | ///
19 | /// History Entity for orchestration jump start state
20 | ///
21 | public class OrchestrationJumpStartInstanceEntity : InstanceEntityBase
22 | {
23 | ///
24 | /// The start time of the jump start event
25 | ///
26 | public DateTime JumpStartTime;
27 |
28 | ///
29 | /// Orchestration state of the jump start instance
30 | ///
31 | public OrchestrationState State;
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Tracking/OrchestrationStateInstanceEntity.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Tracking
15 | {
16 | ///
17 | /// History Entity for Orchestration State
18 | ///
19 | public class OrchestrationStateInstanceEntity : InstanceEntityBase
20 | {
21 | ///
22 | /// The orchestration state for this instance entity
23 | ///
24 | public OrchestrationState State;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/Tracking/OrchestrationWorkItemInstanceEntity.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Tracking
15 | {
16 | using System;
17 | using DurableTask.Core.History;
18 |
19 | ///
20 | /// History Entity for a Work Item Instance
21 | ///
22 | public class OrchestrationWorkItemInstanceEntity : InstanceEntityBase
23 | {
24 | ///
25 | /// The orchestration instance id
26 | ///
27 | public string InstanceId;
28 |
29 | ///
30 | /// The orchestration execution id
31 | ///
32 | public string ExecutionId;
33 |
34 | ///
35 | /// Timestamp of the instance event
36 | ///
37 | public DateTime EventTimestamp;
38 |
39 | ///
40 | /// History event corresponding to this work item instance entity
41 | ///
42 | public HistoryEvent HistoryEvent;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/src/DurableTask.Core/TrackingWorkItem.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core
15 | {
16 | using System;
17 | using System.Collections.Generic;
18 |
19 | ///
20 | /// An active tracking work item
21 | ///
22 | public class TrackingWorkItem
23 | {
24 | ///
25 | /// The instance id of this tracking work item
26 | ///
27 | public string InstanceId;
28 |
29 | ///
30 | /// The datetime this work item is locked until
31 | ///
32 | public DateTime LockedUntilUtc;
33 |
34 | ///
35 | /// The list of new messages to process tracking for
36 | ///
37 | public IList NewMessages;
38 |
39 | ///
40 | /// The session instance this tracking item is associated with
41 | ///
42 | public object SessionInstance;
43 | }
44 | }
--------------------------------------------------------------------------------
/src/DurableTask.Emulator/DurableTask.Emulator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | netstandard2.0;net462
6 | Microsoft.Azure.DurableTask.Emulator
7 |
8 | NU5125;NU5048
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 | true
18 | content/SBOM
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/src/DurableTask.Emulator/TaskSession.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Emulator
15 | {
16 | using DurableTask.Core;
17 | using System.Collections.Generic;
18 |
19 | internal class TaskSession
20 | {
21 | public string Id;
22 | public byte[] SessionState;
23 | public List Messages;
24 | public HashSet LockTable;
25 |
26 | public TaskSession()
27 | {
28 | this.SessionState = null;
29 | this.Messages = new List();
30 | this.LockTable = new HashSet();
31 | }
32 | }
33 | }
--------------------------------------------------------------------------------
/src/DurableTask.ServiceBus/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System.Runtime.CompilerServices;
15 |
16 | #if !SIGN_ASSEMBLY
17 | [assembly: InternalsVisibleTo("DurableTask.Framework.Tests")]
18 | [assembly: InternalsVisibleTo("DurableTask.ServiceBus.Tests")]
19 | [assembly: InternalsVisibleTo("DurableTask.Stress.Tests")]
20 | #endif
--------------------------------------------------------------------------------
/src/DurableTask.ServiceBus/Common/BrokeredMessageExtensions.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.ServiceBus.Common.Abstraction
15 | {
16 | using System;
17 | using DurableTask.Core.Common;
18 |
19 | ///
20 | /// Extension methods for BrokeredMessage
21 | ///
22 | public static class BrokeredMessageExtensions
23 | {
24 | ///
25 | /// Returns delivery latency of the message
26 | ///
27 | public static double DeliveryLatency(this Message message)
28 | {
29 | if (message == null)
30 | {
31 | return 0;
32 | }
33 |
34 | DateTime actualEnqueueTimeUtc = (!message.ScheduledEnqueueTimeUtc.IsSet()) ? message.SystemProperties.EnqueuedTimeUtc : message.ScheduledEnqueueTimeUtc;
35 | return (DateTime.UtcNow - actualEnqueueTimeUtc).TotalMilliseconds;
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/DurableTask.ServiceBus/ServiceBusOrchestrationSession.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.ServiceBus
15 | {
16 | using System;
17 | using System.Collections.Generic;
18 | using DurableTask.Core;
19 | using DurableTask.ServiceBus.Common.Abstraction;
20 |
21 | internal class ServiceBusOrchestrationSession
22 | {
23 | public IMessageSession Session;
24 | public Dictionary LockTokens;
25 | public long SequenceNumber;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/src/DurableTask.ServiceBus/Settings/ServiceBusMessageSenderSettings.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.ServiceBus.Settings
15 | {
16 | using DurableTask.Core;
17 |
18 | ///
19 | /// Settings to configure the Service Bus message sender
20 | ///
21 | public class ServiceBusMessageSenderSettings
22 | {
23 | internal ServiceBusMessageSenderSettings() :
24 | this(FrameworkConstants.BatchFlushIntervalInMilliSecs)
25 | {
26 | }
27 |
28 | internal ServiceBusMessageSenderSettings(int batchFlushInterval)
29 | {
30 | BatchFlushIntervalInMilliSecs = batchFlushInterval;
31 | }
32 |
33 | ///
34 | /// The sender batch flush interval in milliseconds
35 | ///
36 | // ReSharper disable once IdentifierTypo (avoid breaking change)
37 | public int BatchFlushIntervalInMilliSecs { get; set; }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/test/DurableTask.AzureServiceFabric.Integration.Tests/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/test/DurableTask.AzureServiceFabric.Integration.Tests/Constants.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureServiceFabric.Integration.Tests
15 | {
16 | static class Constants
17 | {
18 | public const string TestFabricApplicationAddress = "fabric:/TestFabricApplicationType/TestStatefulService";
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/test/DurableTask.AzureServiceFabric.Integration.Tests/DurableTask.AzureServiceFabric.Integration.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net462
6 | true
7 | AnyCPU;x64
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/test/DurableTask.AzureServiceFabric.Tests/DurableTask.AzureServiceFabric.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net462
6 | AnyCPU;x64
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/test/DurableTask.AzureStorage.Tests/Correlation/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureStorage.Tests.Correlation
15 | {
16 | using System;
17 |
18 | public static class StringExtensions
19 | {
20 | public static TraceParent ToTraceParent(this string traceParent)
21 | {
22 | if (!string.IsNullOrEmpty(traceParent))
23 | {
24 | var substrings = traceParent.Split('-');
25 | if (substrings.Length != 4)
26 | {
27 | throw new ArgumentException($"Traceparent doesn't respect the spec. {traceParent}");
28 | }
29 |
30 | return new TraceParent
31 | {
32 | Version = substrings[0],
33 | TraceId = substrings[1],
34 | SpanId = substrings[2],
35 | TraceFlags = substrings[3]
36 | };
37 | }
38 |
39 | return null;
40 | }
41 | }
42 |
43 | }
44 |
--------------------------------------------------------------------------------
/test/DurableTask.AzureStorage.Tests/Correlation/Traceparent.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.AzureStorage.Tests.Correlation
15 | {
16 | public class TraceParent
17 | {
18 | public string Version { get; set; }
19 |
20 | public string TraceId { get; set; }
21 |
22 | public string SpanId { get; set; }
23 |
24 | public string TraceFlags { get; set; }
25 | }
26 | }
--------------------------------------------------------------------------------
/test/DurableTask.AzureStorage.Tests/Net/UriPathTests.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 | #nullable enable
14 | namespace DurableTask.AzureStorage.Net
15 | {
16 | using Microsoft.VisualStudio.TestTools.UnitTesting;
17 |
18 | [TestClass]
19 | public class UriPathTests
20 | {
21 | [DataTestMethod]
22 | [DataRow("", "", "")]
23 | [DataRow("", "bar/baz", "bar/baz")]
24 | [DataRow("foo", "", "foo")]
25 | [DataRow("foo", "/", "foo/")]
26 | [DataRow("foo", "bar", "foo/bar")]
27 | [DataRow("foo", "/bar", "foo/bar")]
28 | [DataRow("foo/", "", "foo/")]
29 | [DataRow("foo/", "/", "foo/")]
30 | [DataRow("foo/", "bar", "foo/bar")]
31 | [DataRow("foo/", "/bar", "foo/bar")]
32 | [DataRow("/foo//", "//bar/baz", "/foo///bar/baz")]
33 | public void Combine(string path1, string path2, string expected)
34 | {
35 | Assert.AreEqual(expected, UriPath.Combine(path1, path2));
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/test/DurableTask.AzureStorage.Tests/large.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Azure/durabletask/e3ecb29e6b945e621c07ec8288d5ecaa547edd5b/test/DurableTask.AzureStorage.Tests/large.jpeg
--------------------------------------------------------------------------------
/test/DurableTask.Core.Tests/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | using System.Runtime.CompilerServices;
15 |
16 | [assembly: InternalsVisibleTo("DurableTask.ServiceBus.Tests")]
17 | [assembly: InternalsVisibleTo("DurableTask.Stress.Tests")]
--------------------------------------------------------------------------------
/test/DurableTask.Core.Tests/DurableTask.Core.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net6.0;net462
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/test/DurableTask.Core.Tests/StackExtensionsTest.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Tests
15 | {
16 | using System;
17 | using System.Collections;
18 | using System.Collections.Generic;
19 | using System.Linq;
20 | using System.Text;
21 | using System.Threading.Tasks;
22 | using Microsoft.VisualStudio.TestTools.UnitTesting;
23 |
24 | [TestClass]
25 | public class StackExtensionsTest
26 | {
27 | [TestMethod]
28 | public void CloneStack()
29 | {
30 | var input = new Stack();
31 | input.Push("1");
32 | input.Push("2");
33 | input.Push("3");
34 | var result = input.Clone();
35 | Assert.AreEqual("3", result.Pop());
36 | Assert.AreEqual("2", result.Pop());
37 | Assert.AreEqual("1", result.Pop());
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/test/DurableTask.Core.Tests/TestObjectCreator.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Core.Tests
15 | {
16 | using System;
17 | using DurableTask.Core;
18 |
19 | internal class TestObjectCreator : ObjectCreator
20 | {
21 | readonly Func creator;
22 |
23 | public TestObjectCreator(string name, string version, Func creator)
24 | {
25 | Name = name;
26 | Version = version;
27 | this.creator = creator;
28 | }
29 |
30 | public override T Create()
31 | {
32 | return this.creator();
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/test/DurableTask.Core.Tests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/test/DurableTask.Emulator.Tests/DurableTask.Emulator.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net6.0;net462
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/test/DurableTask.Samples.Tests/DurableTask.Samples.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | net451
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/test/DurableTask.Samples.Tests/MockObjectCreator.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Samples.Tests
15 | {
16 | using System;
17 | using DurableTask.Core;
18 |
19 | class MockObjectCreator : ObjectCreator
20 | {
21 | Func creator;
22 |
23 | public MockObjectCreator(string name, string version, Func creator)
24 | {
25 | this.Name = name;
26 | this.Version = version;
27 | this.creator = creator;
28 | }
29 |
30 | public override T Create()
31 | {
32 | return this.creator();
33 | }
34 | }
35 | }
36 |
37 |
38 |
--------------------------------------------------------------------------------
/test/DurableTask.Samples.Tests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/test/DurableTask.ServiceBus.Tests/TestData/SerializedExecutionStartedEvent.json:
--------------------------------------------------------------------------------
1 | {
2 | "$type": "DurableTask.Core.History.ExecutionStartedEvent, DurableTask.Core",
3 | "OrchestrationInstance": {
4 | "$type": "DurableTask.Core.OrchestrationInstance, DurableTask.Core",
5 | "InstanceId": "TestInstance",
6 | "ExecutionId": "eda9e8417d3943c193ac6214481865e7"
7 | },
8 | "EventType": 0,
9 | "ParentInstance": null,
10 | "Name": "GenerationOrchestration",
11 | "Version": "V2",
12 | "Input": "null",
13 | "Tags": {
14 | "$type": "System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib",
15 | "versiontag": "sample_value"
16 | },
17 | "EventId": -1,
18 | "IsPlayed": false,
19 | "Timestamp": "2016-04-05T17:35:31.9062038Z"
20 | }
--------------------------------------------------------------------------------
/test/DurableTask.ServiceBus.Tests/TestData/v1.0/SerializedOrchestrationStateNoTags.json:
--------------------------------------------------------------------------------
1 | {"$type":"DurableTask.OrchestrationState, DurableTask","CompletedTime":"2018-04-13T14:45:41.1620057-07:00","CompressedSize":2,"CreatedTime":"2018-04-13T14:45:41.1620057-07:00","Input":"Input","LastUpdatedTime":"2018-04-13T14:45:41.1620057-07:00","Name":"Name","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTask","InstanceId":"InstanceId","ExecutionId":"ExecutionId"},"OrchestrationStatus":0,"Output":"Output","ParentInstance":{"$type":"DurableTask.ParentInstance, DurableTask","Name":"ParentName","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTask","InstanceId":"ParentInstanceId","ExecutionId":"ParentExecutionId"},"TaskScheduleId":1,"Version":"ParentVersion"},"Size":3,"Status":"Status","Tags":null,"Version":"Version"}
--------------------------------------------------------------------------------
/test/DurableTask.ServiceBus.Tests/TestData/v1.0/SerializedRuntimeState.json:
--------------------------------------------------------------------------------
1 | {"$type":"DurableTask.OrchestrationRuntimeState, DurableTask","Events":[{"$type":"DurableTask.History.ExecutionStartedEvent, DurableTask","OrchestrationInstance":null,"EventType":0,"ParentInstance":{"$type":"DurableTask.ParentInstance, DurableTask","Name":"ParentName","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTask","InstanceId":"ParentInstanceId","ExecutionId":"ParentExecutionId"},"TaskScheduleId":1,"Version":"ParentVersion"},"Name":"Started","Version":null,"Input":"string","Tags":null,"EventId":-1,"IsPlayed":false,"Timestamp":"2018-04-13T22:03:59.6467518Z"},{"$type":"DurableTask.History.ExecutionTerminatedEvent, DurableTask","EventType":3,"Input":"Terminate","EventId":2,"IsPlayed":false,"Timestamp":"2018-04-13T22:20:01.0997257Z"}],"NewEvents":[],"CompressedSize":0,"Size":0,"Status":null,"CreatedTime":"2018-04-13T22:03:59.6467518Z","CompletedTime":"9999-12-31T07:59:59.9999999Z","Input":"string","Output":null,"Name":"Started","Version":null,"Tags":null,"OrchestrationStatus":0,"OrchestrationInstance":null,"ParentInstance":{"$type":"DurableTask.ParentInstance, DurableTask","Name":"ParentName","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTask","InstanceId":"ParentInstanceId","ExecutionId":"ParentExecutionId"},"TaskScheduleId":1,"Version":"ParentVersion"}}
--------------------------------------------------------------------------------
/test/DurableTask.ServiceBus.Tests/TestData/v1.0/SerializedTaskMessage.json:
--------------------------------------------------------------------------------
1 | {"$type":"DurableTask.TaskMessage, DurableTask","Event":{"$type":"DurableTask.History.SubOrchestrationInstanceCreatedEvent, DurableTask","EventType":7,"Name":"Name","Version":"Version","InstanceId":"InstanceId","Input":"Input","EventId":-1,"IsPlayed":false,"Timestamp":"2018-04-13T01:24:59.931852Z"},"OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTask","InstanceId":"InstanceId","ExecutionId":"ExecutionId"}}
--------------------------------------------------------------------------------
/test/DurableTask.ServiceBus.Tests/TestData/vnext/SerializedExecutionStartedEvent.json:
--------------------------------------------------------------------------------
1 | {"$type":"DurableTask.History.ExecutionStartedEvent, DurableTaskFx","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTaskFx","InstanceId":"InstanceId","ExecutionId":"ExecutionId"},"EventType":0,"ParentInstance":{"$type":"DurableTask.ParentInstance, DurableTaskFx","Name":"ParentName","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTaskFx","InstanceId":"ParentInstanceId","ExecutionId":"ParentExecutionId"},"TaskScheduleId":1,"Version":"ParentVersion"},"Name":" Start","Version":"Version","Input":"Input","Tags":{"$type":"System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib","key":"value","key2":"value2"},"EventId":-1,"IsPlayed":false,"Timestamp":"2018-04-13T22:37:51.8866396Z"}
--------------------------------------------------------------------------------
/test/DurableTask.ServiceBus.Tests/TestData/vnext/SerializedStateWithTags.json:
--------------------------------------------------------------------------------
1 | {"$type":"DurableTask.OrchestrationState, DurableTaskFx","CompletedTime":"2018-04-13T15:52:08.275897-07:00","CompressedSize":2,"CreatedTime":"2018-04-13T15:52:08.275897-07:00","Input":"Input","LastUpdatedTime":"2018-04-13T15:52:08.275897-07:00","Name":"Name","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTaskFx","InstanceId":"InstanceId","ExecutionId":"ExecutionId"},"OrchestrationStatus":0,"Output":"Output","ParentInstance":{"$type":"DurableTask.ParentInstance, DurableTaskFx","Name":"ParentName","OrchestrationInstance":{"$type":"DurableTask.OrchestrationInstance, DurableTaskFx","InstanceId":"ParentInstanceId","ExecutionId":"ParentExecutionId"},"TaskScheduleId":1,"Version":"ParentVersion"},"Size":3,"Status":"Status","Tags":{"$type":"System.Collections.Generic.Dictionary`2[[System.String, mscorlib],[System.String, mscorlib]], mscorlib","key":"value","key2":"value2"},"Version":"Version"}
--------------------------------------------------------------------------------
/test/DurableTask.ServiceBus.Tests/TestObjectCreator.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.ServiceBus.Tests
15 | {
16 | using System;
17 | using DurableTask.Core;
18 |
19 | internal class TestObjectCreator : ObjectCreator
20 | {
21 | readonly Func creator;
22 |
23 | public TestObjectCreator(string name, string version, Func creator)
24 | {
25 | Name = name;
26 | Version = version;
27 | this.creator = creator;
28 | }
29 |
30 | public override T Create()
31 | {
32 | return this.creator();
33 | }
34 | }
35 | }
--------------------------------------------------------------------------------
/test/DurableTask.Stress.Tests/DurableTask.Stress.Tests.dll.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/test/DurableTask.Stress.Tests/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/test/DurableTask.Stress.Tests/eventFlowConfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "inputs": [
3 | {
4 | "type": "EventSource",
5 | "sources": [
6 | {
7 | "level": "Warning"
8 | }
9 | ]
10 | }
11 | ],
12 | "outputs": [
13 | {
14 | "type": "StdOutput"
15 | }
16 | ],
17 | "schemaVersion": "2016-08-11"
18 | }
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | [assembly: System.Runtime.InteropServices.ComVisible(false)]
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/DurableTask.Test.Orchestrations.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | netstandard2.0;net462
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Performance/DriverOrchestrationData.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Performance
15 | {
16 | using System.Runtime.Serialization;
17 |
18 | [DataContract]
19 | [KnownType(typeof(DriverOrchestrationData))]
20 | public class DriverOrchestrationData
21 | {
22 | [DataMember]
23 | public int NumberOfParallelOrchestrations { get; set; }
24 |
25 | [DataMember]
26 | public TestOrchestrationData SubOrchestrationData { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Performance/ExecutionCountingActivity.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Performance
15 | {
16 | using System;
17 | using System.Threading;
18 | using System.Threading.Tasks;
19 | using DurableTask.Core;
20 |
21 | public sealed class ExecutionCountingActivity : AsyncTaskActivity
22 | {
23 | // This has to be reset before starting the orchestration and the orchestration
24 | // must be run in sequence for this to determine the correct number of times all
25 | // the activities together executed.
26 | public static int Counter = 0;
27 |
28 | protected override async Task ExecuteAsync(TaskContext context, int taskId)
29 | {
30 | await Task.Delay(new Random().Next(5, 10));
31 | Interlocked.Increment(ref Counter);
32 | return Counter;
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Performance/ExecutionCountingOrchestration.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Performance
15 | {
16 | using System.Collections.Generic;
17 | using System.Threading.Tasks;
18 | using DurableTask.Core;
19 |
20 | public sealed class ExecutionCountingOrchestration : TaskOrchestration
21 | {
22 | public override async Task RunTask(OrchestrationContext context, int numberOfActivities)
23 | {
24 | List> results = new List>();
25 | for (int i = 0; i < numberOfActivities; i++)
26 | {
27 | results.Add(context.ScheduleTask(typeof(ExecutionCountingActivity), i));
28 | }
29 |
30 | await Task.WhenAll(results);
31 | return ExecutionCountingActivity.Counter;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Performance/RandomTimeWaitingTaskInput.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Performance
15 | {
16 | using System;
17 |
18 | public class RandomTimeWaitingTaskInput
19 | {
20 | public string TaskId { get; set; }
21 |
22 | public int MaxDelay { get; set; }
23 |
24 | public int MinDelay { get; set; }
25 |
26 | public TimeSpan DelayUnit { get; set; }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Performance/TestOrchestrationData.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Performance
15 | {
16 | using System;
17 | using System.Runtime.Serialization;
18 |
19 | [DataContract]
20 | [KnownType(typeof(TestOrchestrationData))]
21 | public class TestOrchestrationData
22 | {
23 | [DataMember]
24 | public int NumberOfParallelTasks { get; set; }
25 |
26 | [DataMember]
27 | public int NumberOfSerialTasks { get; set; }
28 |
29 | [DataMember]
30 | public int MaxDelay { get; set; }
31 |
32 | [DataMember]
33 | public int MinDelay { get; set; }
34 |
35 | [DataMember]
36 | public TimeSpan DelayUnit { get; set; }
37 |
38 | [DataMember]
39 | public bool UseTimeoutTask { get; set; }
40 |
41 | [DataMember]
42 | public TimeSpan ExecutionTimeout { get; set; }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Stress/DriverOrchestrationData.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Stress
15 | {
16 | public class DriverOrchestrationData
17 | {
18 | public int NumberOfParallelTasks { get; set; }
19 |
20 | public int NumberOfIteration { get; set; }
21 |
22 | public TestOrchestrationData SubOrchestrationData { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Stress/TestOrchestrationData.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Stress
15 | {
16 | public class TestOrchestrationData
17 | {
18 | public int NumberOfParallelTasks { get; set; }
19 |
20 | public int NumberOfSerialTasks { get; set; }
21 |
22 | public int MaxDelayInMinutes { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/DurableTask.Test.Orchestrations/Stress/TestTaskData.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace DurableTask.Test.Orchestrations.Stress
15 | {
16 | public class TestTaskData
17 | {
18 | public string TaskId { get; set; }
19 |
20 | public int MaxDelayInMinutes { get; set; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/test/TestFabricApplication/TestApplication.Common/OrchestrationTasks/IUserTasks.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace TestApplication.Common.OrchestrationTasks
15 | {
16 | using System.Threading.Tasks;
17 |
18 | public interface IUserTasks
19 | {
20 | Task GetUserAsync();
21 |
22 | Task GreetUserAsync(string user);
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/TestFabricApplication/TestApplication.Common/OrchestrationTasks/UserTasks.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace TestApplication.Common.OrchestrationTasks
15 | {
16 | using System.Threading.Tasks;
17 |
18 | public class UserTasks : IUserTasks
19 | {
20 | public async Task GetUserAsync()
21 | {
22 | await Task.Yield();
23 | return "Gabbar";
24 | }
25 |
26 | public async Task GreetUserAsync(string user)
27 | {
28 | await Task.Yield();
29 | return "Hello " + user;
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/test/TestFabricApplication/TestApplication.Common/Orchestrations/CounterException.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace TestApplication.Common.Orchestrations
15 | {
16 | using System;
17 | using System.Runtime.Serialization;
18 |
19 | [Serializable]
20 | public class CounterException : Exception
21 | {
22 | readonly string CounterPropName = "Counter";
23 |
24 | public CounterException(int counter)
25 | {
26 | this.Counter = counter;
27 | }
28 |
29 | protected CounterException(SerializationInfo info, StreamingContext context)
30 | {
31 | this.Counter = info.GetInt32(CounterPropName);
32 | }
33 |
34 | public override void GetObjectData(SerializationInfo info, StreamingContext context)
35 | {
36 | info.AddValue(CounterPropName, this.Counter);
37 | base.GetObjectData(info, context);
38 | }
39 |
40 | public int Counter { get; }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/test/TestFabricApplication/TestApplication.Common/Orchestrations/RecurringOrchestrationInput.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace TestApplication.Common.Orchestrations
15 | {
16 | public class RecurringOrchestrationInput
17 | {
18 | public string TargetOrchestrationType { get; set; }
19 |
20 | public int TargetOrchestrationInput { get; set; }
21 |
22 | public string TargetOrchestrationInstanceId { get; set; }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/test/TestFabricApplication/TestApplication.Common/Orchestrations/RecurringTargetOrchestration.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace TestApplication.Common.Orchestrations
15 | {
16 | using System.Threading.Tasks;
17 |
18 | using DurableTask.Core;
19 |
20 | using TestApplication.Common.OrchestrationTasks;
21 |
22 | public class RecurringTargetOrchestration : TaskOrchestration
23 | {
24 | public override async Task RunTask(OrchestrationContext context, int input)
25 | {
26 | var testTasks = context.CreateClient();
27 | int count = await testTasks.IncrementGenerationCount();
28 | return count;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/test/TestFabricApplication/TestApplication.Common/Orchestrations/SimpleOrchestrationWithTasks.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace TestApplication.Common.Orchestrations
15 | {
16 | using System.Threading.Tasks;
17 | using DurableTask.Core;
18 | using TestApplication.Common.OrchestrationTasks;
19 |
20 | public class SimpleOrchestrationWithTasks : TaskOrchestration
21 | {
22 | public override async Task RunTask(OrchestrationContext context, string input)
23 | {
24 | IUserTasks userTasks = context.CreateClient();
25 | string user = await userTasks.GetUserAsync();
26 | string greeting = await userTasks.GreetUserAsync(user);
27 |
28 | return greeting;
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/test/TestFabricApplication/TestApplication.Common/Orchestrations/SimpleOrchestrationWithTimer.cs:
--------------------------------------------------------------------------------
1 | // ----------------------------------------------------------------------------------
2 | // Copyright Microsoft Corporation
3 | // Licensed under the Apache License, Version 2.0 (the "License");
4 | // you may not use this file except in compliance with the License.
5 | // You may obtain a copy of the License at
6 | // http://www.apache.org/licenses/LICENSE-2.0
7 | // Unless required by applicable law or agreed to in writing, software
8 | // distributed under the License is distributed on an "AS IS" BASIS,
9 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10 | // See the License for the specific language governing permissions and
11 | // limitations under the License.
12 | // ----------------------------------------------------------------------------------
13 |
14 | namespace TestApplication.Common.Orchestrations
15 | {
16 | using System;
17 | using System.Threading.Tasks;
18 | using DurableTask.Core;
19 | using TestApplication.Common.OrchestrationTasks;
20 |
21 | public class SimpleOrchestrationWithTimer : TaskOrchestration
22 | {
23 | public override async Task RunTask(OrchestrationContext context, int input)
24 | {
25 | IUserTasks userTasks = context.CreateClient();
26 | await context.CreateTimer