├── .gitattributes ├── .github └── policies │ └── resourceManagement.yml ├── .gitignore ├── CONTRIBUTING.md ├── CustomDictionary.xml ├── Directory.Build.props ├── Directory.Build.targets ├── ISSUE_TEMPLATE.md ├── LICENSE.txt ├── NuGet.Config ├── README.md ├── SECURITY.md ├── Settings.StyleCop ├── WebJobs.sln ├── eng ├── build │ ├── Engineering.props │ ├── Engineering.targets │ ├── Release.props │ ├── Release.targets │ ├── RepositoryInfo.targets │ ├── SharedReferences.props │ ├── SharedReferences.targets │ ├── Version.props │ └── Version.targets ├── ci │ ├── code-mirror.yml │ ├── integration-tests.yml │ ├── official-build.yml │ ├── official-release.yml │ ├── public-build.yml │ └── templates │ │ ├── jobs │ │ ├── build.yml │ │ └── run-integration-tests.yml │ │ ├── steps │ │ └── install-dotnet.yml │ │ └── variables │ │ └── build.yml └── res │ ├── icon.png │ └── key.snk ├── global.json ├── sample └── SampleHost │ ├── Filters │ ├── ErrorHandler.cs │ └── WorkItemValidator.cs │ ├── Functions.cs │ ├── Models │ └── WorkItem.cs │ ├── Program.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── SampleHost.csproj │ ├── Services.cs │ └── appsettings.json ├── src.ruleset ├── src ├── Directory.Build.props ├── Directory.Version.props ├── Microsoft.Azure.WebJobs.Extensions.Rpc │ ├── Implementation │ │ ├── ExtensionEndpointDataSource.cs │ │ ├── GrpcExtension.cs │ │ ├── IRpcExtension.cs │ │ └── Logs.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── README.md │ ├── WebJobs.Extensions.Rpc.csproj │ └── WebJobsExtensionBuilderRpcExtensions.cs ├── Microsoft.Azure.WebJobs.Host.Storage │ ├── AzureStorageProvider.cs │ ├── BlobServiceClientProvider.cs │ ├── BlobStorageConcurrencyStatusRepository.cs │ ├── BlobStorageExtensions.cs │ ├── CommonUtility.cs │ ├── DefaultDelegatingHandlerProvider.cs │ ├── DefaultStorageCredentialsValidator.cs │ ├── Directory.Version.props │ ├── IAzureBlobStorageProvider.cs │ ├── IDelegatingHandlerProvider.cs │ ├── JobHostInternalStorageOptions.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── README.md │ ├── RuntimeStorageWebJobsBuilderExtensions.cs │ ├── Singleton │ │ └── BlobLeaseDistributedLockManager.cs │ ├── StorageClientProvider.cs │ ├── StorageServiceCollectionExtensions.cs │ ├── Utility.cs │ ├── WebJobs.Host.Storage.csproj │ └── WebJobsStorageDelegatingHandler.cs ├── Microsoft.Azure.WebJobs.Host │ ├── AppServicesHostingUtility.cs │ ├── ApplicationInsights.config │ ├── AssemblyNameCache.cs │ ├── Bindings │ │ ├── AmbientBindingContext.cs │ │ ├── AsyncCollector │ │ │ ├── AsyncCollectorValueProvider.cs │ │ │ ├── OutArrayValueProvider.cs │ │ │ ├── OutValueProvider.cs │ │ │ ├── SyncAsyncCollectorAdapter.cs │ │ │ └── TypedAsyncCollectorAdapter.cs │ │ ├── AttributeCloner.cs │ │ ├── AttributeConverter.cs │ │ ├── BindStepOrder.cs │ │ ├── BindingBase.cs │ │ ├── BindingContext.cs │ │ ├── BindingDataPathHelper.cs │ │ ├── BindingDataProvider.cs │ │ ├── BindingExceptionValueProvider.cs │ │ ├── BindingFactory.cs │ │ ├── BindingFactoryHelpers.cs │ │ ├── BindingProviderContext.cs │ │ ├── BindingProviders │ │ │ ├── AsyncCollectorBindingProvider.cs │ │ │ ├── BindToInputBindingProvider.cs │ │ │ ├── BindToStreamBindingProvider.cs │ │ │ ├── BindingRule.cs │ │ │ ├── CompositeBindingProvider.cs │ │ │ ├── FilterNode.cs │ │ │ ├── FilteringBindingProvider.cs │ │ │ ├── FluentBindingProvider.cs │ │ │ ├── FluentBindingProviderExtensions.cs │ │ │ ├── FunctionFilterBindingProvider.cs │ │ │ ├── GenericCompositeBindingProvider.cs │ │ │ ├── IBindingRuleProvider.cs │ │ │ ├── ItemBindingProvider.cs │ │ │ ├── TriggerAdapterBindingProvider.cs │ │ │ └── ValidatingWrapperBindingProvider.cs │ │ ├── BindingTemplateExtensions.cs │ │ ├── CacheAwareValueProvider.cs │ │ ├── Cancellation │ │ │ ├── CancellationTokenBinding.cs │ │ │ ├── CancellationTokenBindingProvider.cs │ │ │ └── CancellationTokenValueProvider.cs │ │ ├── ClassOutputConverter.cs │ │ ├── ConstantValueProvider.cs │ │ ├── ConverterManager.cs │ │ ├── Data │ │ │ ├── ClassDataBinding.cs │ │ │ ├── ClassDataBindingProvider.cs │ │ │ ├── CompositeArgumentBindingProvider.cs │ │ │ ├── ConverterArgumentBindingProvider.cs │ │ │ ├── DataBindingProvider.cs │ │ │ ├── IDataArgumentBindingProvider.cs │ │ │ ├── StringToTArgumentBindingProvider.cs │ │ │ ├── StructDataBinding.cs │ │ │ ├── StructDataBindingProvider.cs │ │ │ └── TToStringArgumentBindingProvider.cs │ │ ├── DefaultAttributeInvokerDescriptor.cs │ │ ├── DefaultResolutionPolicy.cs │ │ ├── ExecutionContext │ │ │ ├── ExecutionContext.cs │ │ │ ├── ExecutionContextBindingProvider.cs │ │ │ └── ExecutionContextOptions.cs │ │ ├── FuncArgumentBuilder.cs │ │ ├── FunctionBinding.cs │ │ ├── FunctionBindingContext.cs │ │ ├── IArgumentBinding.cs │ │ ├── IArgumentBindingProvider.cs │ │ ├── IBindablePath.cs │ │ ├── IBinding.cs │ │ ├── IBindingDataProvider.cs │ │ ├── IBindingProvider.cs │ │ ├── IFunctionBinding.cs │ │ ├── ILogger │ │ │ ├── ILoggerBinding.cs │ │ │ └── ILoggerBindingProvider.cs │ │ ├── IOrderedValueBinder.cs │ │ ├── IResolutionPolicy.cs │ │ ├── IValueBinder.cs │ │ ├── IValueProvider.cs │ │ ├── IWatchable.cs │ │ ├── IWatcher.cs │ │ ├── ImmutableWatcher.cs │ │ ├── Invoke │ │ │ ├── ClassInvokeBinding.cs │ │ │ ├── InvokeBinding.cs │ │ │ └── StructInvokeBinding.cs │ │ ├── ObjectToTypeConverterFactory.cs │ │ ├── ObjectValueProvider.cs │ │ ├── OpenType.cs │ │ ├── Path │ │ │ ├── BindingParameterResolver.cs │ │ │ ├── BindingTemplate.cs │ │ │ ├── BindingTemplateParser.cs │ │ │ ├── BindingTemplateSource.cs │ │ │ └── BindingTemplateToken.cs │ │ ├── PatternMatcher.cs │ │ ├── Runtime │ │ │ ├── AttributeBindingSource.cs │ │ │ ├── Binder.cs │ │ │ ├── CollectingDisposable.cs │ │ │ ├── IAttributeBindingSource.cs │ │ │ ├── RuntimeBinding.cs │ │ │ ├── RuntimeBindingProvider.cs │ │ │ ├── RuntimeBindingWatcher.cs │ │ │ └── RuntimeValueProvider.cs │ │ ├── StringConverterObjectToTypeConverter.cs │ │ ├── StructOutputConverter.cs │ │ ├── SystemBindingData.cs │ │ ├── TraceWriter │ │ │ ├── LoggerTraceWriter.cs │ │ │ ├── TextWriterTraceAdapter.cs │ │ │ ├── TraceWriterBinding.cs │ │ │ └── TraceWriterBindingProvider.cs │ │ └── ValueBindingContext.cs │ ├── ClassPropertyAccessorFactory.cs │ ├── ClassPropertyGetter.cs │ ├── ClassPropertySetter.cs │ ├── Config │ │ ├── ApplyConversion.cs │ │ ├── ConcurrencyOptionsSetup.cs │ │ ├── CoreWebJobsOptionsSetup.cs │ │ ├── DirectInvokeString.cs │ │ ├── ExtensionConfigContext.cs │ │ ├── ExtensionOptionsProvider.cs │ │ ├── FluentBindingRule.cs │ │ ├── FluentConverterRules.cs │ │ ├── IExtensionConfigProvider.cs │ │ ├── IExtensionOptionsProvider.cs │ │ ├── IWebJobsExtensionConfiguration.cs │ │ ├── IWebhookProvider.cs │ │ ├── JobHostFunctionTimeoutOptions.cs │ │ ├── JobHostOptions.cs │ │ ├── PrimaryHostCoordinatorOptionsSetup.cs │ │ ├── WebJobsExtensionConfiguration.cs │ │ └── WebJobsExtensionOptionsConfiguration.cs │ ├── ConnectionStringNames.cs │ ├── Constants.cs │ ├── ContextAccessor.cs │ ├── Converters │ │ ├── AsyncConverter.cs │ │ ├── ByteToStringConverter.cs │ │ ├── CharToStringConverter.cs │ │ ├── CompositeAsyncObjectToTypeConverter.cs │ │ ├── CompositeObjectToTypeConverter.cs │ │ ├── CompositeStringToTConverterFactory.cs │ │ ├── ConversionResult.cs │ │ ├── GuidToStringConverter.cs │ │ ├── IAsyncConverter.cs │ │ ├── IAsyncObjectToTypeConverter.cs │ │ ├── IConverter.cs │ │ ├── IObjectToTypeConverter.cs │ │ ├── IStringToTConverterFactory.cs │ │ ├── IdentityConverter.cs │ │ ├── IdentityStringToTConverterFactory.cs │ │ ├── Int16ToStringConverter.cs │ │ ├── Int32ToStringConverter.cs │ │ ├── Int64ToStringConverter.cs │ │ ├── KnownTypesParseToStringConverterFactory.cs │ │ ├── SByteToStringConverter.cs │ │ ├── StringToBigIntegerConverter.cs │ │ ├── StringToByteConverter.cs │ │ ├── StringToDateTimeConverter.cs │ │ ├── StringToDateTimeOffsetConverter.cs │ │ ├── StringToDecimalConverter.cs │ │ ├── StringToDoubleConverter.cs │ │ ├── StringToGuidConverter.cs │ │ ├── StringToInt16Converter.cs │ │ ├── StringToInt32Converter.cs │ │ ├── StringToInt64Converter.cs │ │ ├── StringToSByteConverter.cs │ │ ├── StringToSingleConverter.cs │ │ ├── StringToTConverterFactory.cs │ │ ├── StringToTimeSpanConverter.cs │ │ ├── StringToUInt16Converter.cs │ │ ├── StringToUInt32Converter.cs │ │ ├── StringToUInt64Converter.cs │ │ ├── TToStringConverterFactory.cs │ │ ├── TryParseDelegate.cs │ │ ├── TryParseStringToTConverter.cs │ │ ├── TryParseStringToTConverterFactory.cs │ │ ├── TypeConverterStringToTConverter.cs │ │ ├── TypeConverterStringToTConverterFactory.cs │ │ ├── UInt16ToStringConverter.cs │ │ ├── UInt32ToStringConverter.cs │ │ └── UInt64ToStringConverter.cs │ ├── DefaultExtensionRegistry.cs │ ├── DefaultExtensionRegistryFactory.cs │ ├── DefaultNameResolver.cs │ ├── Diagnostics │ │ └── ExceptionFormatter.cs │ ├── Dispatch │ │ ├── DispatchQueueHandler.cs │ │ ├── HostMessageListenerFactory.cs │ │ ├── IDispatchQueueHandler.cs │ │ ├── ILoadBalancerQueue.cs │ │ ├── IMessageHandler.cs │ │ ├── InMemoryDispatchQueueHandler.cs │ │ └── SharedQueueHandler.cs │ ├── Exceptions │ │ ├── FunctionException.cs │ │ └── RecoverableException.cs │ ├── Executors │ │ ├── AbortListenerFunctionExecutor.cs │ │ ├── ActivatorInstanceFactory.cs │ │ ├── BindingSource.cs │ │ ├── DefaultHostIdProvider.cs │ │ ├── DefaultInstanceServicesProvider.cs │ │ ├── DefaultInstanceServicesProviderFactory.cs │ │ ├── DefaultJobActivator.cs │ │ ├── DelayedException.cs │ │ ├── DelegatingFunctionExecutor.cs │ │ ├── ExceptionDispatchInfoDelayedException.cs │ │ ├── FixedHostIdProvider.cs │ │ ├── FunctionActivityStatus.cs │ │ ├── FunctionExecutor.cs │ │ ├── FunctionExecutorExtensions.cs │ │ ├── FunctionInstance.cs │ │ ├── FunctionInstanceExtensions.cs │ │ ├── FunctionInstanceFactory.cs │ │ ├── FunctionInstanceFactoryContext.cs │ │ ├── FunctionInstanceFactoryContextOfT.cs │ │ ├── FunctionInvoker.cs │ │ ├── FunctionInvokerFactory.cs │ │ ├── FunctionInvokerWrapper.cs │ │ ├── FunctionOutputIntervals.cs │ │ ├── FunctionParameterLogIntervals.cs │ │ ├── FunctionResult.cs │ │ ├── HeartbeatFunctionExecutor.cs │ │ ├── HeartbeatIntervals.cs │ │ ├── HostIdValidator.cs │ │ ├── HostMessageExecutor.cs │ │ ├── IActivatorInstanceFactory.cs │ │ ├── IBindingSource.cs │ │ ├── IDelayedException.cs │ │ ├── IFunctionActivityStatusProvider.cs │ │ ├── IFunctionExecutor.cs │ │ ├── IFunctionInstance.cs │ │ ├── IFunctionInstanceFactory.cs │ │ ├── IFunctionInvoker.cs │ │ ├── IFunctionInvokerEx.cs │ │ ├── IHostIdProvider.cs │ │ ├── IInstanceServicesProvider.cs │ │ ├── IInstanceServicesProviderFactory.cs │ │ ├── IJobHostContextFactory.cs │ │ ├── IJobInvoker.cs │ │ ├── IMethodInvoker.cs │ │ ├── IRetryNotifier .cs │ │ ├── ITriggeredFunctionExecutor.cs │ │ ├── Internal │ │ │ └── FunctionInvoker.cs │ │ ├── JobHostContext.cs │ │ ├── JobHostContextFactory.cs │ │ ├── MethodInvokerFactory.cs │ │ ├── MethodInvokerWithReturnValue.cs │ │ ├── NullInstanceFactory.cs │ │ ├── ShutdownFunctionExecutor.cs │ │ ├── TaskMethodInvoker.cs │ │ ├── TriggeredFunctionData.cs │ │ ├── TriggeredFunctionExecutor.cs │ │ ├── VoidMethodInvoker.cs │ │ └── VoidTaskMethodInvoker.cs │ ├── ExponentialBackoffRetryAttribute.cs │ ├── Extensions │ │ ├── ExceptionExtensions.cs │ │ ├── ExtensionInfo.cs │ │ ├── FunctionMetadata .cs │ │ ├── IConfigurationExtensions.cs │ │ ├── IExtensionRegistryExtensions.cs │ │ ├── IJobHostMetadataProvider.cs │ │ ├── IJobHostMetadataProviderFactory.cs │ │ ├── JobHostMetadataProvider.cs │ │ └── JobHostMetadataProviderFactory.cs │ ├── FastTableLoggerProvider.cs │ ├── Filters │ │ ├── FunctionExceptionContext.cs │ │ ├── FunctionExceptionFilterAttribute.cs │ │ ├── FunctionExecutedContext.cs │ │ ├── FunctionExecutingContext.cs │ │ ├── FunctionFilterContext.cs │ │ ├── FunctionInvocationContext.cs │ │ ├── FunctionInvocationFilterAttribute.cs │ │ ├── IFunctionExceptionFilter.cs │ │ ├── IFunctionFilter.cs │ │ └── IFunctionInvocationFilter.cs │ ├── FixedDelayRetryAttribute.cs │ ├── FuncConverter.cs │ ├── FunctionInvocationException.cs │ ├── FunctionTimeoutException.cs │ ├── GlobalSuppressions.cs │ ├── HostContainerNames.cs │ ├── HostDirectoryNames.cs │ ├── HostQueueNames.cs │ ├── Hosting │ │ ├── DefaultStartupTypeLocator.cs │ │ ├── DrainModeManager.cs │ │ ├── FunctionDataCache │ │ │ ├── FunctionDataCacheKey.cs │ │ │ ├── ICacheAwareReadObject.cs │ │ │ ├── ICacheAwareWriteObject.cs │ │ │ ├── IFunctionDataCache.cs │ │ │ └── SharedMemoryMetadata.cs │ │ ├── IDrainModeManager.cs │ │ ├── IPrimaryHostStateProvider.cs │ │ ├── ITrackedConfigurationBuilder.cs │ │ ├── ITrackedServiceCollection.cs │ │ ├── IWebJobsBuilder.cs │ │ ├── IWebJobsConfigurationBuilder.cs │ │ ├── IWebJobsConfigurationStartup.cs │ │ ├── IWebJobsExtensionBuilder.cs │ │ ├── IWebJobsStartup.cs │ │ ├── IWebJobsStartup2.cs │ │ ├── IWebJobsStartupTypeLocator.cs │ │ ├── JobHostService.cs │ │ ├── OptionsFormatter │ │ │ ├── IOptionsFormatter.Generic.cs │ │ │ ├── IOptionsFormatter.cs │ │ │ ├── IOptionsLoggingSource.cs │ │ │ ├── LoggerFilterOptionsFormatter.cs │ │ │ ├── OptionsLoggingService.cs │ │ │ ├── OptionsLoggingSource.cs │ │ │ └── WebJobsOptionsFactory.cs │ │ ├── PrimaryHostCoordinator.cs │ │ ├── PrimaryHostCoordinatorOptions.cs │ │ ├── PrimaryHostStateProvider.cs │ │ ├── TrackedConfigurationBuilder.cs │ │ ├── TrackedServiceCollection.cs │ │ ├── WebJobsBuilder.cs │ │ ├── WebJobsBuilderContext.cs │ │ ├── WebJobsBuilderExtensions.cs │ │ ├── WebJobsConfigurationBuilder.cs │ │ ├── WebJobsExtensionBuilder.cs │ │ ├── WebJobsExtensionBuilderExtensions.cs │ │ ├── WebJobsHostBuilderExtensions.cs │ │ ├── WebJobsServiceCollectionExtensions.cs │ │ └── WebJobsStartupAttribute.cs │ ├── IContextGetter.cs │ ├── IContextSetter.cs │ ├── IConverterManager.cs │ ├── IExtensionRegistry.cs │ ├── IExtensionRegistryFactory.cs │ ├── IFactory.cs │ ├── IJobActivator.cs │ ├── IJobActivatorEx.cs │ ├── IJobHost.cs │ ├── INameResolver.cs │ ├── IPropertyAccessorFactory.cs │ ├── IPropertyGetter.cs │ ├── IPropertySetter.cs │ ├── IRetryStrategy.cs │ ├── ITypeLocator.cs │ ├── Indexers │ │ ├── CompositeBindingProviderFactory.cs │ │ ├── DefaultTriggerBindingFactory.cs │ │ ├── DefaultTypeLocator.cs │ │ ├── FunctionDefinition.cs │ │ ├── FunctionIndex.cs │ │ ├── FunctionIndexProvider.cs │ │ ├── FunctionIndexer.cs │ │ ├── FunctionIndexingException.cs │ │ ├── IFunctionDefinition.cs │ │ ├── IFunctionIndex.cs │ │ ├── IFunctionIndexCollector.cs │ │ ├── IFunctionIndexLookup.cs │ │ ├── IFunctionIndexProvider.cs │ │ └── MethodInfoExtensions.cs │ ├── JobHost.cs │ ├── Listeners │ │ ├── CompositeListener.cs │ │ ├── CompositeListenerFactory.cs │ │ ├── FunctionListener.cs │ │ ├── FunctionListenerDecorator.cs │ │ ├── FunctionListenerException.cs │ │ ├── HeartbeatListener.cs │ │ ├── HostListenerFactory.cs │ │ ├── IListener.cs │ │ ├── IListenerDecorator.cs │ │ ├── IListenerFactory.cs │ │ ├── ISharedContextProvider.cs │ │ ├── ISharedListener.cs │ │ ├── ITriggerExecutor.cs │ │ ├── ListenerDecoratorContext.cs │ │ ├── ListenerFactoryContext.cs │ │ ├── ListenerFactoryListener.cs │ │ ├── NullListener.cs │ │ ├── NullListenerFactory.cs │ │ ├── SharedContextProvider.cs │ │ ├── ShutdownListener.cs │ │ └── TimerListener.cs │ ├── Loggers │ │ ├── CompositeFunctionEventCollector.cs │ │ ├── CompositeFunctionInstanceLogger.cs │ │ ├── EventCollectorFactory.cs │ │ ├── FunctionInstanceLogEntry.cs │ │ ├── FunctionInstanceLogger.cs │ │ ├── IDashboardLoggingSetup.cs │ │ ├── IEventCollectorFactory.cs │ │ ├── IEventCollectorProvider.cs │ │ ├── IFunctionInstanceLogger.cs │ │ ├── IFunctionInstanceLoggerProvider.cs │ │ ├── IFunctionOutput.cs │ │ ├── IFunctionOutputDefinition.cs │ │ ├── IFunctionOutputLogger.cs │ │ ├── IFunctionOutputLoggerProvider.cs │ │ ├── IFunctionParameterLog.cs │ │ ├── IHostInstanceLogger.cs │ │ ├── IHostInstanceLoggerProvider.cs │ │ ├── Logger │ │ │ ├── Aggregator │ │ │ │ ├── FunctionResultAggregate.cs │ │ │ │ ├── FunctionResultAggregator.cs │ │ │ │ ├── FunctionResultAggregatorFactory.cs │ │ │ │ └── FunctionResultAggregatorOptions.cs │ │ │ ├── Constants │ │ │ │ ├── LogCategories.cs │ │ │ │ ├── LogConstants.cs │ │ │ │ └── ScopeKeys.cs │ │ │ ├── FunctionOutputLogger │ │ │ │ ├── FunctionOutputLogger.cs │ │ │ │ └── FunctionOutputLoggerProvider.cs │ │ │ ├── LoggerExtensions.cs │ │ │ └── States │ │ │ │ ├── FunctionResultAggregateState.cs │ │ │ │ ├── FunctionResultState.cs │ │ │ │ └── MetricState.cs │ │ ├── NullFunctionOutputDefinition.cs │ │ ├── NullFunctionOutputLogger.cs │ │ └── NullHostInstanceLogger.cs │ ├── NameResolverExtensions.cs │ ├── NativeMethods.cs │ ├── ObjectDictionaryConverter.cs │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resource.Designer.cs │ │ └── Resource.resx │ ├── PropertyAccessorFactory.cs │ ├── PropertyHelper.cs │ ├── Protocols │ │ ├── AbortHostInstanceMessage.cs │ │ ├── BinderParameterDescriptor.cs │ │ ├── BinderParameterLog.cs │ │ ├── BinderParameterLogItem.cs │ │ ├── BindingDataParameterDescriptor.cs │ │ ├── BlobMetadataKeys.cs │ │ ├── BlobNames.cs │ │ ├── CallAndOverrideMessage.cs │ │ ├── CallerSuppliedParameterDescriptor.cs │ │ ├── CancellationTokenParameterDescriptor.cs │ │ ├── CloudStorageAccountParameterDescriptor.cs │ │ ├── ConsoleOutputParameterDescriptor.cs │ │ ├── ContainerNames.cs │ │ ├── DictionaryExtensions.cs │ │ ├── ExecutionReason.cs │ │ ├── FunctionCompletedMessage.cs │ │ ├── FunctionDescriptor.cs │ │ ├── FunctionFailure.cs │ │ ├── FunctionStartedMessage.cs │ │ ├── FunctionStartedMessageExtensions.cs │ │ ├── FunctionStatusMessage.cs │ │ ├── HeartbeatDescriptor.cs │ │ ├── HostMessage.cs │ │ ├── HostOutputMessage.cs │ │ ├── HostStartedMessage.cs │ │ ├── IHeartbeatCommand.cs │ │ ├── IPersistentQueueReader.cs │ │ ├── IPersistentQueueWriter.cs │ │ ├── JTokenExtensions.cs │ │ ├── JsonSerialization.cs │ │ ├── JsonTypeNameAttribute.cs │ │ ├── LocalBlobDescriptor.cs │ │ ├── NullHeartbeatCommand.cs │ │ ├── ParameterDescriptor.cs │ │ ├── ParameterDisplayHints.cs │ │ ├── ParameterLog.cs │ │ ├── PersistentQueueMessage.cs │ │ ├── PolymorphicJsonConverter.cs │ │ ├── ReadBlobParameterLog.cs │ │ ├── ServiceBusParameterDescriptor.cs │ │ ├── ServiceBusTriggerParameterDescriptor.cs │ │ ├── SingletonParameterLog.cs │ │ ├── TableParameterLog.cs │ │ ├── TextParameterLog.cs │ │ ├── TriggerParameterDescriptor.cs │ │ ├── WebJobRunIdentifier.cs │ │ ├── WebJobTypes.cs │ │ ├── WebSitesKnownKeyNames.cs │ │ └── WriteBlobParameterLog.cs │ ├── README.md │ ├── RetryAttribute.cs │ ├── RetryContext.cs │ ├── Scale │ │ ├── AggregateScaleStatus.cs │ │ ├── ConcurrencyManager.cs │ │ ├── ConcurrencyManagerService.cs │ │ ├── ConcurrencyOptions.cs │ │ ├── ConcurrencyStatus.cs │ │ ├── ConcurrencyThrottleAggregateStatus.cs │ │ ├── ConcurrencyThrottleStatus.cs │ │ ├── DefaultConcurrencyThrottleManager.cs │ │ ├── DefaultHostProcessMonitor.cs │ │ ├── FunctionConcurrencySnapshot.cs │ │ ├── HostConcurrencySnapshot.cs │ │ ├── HostHealthState.cs │ │ ├── HostHealthThrottleProvider.cs │ │ ├── HostProcessStatus.cs │ │ ├── IConcurrencyStatusRepository.cs │ │ ├── IConcurrencyThrottleManager.cs │ │ ├── IConcurrencyThrottleProvider.cs │ │ ├── IHostProcessMonitor.cs │ │ ├── IScaleMetricsRepository.cs │ │ ├── IScaleMonitor.cs │ │ ├── IScaleMonitorManager.cs │ │ ├── IScaleMonitorProvider.cs │ │ ├── IScaleStatusProvider.cs │ │ ├── ITargetScaler.cs │ │ ├── ITargetScalerManager.cs │ │ ├── ITargetScalerProvider.cs │ │ ├── InMemoryScaleMetricsRepository.cs │ │ ├── NullConcurrencyStatusRepository.cs │ │ ├── NullScaleMetricsRepository.cs │ │ ├── ProcessMonitor.cs │ │ ├── ProcessStats.cs │ │ ├── ScaleManager.cs │ │ ├── ScaleMetrics.cs │ │ ├── ScaleMonitorDescriptor.cs │ │ ├── ScaleMonitorManager.cs │ │ ├── ScaleMonitorService.cs │ │ ├── ScaleOptions.cs │ │ ├── ScaleStatus.cs │ │ ├── ScaleStatusContext.cs │ │ ├── ScaleVote.cs │ │ ├── TargetScalerContext.cs │ │ ├── TargetScalerDescriptor.cs │ │ ├── TargetScalerManager.cs │ │ ├── TargetScalerResult.cs │ │ ├── ThreadPoolStarvationThrottleProvider.cs │ │ ├── ThrottleState.cs │ │ └── TriggerMetadata.cs │ ├── SharedListenerAttribute.cs │ ├── SharedMemoryAttribute.cs │ ├── Singleton │ │ ├── IDistributedLock.cs │ │ ├── IDistributedLockManager.cs │ │ ├── InMemoryDistributedLockManager.cs │ │ ├── RenewableLockHandle.cs │ │ ├── SingletonListener.cs │ │ ├── SingletonLock.cs │ │ ├── SingletonManager.cs │ │ ├── SingletonOptions.cs │ │ └── SingletonValueProvider.cs │ ├── StructPropertyAccessorFactory.cs │ ├── StructPropertyGetter.cs │ ├── StructPropertySetter.cs │ ├── SupportsRetryAttribute.cs │ ├── Timers │ │ ├── DefaultWebJobsExceptionHandlerFactory.cs │ │ ├── FixedDelayStrategy.cs │ │ ├── IDelayStrategy.cs │ │ ├── IRecurrentCommand.cs │ │ ├── ITaskSeriesCommand.cs │ │ ├── ITaskSeriesTimer.cs │ │ ├── IWebJobsExceptionHandler.cs │ │ ├── IWebJobsExceptionHandlerFactory.cs │ │ ├── LinearSpeedupStrategy.cs │ │ ├── NullRecurrentCommand.cs │ │ ├── RandomExtensions.cs │ │ ├── RandomizedExponentialBackoffStrategy.cs │ │ ├── RecurrentTaskSeriesCommand.cs │ │ ├── TaskSeriesCommandResult.cs │ │ ├── TaskSeriesTimer.cs │ │ └── WebJobsExceptionHandler.cs │ ├── TraceEvent.cs │ ├── TraceSource.cs │ ├── TraceWriter.cs │ ├── Triggers │ │ ├── CompositeTriggerBindingProvider.cs │ │ ├── ITriggerBinding.cs │ │ ├── ITriggerBindingProvider.cs │ │ ├── ITriggerBindingStrategy.cs │ │ ├── ITriggerData.cs │ │ ├── ITriggerDataArgumentBinding.cs │ │ ├── ITriggeredFunctionBinding.cs │ │ ├── ITriggeredFunctionInstanceFactory.cs │ │ ├── StrategyTriggerBinding.cs │ │ ├── TriggerArgumentBinding │ │ │ ├── ArrayTriggerArgumentBinding.cs │ │ │ ├── CustomTriggerArgumentBinding.cs │ │ │ ├── PocoTriggerArgumentBinding.cs │ │ │ ├── SimpleTriggerArgumentBinding.cs │ │ │ └── StringTriggerArgumentBinding.cs │ │ ├── TriggerBindingProviderContext.cs │ │ ├── TriggerBindingSource.cs │ │ ├── TriggerData.cs │ │ ├── TriggeredFunctionBinding.cs │ │ └── TriggeredFunctionInstanceFactory.cs │ ├── TypeUtility.cs │ ├── Utility.cs │ ├── WebJobs.Host.Sources.csproj │ ├── WebJobs.Host.csproj │ ├── WebSitesKnownKeyNames.cs │ └── WebjobsShutdownWatcher.cs ├── Microsoft.Azure.WebJobs.Logging.ApplicationInsights │ ├── ApplicationInsightsLogger.cs │ ├── ApplicationInsightsLoggerFilterRule.cs │ ├── ApplicationInsightsLoggerOptions.cs │ ├── ApplicationInsightsLoggerProvider.cs │ ├── Constants │ │ ├── ApplicationInsightsDiagnosticConstants.cs │ │ ├── ApplicationInsightsScopeKeys.cs │ │ └── LoggingConstants.cs │ ├── DependencyTrackingOptions.cs │ ├── DictionaryLoggerScope.cs │ ├── Directory.Version.props │ ├── Extensions │ │ ├── ApplicationInsightsLoggingBuilderExtensions.cs │ │ ├── ApplicationInsightsServiceCollectionExtensions.cs │ │ └── LogLevelExtension.cs │ ├── GlobalSuppressions.cs │ ├── HttpAutoCollectionOptions.cs │ ├── IRoleInstanceProvider.cs │ ├── ISdkVersionProvider.cs │ ├── Initializers │ │ ├── MetricSdkVersionTelemetryInitializer.cs │ │ ├── NullTelemetryInitializer.cs │ │ ├── WebJobsRoleEnvironmentTelmetryInitializer.cs │ │ └── WebJobsTelemetryInitializer.cs │ ├── LoggerRuleSelector.cs │ ├── NullTelemetryModule.cs │ ├── Processors │ │ ├── DelayedSamplingProcessor.cs │ │ ├── FilteringTelemetryProcessor.cs │ │ ├── OperationFilteringTelemetryProcessor.cs │ │ └── TelemetryProcessorExtensions.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── ProviderAliasUtilities.cs │ ├── QuickPulseInitializationScheduler.cs │ ├── README.md │ ├── SelfDiagnostics │ │ ├── ApplicationInsightsEventListener.cs │ │ └── SelfDiagnosticsTelemetryModule.cs │ ├── TokenCredentialOptions.cs │ └── WebJobs.Logging.ApplicationInsights.csproj ├── Microsoft.Azure.WebJobs.Logging │ ├── ActivationEvent.cs │ ├── Directory.Version.props │ ├── Entities │ │ ├── ContainerActiveEntity.cs │ │ ├── FunctionDefinitionEntity.cs │ │ ├── InstanceCountEntity.cs │ │ ├── InstanceTableEntity.cs │ │ ├── RecentPerFuncEntity.cs │ │ └── TimelineAggregateEntity.cs │ ├── FunctionId.cs │ ├── FunctionInstanceLogItem.cs │ ├── FunctionInstanceStatus.cs │ ├── FunctionVolumeTimelineEntry.cs │ ├── GlobalSuppressions.cs │ ├── IAggregateEntry.cs │ ├── IFunctionDefinition.cs │ ├── IFunctionInstanceBaseEntry.cs │ ├── ILogReader.cs │ ├── ILogTableProvider.cs │ ├── ILogWriter.cs │ ├── IRecentFunctionEntry.cs │ ├── Internal │ │ ├── CloudTableInstanceCountLogger.cs │ │ ├── ContainerActiveLogger.cs │ │ ├── DefaultLogTableProvider.cs │ │ ├── IEntityWithEpoch.cs │ │ ├── InstanceCountLoggerBase.cs │ │ ├── LogReader.cs │ │ ├── LogWriter.cs │ │ ├── ProjectionHelper.cs │ │ ├── TableScheme.cs │ │ ├── TimeBucket.cs │ │ └── Utility.cs │ ├── LogFactory.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── README.md │ ├── RecentFunctionQuery.cs │ ├── Segment.cs │ └── WebJobs.Logging.csproj ├── Microsoft.Azure.WebJobs.Rpc.Core │ ├── Internal │ │ └── WebJobsRpcEndpointDataSource.cs │ ├── README.md │ └── WebJobs.Rpc.Core.csproj ├── Microsoft.Azure.WebJobs.Shared │ ├── DictionaryExtensions.cs │ ├── Sanitizer.cs │ └── WebJobs.Shared.csproj └── Microsoft.Azure.WebJobs │ ├── AppSettingAttribute.cs │ ├── AutoResolveAttribute.cs │ ├── BinderExtensions.cs │ ├── BindingAttribute.cs │ ├── ConnectionProviderAttribute.cs │ ├── ConnectionStringAttribute.cs │ ├── DisableAttribute.cs │ ├── ExtensionAttribute.cs │ ├── FunctionNameAttribute.cs │ ├── GlobalSuppressions.cs │ ├── IAsyncCollector.cs │ ├── IAttributeInvokeDescriptor.cs │ ├── IBinder.cs │ ├── ICollector.cs │ ├── IConnectionProvider.cs │ ├── NoAutomaticTriggerAttribute.cs │ ├── ParameterBindingData.cs │ ├── README.md │ ├── SingletonAttribute.cs │ ├── SingletonMode.cs │ ├── SingletonScope.cs │ ├── StorageAccountAttribute.cs │ ├── TimeoutAttribute.cs │ └── WebJobs.csproj ├── stylecop.json └── test ├── Microsoft.Azure.WebJobs.Extensions.Rpc.UnitTests ├── Implementation │ ├── ExtensionEndpointDataSourceTests.cs │ └── GrpcExtensionTests.cs ├── Usings.cs ├── WebJobs.Extensions.Rpc.UnitTests.csproj ├── WebJobsExtensionBuilderExtensionsTests.cs └── protos │ └── test.proto ├── Microsoft.Azure.WebJobs.Host.EndToEndTests ├── ApplicationInsights │ ├── ApplicationInsightsEndToEndTests.cs │ ├── HttpDependencyCollectionTests.cs │ ├── ServiceBusRequestAndDependencyCollectionTests.cs │ ├── TelemetryValidationHelpers.cs │ └── TestTelemteryChannel.cs ├── AsyncCancellationEndToEndTests.cs ├── AsyncChainEndToEndTests.cs ├── BlobStorageConcurrencyStatusRepositoryTests.cs ├── CustomObject.cs ├── DispatchQueueEndToEndTests.cs ├── DynamicConcurrencyEndToEndTests.cs ├── ExtensionWithDispatchQueue.cs ├── InternalStorageTests.cs ├── ParallelExecutionTests.cs ├── Properties │ └── AssemblyInfo.cs ├── Scale │ └── ScaleHostEndToEndTests.cs ├── SingletonEndToEndTests.cs ├── WebJobs.Host.EndToEndTests.csproj └── appsettings.json ├── Microsoft.Azure.WebJobs.Host.FunctionalTests ├── AttributeClonerTests.cs ├── AzureStorageProviderTests.cs ├── BlobServiceClientProviderTests.cs ├── Configuration │ └── WebJobsExtensionOptionsConfigurationTests.cs ├── DataBindingFunctionalTests.cs ├── DataBindingProviderTests.cs ├── DependencyInjection │ └── DependencyInjectionTests.cs ├── DispatchQueueTests.cs ├── FunctionIndexCollector.cs ├── FunctionalTest.cs ├── HostListenerFactoryTests.cs ├── ILoggerTests.cs ├── Indexers │ ├── FunctionIndexerFactory.cs │ ├── FunctionIndexerIntegrationErrorTests.cs │ ├── FunctionIndexerIntegrationTests.cs │ └── FunctionIndexerTests.cs ├── JobHostMetadataProviderTests.cs ├── JobHostOptionsTests.cs ├── JobHostTests.cs ├── PrimaryHostCoordinatorTests.cs ├── Properties │ └── AssemblyInfo.cs ├── PublicSurfaceTests.cs ├── Singleton │ ├── SingletonConfigurationTests.cs │ ├── SingletonEnd2EndTests.cs │ ├── SingletonListenerTests.cs │ ├── SingletonLockTests.cs │ ├── SingletonManagerStorageIntegrationTests.cs │ ├── SingletonManagerTests.cs │ └── SingletonValueProviderTests.cs ├── StorageServiceUriOptionsTests.cs ├── TestDoubles │ ├── BlobAttributes.cs │ ├── ExpectInstanceFailureTaskFunctionInstanceLogger.cs │ ├── ExpectInstanceSuccessTaskFunctionInstanceLogger.cs │ ├── FakeFunctionInstanceLoggerProvider.cs │ ├── StrictEncodings.cs │ └── TaskBackgroundExceptionDispatcher.cs ├── TypeUtilityTests.cs ├── WebJobs.Host.FunctionalTests.csproj └── appsettings.json ├── Microsoft.Azure.WebJobs.Host.TestCommon ├── AzureComponentFactoryWrapper.cs ├── Directory.Version.props ├── EnvVarHolder.cs ├── ExceptionAssert.cs ├── ExpectManualCompletionTaskFunctionInstanceLogger.cs ├── Fakes │ ├── FakeActivator.cs │ ├── FakeNameResolver.cs │ ├── FakeTypeLocator.cs │ ├── NullFunctionInstanceLogger.cs │ ├── NullFunctionInstanceLoggerProvider.cs │ ├── NullFunctionOutputLoggerProvider.cs │ └── NullHostInstanceLoggerProvider.cs ├── InvariantCultureFixture.cs ├── JobHostFactory.cs ├── LogMessage.cs ├── Properties │ └── AssemblyInfo.cs ├── QueueServiceClientProvider.cs ├── README.md ├── RandomNameResolver.cs ├── ScriptHelpers.cs ├── TaskExtensions.cs ├── TestConfigurationBuilderExtensions.cs ├── TestExceptionHandler.cs ├── TestHelpers.cs ├── TestJobHost.cs ├── TestLogger.cs ├── TestLoggerProvider.cs ├── TestTraits.cs ├── WebJobs.Host.TestCommon.csproj └── WebJobsShutdownContext.cs ├── Microsoft.Azure.WebJobs.Host.UnitTests ├── AttributeClonerTests.cs ├── Bindings │ ├── AmbientBindingContextTests.cs │ ├── BindingContextTests.cs │ ├── BindingDataPathHelperTests.cs │ ├── BindingDataProviderTests.cs │ ├── ExecutionContext │ │ └── ExecutionContextBindingTests.cs │ ├── FunctionBindingTests.cs │ ├── Invoke │ │ └── InvokeBindingTests.cs │ ├── Path │ │ ├── BindingParameterResolverTests.cs │ │ ├── BindingTemplateParserTests.cs │ │ └── BindingTemplateTests.cs │ └── TraceWriter │ │ └── TextWriterTraceAdapterTests.cs ├── ClassPropertyGetterTests.cs ├── ClassPropertySetterTests.cs ├── Common │ ├── BindToGenericItemTests.cs │ ├── BindToStreamTests.cs │ ├── BindingPathAttribute.cs │ ├── BindingProviderFilterTests.cs │ ├── CollectorTests.cs │ ├── FakeItemTests.cs │ ├── HostCallTestsWithBindingData.cs │ ├── TriggerAdapterTest.cs │ ├── TriggerTests.cs │ ├── TypedCollectorTests.cs │ └── ValidationTests.cs ├── Configuration │ ├── PrimaryHostCoordinatorOptionsSetupTests.cs │ └── WebJobsExtensionOptionsConfigurationTests.cs ├── ConfigurationExtensionsTests.cs ├── ConverterManagerExtensions.cs ├── ConverterManagerTests.cs ├── Converters │ ├── CultureInfoContext.cs │ ├── StringToTConverterFactoryTests.cs │ └── TToStringConverterFactoryTests.cs ├── DefaultExtensionRegistryTests.cs ├── DefaultNameResolverTests.cs ├── EmptyFunctionIndexProvider.cs ├── ExceptionFormatterTests.cs ├── Executors │ ├── ActivatorInstanceFactoryTests.cs │ ├── DefaultHostIdProviderTests.cs │ ├── DefaultJobActivatorTests.cs │ ├── FunctionExecutorExtensionsTests.cs │ ├── FunctionExecutorTestHelper.cs │ ├── FunctionExecutorTests.cs │ ├── FunctionInvokerFactoryTests.cs │ ├── FunctionInvokerTests.cs │ ├── FunctionResultTests.cs │ ├── MethodInvokerFactoryTests.cs │ ├── NullInstanceFactoryTests.cs │ ├── TaskMethodInvokerTests.cs │ ├── TriggeredFunctionExecutorTests.cs │ └── VoidMethodInvokerTests.cs ├── ExtensionConfigContextTests.cs ├── FakeQueue │ ├── FakeQeueueTriggerAttribute.cs │ ├── FakeQueueAttribute.cs │ ├── FakeQueueClient.cs │ ├── FakeQueueData.cs │ ├── FakeQueueDataBatch.cs │ ├── FakeQueueListener.cs │ ├── FakeQueueTriggerBindingProvider.cs │ └── FakeQueueTriggerBindingStrategy.cs ├── Filters │ └── FunctionFilterTests.cs ├── GlobalSuppressions.cs ├── HostQueueNamesTest.cs ├── Hosting │ ├── DrainModeManagerTests.cs │ ├── FunctionDataCacheKeyTests.cs │ ├── HostBuilderExtensionsTests.cs │ ├── WebJobsConfigurationStartupTests.cs │ ├── WebJobsOptionsFactoryTests.cs │ └── WebJobsStartupTests.cs ├── Indexers │ ├── DefaultTypeLocatorTests.cs │ ├── FunctionNameTests.cs │ ├── NameResolverTests.cs │ └── ReturnValueTests.cs ├── JobHostContextTests.cs ├── JobHostMetadataProviderTests.cs ├── Listeners │ └── FunctionListenerTests.cs ├── Loggers │ ├── ApplicationInsightsConfigurationTests.cs │ ├── ApplicationInsightsEventListenerTests.cs │ ├── ApplicationInsightsLoggerProviderTests.cs │ ├── ApplicationInsightsLoggerTests.cs │ ├── FilteringTelemetryProcessorTests.cs │ ├── FunctionExecutorLogOrdering.cs │ ├── FunctionInstanceLoggerTests.cs │ ├── FunctionResultAggregatorConfigurationTests.cs │ ├── FunctionResultAggregatorTests.cs │ ├── LogCategoriesTests.cs │ ├── LoggerExtensionsTests.cs │ ├── PerfCounterSdkVersionTelemetryInitializerTest.cs │ ├── TestTelemetryChannel.cs │ ├── TokenCredentialOptionsTests.cs │ ├── WebJobsRoleEnvironmentTelemetryInitializerTests.cs │ ├── WebJobsRoleInstanceProviderTests.cs │ └── WebJobsTelemetryInitializerTests.cs ├── Properties │ └── AssemblyInfo.cs ├── PropertyAccessorFactoryTests.cs ├── Protocols │ ├── HostMessageTests.cs │ ├── HostStartedMessageTests.cs │ ├── JsonSerializationTests.cs │ ├── JsonTypeNameAttributeTests.cs │ ├── PolymorphicJsonConverterTests.cs │ └── ProtocolSerializationTests.cs ├── PublicSurfaceTests.cs ├── Retry │ └── RetryAttributeTests.cs ├── Scale │ ├── ConcurrencyManagerServiceTests.cs │ ├── ConcurrencyManagerTests.cs │ ├── ConcurrencyOptionSetupTests.cs │ ├── ConcurrencyOptionsTests.cs │ ├── ConcurrencyStatusSnapshotTests.cs │ ├── ConcurrencyStatusTests.cs │ ├── DefaultConcurrencyThrottleManagerTests.cs │ ├── DefaultHostProcessMonitorTests.cs │ ├── HostHealthThrottleProviderTests.cs │ ├── InMemoryScaleMetricsRepositoryTest.cs │ ├── ProcessMonitorTests.cs │ ├── ScaleManagerTests.cs │ ├── ScaleMonitorServiceTests.cs │ ├── TestScaleMonitor.cs │ ├── TestTargetScaler.cs │ └── ThreadPoolStarvationThrottleProviderTests.cs ├── StructPropertyGetterTests.cs ├── StructPropertySetterTests.cs ├── TimeoutAttributeTests.cs ├── Timers │ ├── LinearSpeedupStrategyTests.cs │ ├── RandomizedExponentialBackoffStrategyTests.cs │ └── TaskSeriesTimerTests.cs ├── UtilityTests.cs ├── WebJobs.Host.UnitTests.csproj ├── WebJobsShutdownWatcherTests.cs └── appsettings.json ├── Microsoft.Azure.WebJobs.Logging.FunctionalTests ├── FunctionIdTests.cs ├── GlobalSuppressions.cs ├── InstanceCountLoggerBaseTests.cs ├── LoggerTest.cs ├── ProjectionTests.cs ├── SafeCreateTests.cs ├── TimeBucket.cs └── WebJobs.Logging.FunctionalTests.csproj └── TestProjects └── FSharpFunctions ├── FSharpFunctions.fsproj └── Library.fs /.gitattributes: -------------------------------------------------------------------------------- 1 | * text 2 | 3 | *.cs diff merge text 4 | 5 | *.eot binary 6 | *.otf binary 7 | *.png binary 8 | *.snk binary 9 | *.ttf binary 10 | *.woff binary 11 | -------------------------------------------------------------------------------- /Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | $(MSBuildThisFileDirectory) 6 | $(RepoRoot)eng/ 7 | $(EngRoot)build/ 8 | $(EngRoot)res/ 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Directory.Build.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | Please provide a succinct description of the issue. 3 | 4 | #### Repro steps 5 | 6 | Provide the steps required to reproduce the problem 7 | 8 | 1. Step A 9 | 10 | 2. Step B 11 | 12 | #### Expected behavior 13 | 14 | Provide a description of the expected behavior. 15 | 16 | #### Actual behavior 17 | 18 | Provide a description of the actual behavior observed. 19 | 20 | #### Known workarounds 21 | 22 | Provide a description of any known workarounds. 23 | 24 | #### Related information 25 | 26 | Provide any related information 27 | 28 | * Package version 29 | * Links to source 30 | 31 | -------------------------------------------------------------------------------- /NuGet.Config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Reporting a Vulnerability 4 | 5 | Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) through https://msrc.microsoft.com or by emailing secure@microsoft.com. 6 | You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your 7 | original message. Further information, including the MSRC PGP key, can be found in the [MSRC Report an Issue FAQ](https://www.microsoft.com/en-us/msrc/faqs-report-an-issue). 8 | 9 | Please do not open issues for anything you think might have a security implication. 10 | -------------------------------------------------------------------------------- /eng/build/Engineering.targets: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /eng/build/SharedReferences.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | true 5 | 6 | 7 | 8 | false 9 | false 10 | true 11 | true 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /eng/ci/code-mirror.yml: -------------------------------------------------------------------------------- 1 | trigger: 2 | branches: 3 | include: 4 | - dev 5 | - release/* 6 | 7 | resources: 8 | repositories: 9 | - repository: eng 10 | type: git 11 | name: engineering 12 | ref: refs/tags/release 13 | 14 | variables: 15 | - template: ci/variables/cfs.yml@eng 16 | 17 | extends: 18 | template: ci/code-mirror.yml@eng 19 | -------------------------------------------------------------------------------- /eng/ci/integration-tests.yml: -------------------------------------------------------------------------------- 1 | trigger: none # ensure this is not ran as a CI build 2 | 3 | pr: 4 | branches: 5 | include: 6 | - dev 7 | 8 | resources: 9 | repositories: 10 | - repository: 1es 11 | type: git 12 | name: 1ESPipelineTemplates/1ESPipelineTemplates 13 | ref: refs/tags/release 14 | - repository: eng 15 | type: git 16 | name: engineering 17 | ref: refs/tags/release 18 | 19 | variables: 20 | - template: /eng/ci/templates/variables/build.yml@self 21 | - template: /ci/variables/cfs.yml@eng 22 | 23 | extends: 24 | template: v1/1ES.Unofficial.PipelineTemplate.yml@1es 25 | parameters: 26 | pool: 27 | name: 1es-pool-azfunc 28 | image: 1es-windows-2022 29 | os: windows 30 | 31 | stages: 32 | - stage: Test 33 | jobs: 34 | - template: /eng/ci/templates/jobs/run-integration-tests.yml@self 35 | -------------------------------------------------------------------------------- /eng/ci/templates/steps/install-dotnet.yml: -------------------------------------------------------------------------------- 1 | steps: 2 | 3 | - task: UseDotNet@2 # Needed by some of our test resources 4 | displayName: Install .NET 8 5 | inputs: 6 | packageType: sdk 7 | version: 8.x 8 | 9 | - task: UseDotNet@2 # The pinned SDK we use to build 10 | displayName: Install .NET SDK from global.json 11 | inputs: 12 | packageType: sdk 13 | useGlobalJson: true 14 | -------------------------------------------------------------------------------- /eng/ci/templates/variables/build.yml: -------------------------------------------------------------------------------- 1 | variables: 2 | - name: DOTNET_NOLOGO 3 | value: 1 4 | - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE 5 | value: 1 6 | - name: DOTNET_CLI_TELEMETRY_OPTOUT 7 | value: 1 8 | - name: configuration 9 | value: release 10 | - name: project 11 | value: WebJobs.sln 12 | - name: Build.Counter 13 | value: $[counter(format('{0:yyyyMMdd}', pipeline.startTime), 0)] 14 | -------------------------------------------------------------------------------- /eng/res/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-webjobs-sdk/45ca9fc1ed88fe32156dfe2452b217866749f32d/eng/res/icon.png -------------------------------------------------------------------------------- /eng/res/key.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Azure/azure-webjobs-sdk/45ca9fc1ed88fe32156dfe2452b217866749f32d/eng/res/key.snk -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "9.0.201", 4 | "rollForward": "latestFeature" 5 | }, 6 | "msbuild-sdks": { 7 | "Microsoft.Build.NoTargets": "3.7.56", 8 | "Microsoft.Build.Traversal": "4.1.0" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /sample/SampleHost/Models/WorkItem.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace SampleHost.Models 5 | { 6 | public class WorkItem 7 | { 8 | public string ID { get; set; } 9 | public int Priority { get; set; } 10 | public string Region { get; set; } 11 | public int Category { get; set; } 12 | public string Description { get; set; } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /sample/SampleHost/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | using System.Runtime.CompilerServices; 6 | using System.Runtime.InteropServices; 7 | 8 | 9 | // Setting ComVisible to false makes the types in this assembly not visible 10 | // to COM components. If you need to access a type in this assembly from 11 | // COM, set the ComVisible attribute to true on that type. 12 | [assembly: ComVisible(false)] 13 | 14 | // The following GUID is for the ID of the typelib if this project is exposed to COM 15 | [assembly: Guid("93429246-cce9-4eb0-b94d-68522862ba79")] 16 | 17 | // Version information for an assembly consists of the following four values: 18 | // 19 | // Major Version 20 | // Minor Version 21 | // Build Number 22 | // Revision 23 | -------------------------------------------------------------------------------- /sample/SampleHost/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "ConnectionStrings": { 3 | } 4 | } -------------------------------------------------------------------------------- /src/Directory.Build.props: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | true 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /src/Directory.Version.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3.0.41 4 | true 5 | 6 | 7 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Extensions.Rpc/Implementation/IRpcExtension.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.AspNetCore.Routing; 5 | using Microsoft.Extensions.Logging; 6 | 7 | namespace Microsoft.Azure.WebJobs.Extensions.Rpc 8 | { 9 | /// 10 | /// Represents an extension for host/worker RPC communication. 11 | /// 12 | internal interface IRpcExtension 13 | { 14 | /// 15 | /// Applies the RPC extension to the . 16 | /// 17 | /// The to apply to. 18 | /// The logger to use during extension registration. 19 | void Apply(IEndpointRouteBuilder builder, ILogger logger); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Extensions.Rpc/README.md: -------------------------------------------------------------------------------- 1 | # Microsoft.Azure.WebJobs.Extensions.Rpc 2 | 3 | This package provides RPC capabilities to the WebJobs SDK, allowing extensions to communicate between the host and worker via RPC. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 4 | 5 | ## Commonly used types 6 | 7 | - `WebJobsExtensionBuilderRpcExtensions` 8 | 9 | ## Example usage 10 | 11 | The below example demonstrates how an extension can register a custom gRPC extension. 12 | 13 | ``` CSharp 14 | public static IWebJobsBuilder AddMyExtension(this IWebJobsBuilder builder, Action configure) 15 | { 16 | builder.AddExtension() 17 | .MapWorkerGrpcService(); 18 | 19 | builder.Services.AddSingleton(); 20 | 21 | return builder; 22 | } 23 | ``` -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Extensions.Rpc/WebJobs.Extensions.Rpc.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0 5 | latest 6 | Microsoft.Azure.WebJobs.Extensions.Rpc 7 | This package provides RPC capabilities to the WebJobs SDK, allowing extensions to communicate between the host and worker via RPC. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 8 | Microsoft.Azure.WebJobs.Extensions.Rpc 9 | Microsoft.Azure.WebJobs.Extensions.Rpc 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host.Storage/CommonUtility.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Microsoft.Azure.WebJobs.Storage 9 | { 10 | internal static class CommonUtility 11 | { 12 | private const string AzureWebsiteSku = "WEBSITE_SKU"; 13 | private const string DynamicSku = "Dynamic"; 14 | 15 | private static readonly Lazy _isDynamicSku = new Lazy(() => 16 | { 17 | string sku = Environment.GetEnvironmentVariable(AzureWebsiteSku); 18 | return sku != null && sku == DynamicSku; 19 | }); 20 | 21 | public static bool IsDynamicSku => _isDynamicSku.Value; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host.Storage/DefaultDelegatingHandlerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Net.Http; 5 | using Microsoft.Azure.WebJobs.Storage; 6 | using Microsoft.Azure.WebJobs.Storage.Common; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Storage 9 | { 10 | internal class DefaultDelegatingHandlerProvider : IDelegatingHandlerProvider 11 | { 12 | public DelegatingHandler Create() 13 | { 14 | return CommonUtility.IsDynamicSku ? new WebJobsStorageDelegatingHandler() : null; 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host.Storage/Directory.Version.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5.0.1 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host.Storage/IDelegatingHandlerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Net.Http; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Storage 7 | { 8 | /// 9 | /// Represents a type used to create a to be used by the WebJobs Azure Storage clients. 10 | /// 11 | internal interface IDelegatingHandlerProvider 12 | { 13 | /// 14 | /// Creates a new . 15 | /// 16 | /// The . 17 | DelegatingHandler Create(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host.Storage/JobHostInternalStorageOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs 5 | { 6 | /// 7 | /// The storage configuration that the JobHost needs for its own operations (independent of binding) 8 | /// For example, this can support , blob leases, timers, etc. 9 | /// This provides a common place to set storage that the various subsequent services can use. 10 | /// 11 | public class JobHostInternalStorageOptions 12 | { 13 | public string InternalSasBlobContainer { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host.Storage/RuntimeStorageWebJobsBuilderExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs; 5 | 6 | namespace Microsoft.Extensions.Hosting 7 | { 8 | public static class RuntimeStorageWebJobsBuilderExtensions 9 | { 10 | // Make the Runtime itself use storage for its internal operations. 11 | // Uses v1 app settings, via a LegacyConfigSetup object. 12 | public static IWebJobsBuilder AddAzureStorageCoreServices(this IWebJobsBuilder builder) 13 | { 14 | builder.Services.AddAzureStorageCoreServices(); 15 | return builder; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host.Storage/Utility.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Azure.WebJobs.Host; 6 | 7 | namespace Microsoft.Azure.WebJobs.Extensions.Storage 8 | { 9 | static class Utility 10 | { 11 | internal static int GetProcessorCount() 12 | { 13 | int processorCount = 1; 14 | var skuValue = Environment.GetEnvironmentVariable(Constants.AzureWebsiteSku); 15 | if (!string.Equals(skuValue, Constants.DynamicSku, StringComparison.OrdinalIgnoreCase)) 16 | { 17 | processorCount = Environment.ProcessorCount; 18 | } 19 | return processorCount; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/ApplicationInsights.config: -------------------------------------------------------------------------------- 1 |  2 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/AsyncCollector/SyncAsyncCollectorAdapter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Bindings 7 | { 8 | // Adapter class to expose a ICollector on top of IAsyncCollector; 9 | internal class SyncAsyncCollectorAdapter : ICollector 10 | { 11 | private readonly IAsyncCollector _inner; 12 | 13 | public SyncAsyncCollectorAdapter(IAsyncCollector inner) 14 | { 15 | _inner = inner; 16 | } 17 | 18 | public void Add(T item) 19 | { 20 | Task.Run(async () => await _inner.AddAsync(item)).GetAwaiter().GetResult(); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/BindingProviders/FluentBindingProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Reflection; 6 | using System.Threading.Tasks; 7 | using Microsoft.Azure.WebJobs.Host.Protocols; 8 | 9 | namespace Microsoft.Azure.WebJobs.Host 10 | { 11 | // Base class to aide in private backwards compatability hooks for some bindings. 12 | // Help in implementing a Fluent API design where these extra properties are set 13 | // via method cascading rather than all at once upfront. 14 | internal class FluentBindingProvider 15 | { 16 | protected internal Func BuildParameterDescriptor { get; set; } 17 | } 18 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/Data/IDataArgumentBindingProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Bindings.Data 7 | { 8 | internal interface IDataArgumentBindingProvider 9 | { 10 | IArgumentBinding TryCreate(ParameterInfo parameter); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/ExecutionContext/ExecutionContextOptions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Bindings 5 | { 6 | public class ExecutionContextOptions 7 | { 8 | /// 9 | /// The application directory to be used when creating instances. 10 | /// 11 | public string AppDirectory { get; set; } 12 | } 13 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/FuncArgumentBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Bindings 5 | { 6 | // Deelegate for binding helpers. Converts from an attribute and binding context to an IValueProvider. 7 | // Common usage here is that this delegate is a closure that pulls in other information it needs to do the conversion. 8 | internal delegate IValueProvider FuncArgumentBuilder(TAttribute attribute, ValueBindingContext context); 9 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/IArgumentBindingProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Bindings 7 | { 8 | /// 9 | /// Defines a provider of argument bindings of the specified type. 10 | /// 11 | /// The argument binding type. 12 | public interface IArgumentBindingProvider 13 | { 14 | /// 15 | /// Attempt to create an argument binding for the specified parameter. 16 | /// 17 | /// The property create a binding for. 18 | /// A binding extension if this provider can bind to 19 | /// the parameter, false otherwise. 20 | TArgumentBinding TryCreate(ParameterInfo parameter); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/IBindingProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Bindings 7 | { 8 | /// 9 | /// Defines an interface for the creation of parameter bindings. 10 | /// 11 | public interface IBindingProvider 12 | { 13 | /// 14 | /// Try to create a binding using the specified context. 15 | /// 16 | /// The binding context. 17 | /// A task that returns the binding on completion. 18 | Task TryCreateAsync(BindingProviderContext context); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/IFunctionBinding.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Bindings 8 | { 9 | internal interface IFunctionBinding 10 | { 11 | Task> BindAsync(ValueBindingContext context, IDictionary parameters); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/IOrderedValueBinder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Bindings 5 | { 6 | /// 7 | /// Defines an that provides an ordering hint./> 8 | /// 9 | public interface IOrderedValueBinder : IValueBinder 10 | { 11 | /// 12 | /// Gets the bind order for the binder. 13 | /// 14 | BindStepOrder StepOrder { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/IValueBinder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Bindings 8 | { 9 | /// 10 | /// Defines methods for binding to a value. 11 | /// 12 | public interface IValueBinder : IValueProvider 13 | { 14 | /// 15 | /// Sets the value 16 | /// 17 | /// The new value to set. 18 | /// The to use. 19 | /// A for the operation. 20 | Task SetValueAsync(object value, CancellationToken cancellationToken); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/IWatchable.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Bindings 7 | { 8 | [Obsolete("Will be removed in a future release")] 9 | public interface IWatchable 10 | { 11 | IWatcher Watcher { get; } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/IWatcher.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Azure.WebJobs.Host.Protocols; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Bindings 8 | { 9 | [Obsolete("Will be removed in a future release")] 10 | public interface IWatcher 11 | { 12 | ParameterLog GetStatus(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/ImmutableWatcher.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Protocols; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Bindings 7 | { 8 | internal class ImmutableWatcher : IWatcher 9 | { 10 | private readonly ParameterLog _status; 11 | 12 | public ImmutableWatcher(ParameterLog status) 13 | { 14 | _status = status; 15 | } 16 | 17 | public ParameterLog GetStatus() 18 | { 19 | return _status; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Bindings/Runtime/IAttributeBindingSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Bindings.Runtime 9 | { 10 | internal interface IAttributeBindingSource 11 | { 12 | AmbientBindingContext AmbientBindingContext { get; } 13 | 14 | Task BindAsync(Attribute attribute, Attribute[] additionalAttributes = null, CancellationToken cancellationToken = default(CancellationToken)); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Config/ApplyConversion.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Config 5 | { 6 | /// 7 | /// Used to register a converter that applies a New value to an existing value. 8 | /// This is semantically like a TNew to TExisting converter, but used when TExisting already exists. 9 | /// This is common for Streams. The converter doesn't create the stream, instead it just 10 | /// applies the new value onto an existing stream instantation. 11 | /// 12 | /// A new value 13 | /// An existing object that the new Value is getting applied to. 14 | public class ApplyConversion 15 | { 16 | public TNew Value; 17 | public TExisting Existing; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Config/DirectInvokeString.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Config 5 | { 6 | // A short string serialization used to rehydrate the trigger. Sometimes this is the contents, and sometimes it's a moniker. For example: 7 | // For Blob, the DirectInvokeString is the blob path; whereas the String is the blob contents. (because blobs can be MB large) 8 | // For queue, both the DirectInvokeString and String are the queue contents. (because queue messages are generally small) 9 | public class DirectInvokeString 10 | { 11 | public string Value { get; set; } 12 | 13 | public DirectInvokeString(string value) 14 | { 15 | this.Value = value; 16 | } 17 | 18 | public static DirectInvokeString None = new DirectInvokeString("???"); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Config/ExtensionOptionsProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Hosting; 5 | using Microsoft.Extensions.Options; 6 | using System; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Config 9 | { 10 | internal class ExtensionOptionsProvider : IExtensionOptionsProvider 11 | { 12 | private IOptionsMonitor _optionsMonitor; 13 | public ExtensionOptionsProvider(ExtensionInfo extensionInfo, IOptionsMonitor optionsMonitor) 14 | { 15 | ExtensionInfo = extensionInfo; 16 | _optionsMonitor = optionsMonitor; 17 | } 18 | 19 | public ExtensionInfo ExtensionInfo { get; private set; } 20 | public object GetOptions() => _optionsMonitor.CurrentValue; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Config/IExtensionOptionsProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Config 5 | { 6 | public interface IExtensionOptionsProvider 7 | { 8 | ExtensionInfo ExtensionInfo { get; } 9 | object GetOptions(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Config/IWebJobsExtensionConfiguration.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Microsoft.Azure.WebJobs.Host.Config; 8 | using Microsoft.Extensions.Configuration; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host.Configuration 11 | { 12 | public interface IWebJobsExtensionConfiguration where T : IExtensionConfigProvider 13 | { 14 | IConfigurationSection ConfigurationSection { get; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Config/IWebhookProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Config 7 | { 8 | /// 9 | /// Allow a host to expose a HTTP web hook for extensions. 10 | /// 11 | [Obsolete("Not ready for public consumption.")] 12 | public interface IWebHookProvider 13 | { 14 | /// 15 | /// Gets the WebHook URL for an extension. 16 | /// 17 | /// An instance of the extension to own the http handler. 18 | /// A URL (without a query string). Caller may append a query string. 19 | Uri GetUrl(IExtensionConfigProvider extension); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/ConnectionStringNames.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs 5 | { 6 | /// Defines connection string names used by . 7 | public static class ConnectionStringNames 8 | { 9 | /// Gets the dashboard connection string name. 10 | public static readonly string Dashboard = "Dashboard"; 11 | 12 | /// Gets the Azure Storage connection string name. 13 | public static readonly string Storage = "Storage"; 14 | 15 | /// Gets an Azure Storage SAS connection for a blob container to use with internal operations. 16 | public static readonly string InternalSasStorage = "InternalSasBlobContainer"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/ContextAccessor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | internal class ContextAccessor : IContextGetter, IContextSetter 7 | { 8 | private TValue _value; 9 | 10 | public TValue Value 11 | { 12 | get { return _value; } 13 | } 14 | 15 | public void SetValue(TValue value) 16 | { 17 | _value = value; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/ByteToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class ByteToStringConverter : IConverter 9 | { 10 | public string Convert(byte input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/CharToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class CharToStringConverter : IConverter 9 | { 10 | public string Convert(char input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/ConversionResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Diagnostics.CodeAnalysis; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | /// 9 | /// Represents the result of a conversion. 10 | /// 11 | /// The of the conversion result. 12 | [SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes")] 13 | internal struct ConversionResult 14 | { 15 | /// 16 | /// Gets a value indicating whether the conversion succeeded. 17 | /// 18 | public bool Succeeded { get; set; } 19 | 20 | /// 21 | /// Gets the conversion result. 22 | /// 23 | public TResult Result { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/GuidToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class GuidToStringConverter : IConverter 9 | { 10 | public string Convert(Guid input) 11 | { 12 | // Use the default format "D" (adds hyphens but not braces): 00000000-0000-0000-0000-000000000000 13 | return input.ToString(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/IConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs 5 | { 6 | /// 7 | /// Defines methods for performing value conversions 8 | /// 9 | /// The input value type. 10 | /// The output value type. 11 | public interface IConverter 12 | { 13 | /// 14 | /// Convert the specified input value. 15 | /// 16 | /// The value to convert 17 | /// The converted value. 18 | TOutput Convert(TInput input); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/IStringToTConverterFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Converters 5 | { 6 | internal interface IStringToTConverterFactory 7 | { 8 | IConverter TryCreate(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/IdentityConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Converters 5 | { 6 | /// 7 | /// A converter that simply returns the value to be converted, 8 | /// without performing any conversions. 9 | /// 10 | /// The being converted. 11 | internal class IdentityConverter : IConverter 12 | { 13 | /// 14 | public TValue Convert(TValue input) 15 | { 16 | return input; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/IdentityStringToTConverterFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Converters 5 | { 6 | internal class IdentityStringToTConverterFactory : IStringToTConverterFactory 7 | { 8 | public IConverter TryCreate() 9 | { 10 | if (typeof(TOutput) != typeof(string)) 11 | { 12 | return null; 13 | } 14 | 15 | return (IConverter)new IdentityConverter(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/Int16ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class Int16ToStringConverter : IConverter 9 | { 10 | public string Convert(short input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/Int32ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class Int32ToStringConverter : IConverter 9 | { 10 | public string Convert(int input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/Int64ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class Int64ToStringConverter : IConverter 9 | { 10 | public string Convert(long input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/SByteToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class SByteToStringConverter : IConverter 9 | { 10 | public string Convert(sbyte input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToBigIntegerConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | using System.Numerics; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToBigIntegerConverter : IConverter 10 | { 11 | public BigInteger Convert(string input) 12 | { 13 | return BigInteger.Parse(input, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToByteConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToByteConverter : IConverter 10 | { 11 | public byte Convert(string input) 12 | { 13 | return Byte.Parse(input, NumberStyles.None, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToDateTimeConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToDateTimeConverter : IConverter 10 | { 11 | public DateTime Convert(string input) 12 | { 13 | return DateTime.ParseExact(input, "O", CultureInfo.InvariantCulture, 14 | DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToDateTimeOffsetConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToDateTimeOffsetConverter : IConverter 10 | { 11 | public DateTimeOffset Convert(string input) 12 | { 13 | return DateTimeOffset.ParseExact(input, "O", CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToDecimalConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToDecimalConverter : IConverter 10 | { 11 | public decimal Convert(string input) 12 | { 13 | return Decimal.Parse(input, NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint, 14 | CultureInfo.InvariantCulture); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToDoubleConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToDoubleConverter : IConverter 10 | { 11 | public double Convert(string input) 12 | { 13 | const NumberStyles FloatWithoutWhitespace = 14 | NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | NumberStyles.AllowExponent; 15 | 16 | return Double.Parse(input, FloatWithoutWhitespace, CultureInfo.InvariantCulture); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToGuidConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class StringToGuidConverter : IConverter 9 | { 10 | public Guid Convert(string input) 11 | { 12 | return Guid.ParseExact(input, "D"); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToInt16Converter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToInt16Converter : IConverter 10 | { 11 | public short Convert(string input) 12 | { 13 | return Int16.Parse(input, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToInt32Converter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToInt32Converter : IConverter 10 | { 11 | public int Convert(string input) 12 | { 13 | return Int32.Parse(input, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToInt64Converter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToInt64Converter : IConverter 10 | { 11 | public long Convert(string input) 12 | { 13 | return Int64.Parse(input, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToSByteConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToSByteConverter : IConverter 10 | { 11 | public sbyte Convert(string input) 12 | { 13 | return SByte.Parse(input, NumberStyles.AllowLeadingSign, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToSingleConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToSingleConverter : IConverter 10 | { 11 | public float Convert(string input) 12 | { 13 | const NumberStyles FloatWithoutWhitespace = NumberStyles.AllowLeadingSign | NumberStyles.AllowDecimalPoint | 14 | NumberStyles.AllowExponent; 15 | 16 | return Single.Parse(input, FloatWithoutWhitespace, CultureInfo.InvariantCulture); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToTConverterFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Converters 5 | { 6 | internal static class StringToTConverterFactory 7 | { 8 | private static readonly IStringToTConverterFactory Singleton = new CompositeStringToTConverterFactory( 9 | new IdentityStringToTConverterFactory(), 10 | new KnownTypesParseToStringConverterFactory(), 11 | new TryParseStringToTConverterFactory(), 12 | new TypeConverterStringToTConverterFactory()); 13 | 14 | public static IStringToTConverterFactory Instance 15 | { 16 | get { return Singleton; } 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToTimeSpanConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToTimeSpanConverter : IConverter 10 | { 11 | public TimeSpan Convert(string input) 12 | { 13 | return TimeSpan.ParseExact(input, "c", CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToUInt16Converter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToUInt16Converter : IConverter 10 | { 11 | public ushort Convert(string input) 12 | { 13 | return UInt16.Parse(input, NumberStyles.None, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToUInt32Converter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToUInt32Converter : IConverter 10 | { 11 | public uint Convert(string input) 12 | { 13 | return UInt32.Parse(input, NumberStyles.None, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/StringToUInt64Converter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class StringToUInt64Converter : IConverter 10 | { 11 | public ulong Convert(string input) 12 | { 13 | return UInt64.Parse(input, NumberStyles.None, CultureInfo.InvariantCulture); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/TryParseDelegate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Converters 5 | { 6 | internal delegate bool TryParseDelegate(string input, out TOutput result); 7 | } 8 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/TypeConverterStringToTConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.ComponentModel; 5 | using System.Diagnostics; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Converters 8 | { 9 | internal class TypeConverterStringToTConverter : IConverter 10 | { 11 | private readonly TypeConverter _typeConverter; 12 | 13 | public TypeConverterStringToTConverter(TypeConverter typeConverter) 14 | { 15 | _typeConverter = typeConverter; 16 | Debug.Assert(typeConverter.CanConvertFrom(typeof(string))); 17 | } 18 | 19 | public TOutput Convert(string input) 20 | { 21 | return (TOutput)_typeConverter.ConvertFrom(input); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/UInt16ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class UInt16ToStringConverter : IConverter 9 | { 10 | public string Convert(ushort input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/UInt32ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class UInt32ToStringConverter : IConverter 9 | { 10 | public string Convert(uint input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Converters/UInt64ToStringConverter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Globalization; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Converters 7 | { 8 | internal class UInt64ToStringConverter : IConverter 9 | { 10 | public string Convert(ulong input) 11 | { 12 | return input.ToString(CultureInfo.InvariantCulture); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Dispatch/IDispatchQueueHandler.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | using Newtonsoft.Json.Linq; 8 | 9 | namespace Microsoft.Azure.WebJobs.Host.Dispatch 10 | { 11 | /// 12 | /// Queue where user can add their function triggering messages, 13 | /// these messages will be distributed to multiple worker instance 14 | /// for later processing 15 | /// 16 | internal interface IDispatchQueueHandler 17 | { 18 | /// Add a message to the shared queue. 19 | /// A JObject to be later processed by IMessageHandler 20 | /// 21 | Task EnqueueAsync(JObject message, CancellationToken cancellationToken); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/BindingSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Bindings; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Executors 9 | { 10 | internal class BindingSource : IBindingSource 11 | { 12 | private readonly IFunctionBinding _binding; 13 | private readonly IDictionary _parameters; 14 | 15 | public BindingSource(IFunctionBinding binding, IDictionary parameters) 16 | { 17 | _binding = binding; 18 | _parameters = parameters; 19 | } 20 | 21 | public Task> BindAsync(ValueBindingContext context) 22 | { 23 | return _binding.BindAsync(context, _parameters); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/DefaultInstanceServicesProviderFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.DependencyInjection; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Executors 7 | { 8 | internal class DefaultInstanceServicesProviderFactory : IInstanceServicesProviderFactory 9 | { 10 | private readonly IServiceScopeFactory _serviceScopeFactory; 11 | 12 | public DefaultInstanceServicesProviderFactory(IServiceScopeFactory serviceScopeFactory) 13 | { 14 | _serviceScopeFactory = serviceScopeFactory; 15 | } 16 | 17 | public IInstanceServicesProvider CreateInstanceServicesProvider(FunctionInstanceFactoryContext functionInstanceFactoryContext) 18 | { 19 | return new DefaultInstanceServicesProvider(_serviceScopeFactory); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/DelayedException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Executors 7 | { 8 | internal class DelayedException : IDelayedException 9 | { 10 | private readonly Exception _exception; 11 | 12 | public DelayedException(Exception exception) 13 | { 14 | _exception = exception; 15 | } 16 | 17 | public Exception Exception 18 | { 19 | get 20 | { 21 | return _exception; 22 | } 23 | } 24 | 25 | public void Throw() 26 | { 27 | throw _exception; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/ExceptionDispatchInfoDelayedException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Runtime.ExceptionServices; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Executors 8 | { 9 | internal class ExceptionDispatchInfoDelayedException : IDelayedException 10 | { 11 | private readonly ExceptionDispatchInfo _exceptionInfo; 12 | 13 | public ExceptionDispatchInfoDelayedException(ExceptionDispatchInfo exceptionInfo) 14 | { 15 | _exceptionInfo = exceptionInfo; 16 | } 17 | 18 | public Exception Exception 19 | { 20 | get 21 | { 22 | return _exceptionInfo.SourceException; 23 | } 24 | } 25 | 26 | public void Throw() 27 | { 28 | _exceptionInfo.Throw(); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/FixedHostIdProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Executors 9 | { 10 | internal class FixedHostIdProvider : IHostIdProvider 11 | { 12 | private readonly string _hostId; 13 | 14 | public FixedHostIdProvider(string hostId) 15 | { 16 | _hostId = hostId; 17 | 18 | if (_hostId == null) 19 | { 20 | _hostId = Guid.NewGuid().ToString("N"); 21 | } 22 | } 23 | 24 | public Task GetHostIdAsync(CancellationToken cancellationToken) 25 | { 26 | return Task.FromResult(_hostId); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/FunctionActivityStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Executors 5 | { 6 | /// 7 | /// Represents activity status the of job host 8 | /// 9 | public class FunctionActivityStatus 10 | { 11 | /// 12 | /// Gets or sets number of outstanding invocations 13 | /// 14 | public int OutstandingInvocations { get; set; } 15 | 16 | /// 17 | /// Gets or sets number of outstanding retries 18 | /// 19 | public int OutstandingRetries { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/FunctionInstanceFactoryContext.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Threading.Tasks; 7 | using Microsoft.Azure.WebJobs.Host.Protocols; 8 | 9 | namespace Microsoft.Azure.WebJobs.Host.Executors 10 | { 11 | public class FunctionInstanceFactoryContext 12 | { 13 | public Guid Id { get; set; } 14 | public IDictionary TriggerDetails { get; set; } 15 | public Guid? ParentId { get; set; } 16 | public ExecutionReason ExecutionReason { get; set; } 17 | public IDictionary Parameters { get; set; } 18 | public Func>, Task> InvokeHandler { get; set; } 19 | } 20 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/FunctionInstanceFactoryContextOfT.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Executors 5 | { 6 | internal class FunctionInstanceFactoryContext : FunctionInstanceFactoryContext 7 | { 8 | public TTriggerValue TriggerValue { get; set; } 9 | } 10 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/FunctionOutputIntervals.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Executors 7 | { 8 | internal static class FunctionOutputIntervals 9 | { 10 | public static readonly TimeSpan InitialDelay = TimeSpan.Zero; 11 | public static readonly TimeSpan RefreshRate = new TimeSpan(0, 1, 0); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/FunctionParameterLogIntervals.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Executors 7 | { 8 | internal static class FunctionParameterLogIntervals 9 | { 10 | public static readonly TimeSpan InitialDelay = new TimeSpan(0, 0, 3); // Wait before first Log, small for initial quick log 11 | public static readonly TimeSpan RefreshRate = new TimeSpan(0, 0, 10); // Between log calls 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/HeartbeatIntervals.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Executors 7 | { 8 | internal static class HeartbeatIntervals 9 | { 10 | public static readonly TimeSpan NormalSignalInterval = new TimeSpan(0, 0, 30); 11 | public static readonly TimeSpan MinimumSignalInterval = new TimeSpan(0, 0, 10); 12 | public static readonly TimeSpan ExpirationInterval = new TimeSpan(0, 0, 45); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IActivatorInstanceFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Executors 5 | { 6 | internal interface IJobInstanceFactory 7 | { 8 | T Create(IFunctionInstanceEx functionInstance); 9 | } 10 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IBindingSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Bindings; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Executors 9 | { 10 | public interface IBindingSource 11 | { 12 | Task> BindAsync(ValueBindingContext context); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IDelayedException.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Executors 7 | { 8 | public interface IDelayedException 9 | { 10 | Exception Exception { get; } 11 | void Throw(); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IFunctionActivityStatusProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Executors 5 | { 6 | /// 7 | /// Interface providing access to job function activity information for the job host. 8 | /// 9 | public interface IFunctionActivityStatusProvider 10 | { 11 | /// 12 | /// Gets the current of the job host. 13 | /// 14 | /// 15 | public FunctionActivityStatus GetStatus(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IFunctionExecutor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Executors 8 | { 9 | public interface IFunctionExecutor 10 | { 11 | Task TryExecuteAsync(IFunctionInstance instance, CancellationToken cancellationToken); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IFunctionInstance.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using Microsoft.Azure.WebJobs.Host.Protocols; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Executors 9 | { 10 | public interface IFunctionInstance 11 | { 12 | Guid Id { get; } 13 | 14 | IDictionary TriggerDetails { get; } 15 | 16 | Guid? ParentId { get; } 17 | 18 | ExecutionReason Reason { get; } 19 | 20 | IBindingSource BindingSource { get; } 21 | 22 | IFunctionInvoker Invoker { get; } 23 | 24 | FunctionDescriptor FunctionDescriptor { get; } 25 | } 26 | 27 | public interface IFunctionInstanceEx : IFunctionInstance 28 | { 29 | IServiceProvider InstanceServices { get; } 30 | } 31 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IFunctionInstanceFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using Microsoft.Azure.WebJobs.Host.Protocols; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Executors 9 | { 10 | public interface IFunctionInstanceFactory 11 | { 12 | IFunctionInstance Create(FunctionInstanceFactoryContext context); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IFunctionInvoker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Executors 8 | { 9 | public interface IFunctionInvoker 10 | { 11 | IReadOnlyList ParameterNames { get; } 12 | 13 | // The cancellation token, if any, is provided along with the other arguments. 14 | // Caller can get an instance via NewInstance(). 15 | // Caller is responsible for calling dispose. 16 | Task InvokeAsync(object instance, object[] arguments); 17 | 18 | // Create an instance that can be passed into Invoke. 19 | // This exists separately so that callers can inspect the instance before it is invoked. 20 | object CreateInstance(); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IFunctionInvokerEx.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | 5 | namespace Microsoft.Azure.WebJobs.Host.Executors 6 | { 7 | internal interface IFunctionInvokerEx : IFunctionInvoker 8 | { 9 | object CreateInstance(IFunctionInstanceEx functionInstance); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IHostIdProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Executors 8 | { 9 | /// 10 | /// Interface for providing a unique host identifier. 11 | /// 12 | public interface IHostIdProvider 13 | { 14 | Task GetHostIdAsync(CancellationToken cancellationToken); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IInstanceServicesProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Executors 7 | { 8 | /// 9 | /// Provides access to an instance-scoped . 10 | /// 11 | public interface IInstanceServicesProvider 12 | { 13 | IServiceProvider InstanceServices { get; set; } 14 | } 15 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IInstanceServicesProviderFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Executors 5 | { 6 | /// 7 | /// Factory for creating instances. 8 | /// 9 | public interface IInstanceServicesProviderFactory 10 | { 11 | IInstanceServicesProvider CreateInstanceServicesProvider(FunctionInstanceFactoryContext functionInstance); 12 | } 13 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IJobHostContextFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host.Executors 11 | { 12 | public interface IJobHostContextFactory 13 | { 14 | Task Create(JobHost host, CancellationToken shutdownToken, CancellationToken cancellationToken); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/IRetryNotifier .cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | namespace Microsoft.Azure.WebJobs.Host.Executors 4 | { 5 | internal interface IRetryNotifier 6 | { 7 | void RetryPending(); 8 | 9 | void RetryComplete(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/MethodInvokerWithReturnValue.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Executors 8 | { 9 | internal class MethodInvokerWithReturnValue : IMethodInvoker 10 | { 11 | private readonly Func _lambda; 12 | 13 | public MethodInvokerWithReturnValue(Func lambda) 14 | { 15 | _lambda = lambda; 16 | } 17 | 18 | public Task InvokeAsync(TReflected instance, object[] arguments) 19 | { 20 | TReturnValue result = _lambda.Invoke(instance, arguments); 21 | return Task.FromResult(result); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/NullInstanceFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Executors 5 | { 6 | internal class NullInstanceFactory : IJobInstanceFactory 7 | { 8 | private NullInstanceFactory() 9 | { 10 | } 11 | 12 | public static NullInstanceFactory Instance { get; } = new NullInstanceFactory(); 13 | 14 | public TReflected Create(IFunctionInstanceEx functionInstance) 15 | { 16 | return default(TReflected); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/VoidMethodInvoker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Executors 8 | { 9 | internal class VoidMethodInvoker : IMethodInvoker 10 | { 11 | private readonly Action _lambda; 12 | 13 | public VoidMethodInvoker(Action lambda) 14 | { 15 | _lambda = lambda; 16 | } 17 | 18 | public Task InvokeAsync(TReflected instance, object[] arguments) 19 | { 20 | _lambda.Invoke(instance, arguments); 21 | return Task.FromResult(default(TReturnValue)); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Executors/VoidTaskMethodInvoker.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Executors 8 | { 9 | internal class VoidTaskMethodInvoker : IMethodInvoker 10 | { 11 | private readonly Func _lambda; 12 | 13 | public VoidTaskMethodInvoker(Func lambda) 14 | { 15 | _lambda = lambda; 16 | } 17 | 18 | public async Task InvokeAsync(TReflected instance, object[] arguments) 19 | { 20 | await _lambda.Invoke(instance, arguments); 21 | return default(TReturnType); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Extensions/FunctionMetadata .cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | /// 7 | /// Represents method metadata. 8 | /// 9 | public class FunctionMetadata 10 | { 11 | /// 12 | /// Gets or sets whether this method is disabled. 13 | /// 14 | public bool IsDisabled {get; set;} 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Extensions/IJobHostMetadataProviderFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | public interface IJobHostMetadataProviderFactory 7 | { 8 | IJobHostMetadataProvider Create(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Filters/FunctionExceptionFilterAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host 9 | { 10 | /// 11 | /// Base class for declarative function exception filters. 12 | /// 13 | [Obsolete("Filters is in preview and there may be breaking changes in this area.")] 14 | [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = true, Inherited = true)] 15 | public abstract class FunctionExceptionFilterAttribute : Attribute, IFunctionExceptionFilter 16 | { 17 | /// 18 | public abstract Task OnExceptionAsync(FunctionExceptionContext exceptionContext, CancellationToken cancellationToken); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Filters/IFunctionFilter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | /// 9 | /// Base (marker) interface for all function filters. 10 | /// 11 | [Obsolete("Filters is in preview and there may be breaking changes in this area.")] 12 | public interface IFunctionFilter 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/HostContainerNames.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | // Names of containers used only by hosts (not directly part of the protocol with the dashboard, though other parts 7 | // may point to blobs stored here). 8 | internal static class HostContainerNames 9 | { 10 | // Note that sometimes this container name is used for the Storage account and sometimes for the Dasboard 11 | // account. These containers happen to be the same when the accounts are the same. 12 | public const string Hosts = "azure-webjobs-hosts"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/HostDirectoryNames.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Protocols; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | // Names of directories used only by hosts (not directly part of the protocol with the dashboard, though other parts 9 | // may point to blobs stored here). 10 | internal static class HostDirectoryNames 11 | { 12 | public const string BlobReceipts = "blobreceipts"; 13 | 14 | public const string Heartbeats = "heartbeats"; 15 | 16 | public const string Ids = "ids"; 17 | 18 | public const string OutputLogs = "output-logs"; 19 | 20 | public const string SingletonLocks = "locks"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/FunctionDataCache/SharedMemoryMetadata.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs 5 | { 6 | /// 7 | /// Class describing a shared memory region. 8 | /// 9 | public class SharedMemoryMetadata 10 | { 11 | public SharedMemoryMetadata(string memoryMapName, long count) 12 | { 13 | MemoryMapName = memoryMapName; 14 | Count = count; 15 | } 16 | 17 | /// 18 | /// Name of the shared memory region. 19 | /// 20 | public string MemoryMapName { get; private set; } 21 | 22 | /// 23 | /// Number of bytes of content in the shared memory region. 24 | /// 25 | public long Count { get; private set; } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IDrainModeManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Listeners; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Threading; 8 | using System.Threading.Tasks; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host 11 | { 12 | public interface IDrainModeManager 13 | { 14 | bool IsDrainModeEnabled { get; } 15 | 16 | void RegisterListener(IListener listener); 17 | 18 | Task EnableDrainModeAsync(CancellationToken cancellationToken); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IPrimaryHostStateProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | // Type was moved from https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script/Host/IPrimaryHostStateProvider.cs 5 | 6 | namespace Microsoft.Azure.WebJobs.Hosting 7 | { 8 | /// 9 | /// Provides access to the primary host state. When an application is running on multiple 10 | /// scaled out instances, only one instance will be primary. 11 | /// 12 | /// 13 | /// See for more information. 14 | /// 15 | public interface IPrimaryHostStateProvider 16 | { 17 | /// 18 | /// Gets or sets a value indicating whether the currently running host is "Primary". 19 | /// 20 | bool IsPrimary { get; set; } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/ITrackedConfigurationBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using Microsoft.Extensions.Configuration; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Hosting 8 | { 9 | internal interface ITrackedConfigurationBuilder 10 | { 11 | IConfigurationBuilder ConfigurationBuilder { get; set; } 12 | 13 | IEnumerable TrackedConfigurationSources { get; } 14 | 15 | void ResetTracking(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/ITrackedServiceCollection.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using Microsoft.Extensions.DependencyInjection; 6 | 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Hosting 9 | { 10 | internal interface ITrackedServiceCollection 11 | { 12 | IServiceCollection ServiceCollection { get; set; } 13 | 14 | IEnumerable TrackedCollectionChanges { get; } 15 | 16 | void ResetTracking(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IWebJobsBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.DependencyInjection; 5 | 6 | namespace Microsoft.Azure.WebJobs 7 | { 8 | public interface IWebJobsBuilder 9 | { 10 | /// 11 | /// Gets the where WebJobs services are configured. 12 | /// 13 | IServiceCollection Services { get; } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IWebJobsConfigurationBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.Configuration; 5 | 6 | namespace Microsoft.Azure.WebJobs.Hosting 7 | { 8 | public interface IWebJobsConfigurationBuilder 9 | { 10 | IConfigurationBuilder ConfigurationBuilder { get; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IWebJobsExtensionBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Microsoft.Azure.WebJobs.Host; 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | namespace Microsoft.Azure.WebJobs 11 | { 12 | public interface IWebJobsExtensionBuilder 13 | { 14 | /// 15 | /// Gets the where WebJobs extension services are configured. 16 | /// 17 | IServiceCollection Services { get; } 18 | 19 | /// 20 | /// Gets an instance containing information about the extension being configured by this builder. 21 | /// 22 | ExtensionInfo ExtensionInfo { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IWebJobsStartup.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Hosting 7 | { 8 | /// 9 | /// Interface defining a startup configuration action that should be performed 10 | /// as part of host startup. 11 | /// 12 | public interface IWebJobsStartup 13 | { 14 | /// 15 | /// Performs the startup configuration action. The host will call this 16 | /// method at the right time during host initialization. 17 | /// 18 | /// The that can be used to 19 | /// configure the host. 20 | void Configure(IWebJobsBuilder builder); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IWebJobsStartup2.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Hosting 5 | { 6 | /// 7 | /// Interface defining a startup configuration action that should be performed 8 | /// as part of host startup. 9 | /// 10 | public interface IWebJobsStartup2 : IWebJobsStartup 11 | { 12 | /// 13 | /// Performs the startup configuration action. The host will call this 14 | /// method at the right time during host initialization. 15 | /// 16 | /// The builder context 17 | /// The that can be used to 18 | /// configure the host. 19 | void Configure(WebJobsBuilderContext context, IWebJobsBuilder builder); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/IWebJobsStartupTypeLocator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | 8 | namespace Microsoft.Azure.WebJobs.Hosting 9 | { 10 | public interface IWebJobsStartupTypeLocator 11 | { 12 | Type[] GetStartupTypes(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/OptionsFormatter/IOptionsFormatter.Generic.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | 5 | namespace Microsoft.Azure.WebJobs.Hosting 6 | { 7 | /// 8 | /// Allows framework Options types to be registered with an IOptionsFormatter. 9 | /// 10 | /// The options type. 11 | public interface IOptionsFormatter 12 | { 13 | /// 14 | /// Creates a string to be logged when the options are created from the IOptionsFactory. 15 | /// The returned value should be a JSON string with all secrets removed. 16 | /// 17 | /// A JSON string representing the options, with all secrets removed. 18 | string Format(TOptions options); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/OptionsFormatter/IOptionsFormatter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Hosting 5 | { 6 | public interface IOptionsFormatter 7 | { 8 | /// 9 | /// Creates a string to be logged when the options are created from the IOptionsFactory. 10 | /// The returned value should be a JSON string with all secrets removed. 11 | /// 12 | /// A JSON string representing the options, with all secrets removed. 13 | string Format(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/OptionsFormatter/IOptionsLoggingSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks.Dataflow; 5 | 6 | namespace Microsoft.Azure.WebJobs.Hosting 7 | { 8 | internal interface IOptionsLoggingSource 9 | { 10 | ISourceBlock LogStream { get; } 11 | 12 | void LogOptions(string optionLog); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/OptionsFormatter/OptionsLoggingSource.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks.Dataflow; 5 | 6 | namespace Microsoft.Azure.WebJobs.Hosting 7 | { 8 | internal class OptionsLoggingSource : IOptionsLoggingSource 9 | { 10 | private readonly BufferBlock _buffer = new BufferBlock(); 11 | 12 | public ISourceBlock LogStream => _buffer; 13 | 14 | public void LogOptions(string optionLog) 15 | { 16 | _buffer.Post(optionLog); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/PrimaryHostStateProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | // Type was moved from https://github.com/Azure/azure-functions-host/blob/dev/src/WebJobs.Script/Host/PrimaryHostStateProvider.cs 5 | 6 | namespace Microsoft.Azure.WebJobs.Hosting 7 | { 8 | internal class PrimaryHostStateProvider : IPrimaryHostStateProvider 9 | { 10 | public bool IsPrimary { get; set; } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/WebJobsBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Microsoft.Azure.WebJobs.Host.Hosting; 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host 11 | { 12 | internal class WebJobsBuilder : IWebJobsBuilder 13 | { 14 | public WebJobsBuilder(IServiceCollection services) 15 | { 16 | if (services == null) 17 | { 18 | throw new ArgumentNullException(nameof(services)); 19 | } 20 | 21 | Services = new TrackedServiceCollection(services); 22 | } 23 | 24 | public IServiceCollection Services { get; } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/WebJobsConfigurationBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Azure.WebJobs.Host.Hosting; 6 | using Microsoft.Extensions.Configuration; 7 | 8 | namespace Microsoft.Azure.WebJobs.Hosting 9 | { 10 | internal class WebJobsConfigurationBuilder : IWebJobsConfigurationBuilder 11 | { 12 | public WebJobsConfigurationBuilder(IConfigurationBuilder builder) 13 | { 14 | if (builder == null) 15 | { 16 | throw new ArgumentNullException(nameof(builder)); 17 | } 18 | 19 | ConfigurationBuilder = new TrackedConfigurationBuilder(builder); 20 | } 21 | 22 | public IConfigurationBuilder ConfigurationBuilder { get; private set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Hosting/WebJobsExtensionBuilder.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Microsoft.Azure.WebJobs.Host.Config; 8 | using Microsoft.Extensions.DependencyInjection; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host.Hosting 11 | { 12 | internal class WebJobsExtensionBuilder : IWebJobsExtensionBuilder 13 | { 14 | public WebJobsExtensionBuilder(IServiceCollection services, ExtensionInfo extentionInfo) 15 | { 16 | Services = services ?? throw new ArgumentNullException(nameof(services)); 17 | ExtensionInfo = extentionInfo ?? throw new ArgumentNullException(nameof(extentionInfo)); 18 | } 19 | 20 | public IServiceCollection Services { get; } 21 | 22 | public ExtensionInfo ExtensionInfo { get; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IContextGetter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | internal interface IContextGetter 7 | { 8 | TValue Value { get; } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IContextSetter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | internal interface IContextSetter 7 | { 8 | void SetValue(TValue value); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IExtensionRegistryFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | public interface IExtensionRegistryFactory 7 | { 8 | IExtensionRegistry Create(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | internal interface IFactory 7 | { 8 | T Create(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IJobActivator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | /// 7 | /// Defines an activator that creates an instance of a job type. 8 | /// 9 | public interface IJobActivator 10 | { 11 | /// 12 | /// Creates a new instance of a job type. 13 | /// 14 | /// The job type. 15 | /// A new instance of the job type. 16 | T CreateInstance(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IJobActivatorEx.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Executors; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | /// 9 | /// Defines an activator that creates an instance of a job type. 10 | /// 11 | public interface IJobActivatorEx : IJobActivator 12 | { 13 | /// 14 | /// Creates a new instance of a job type. 15 | /// 16 | /// The job type. 17 | /// A new instance of the job type. 18 | T CreateInstance(IFunctionInstanceEx functionInstance); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IJobHost.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace Microsoft.Azure.WebJobs 10 | { 11 | public interface IJobHost 12 | { 13 | Task CallAsync(string name, IDictionary arguments = null, CancellationToken cancellationToken = default(CancellationToken)); 14 | 15 | Task StartAsync(CancellationToken cancellationToken); 16 | 17 | Task StopAsync(); 18 | } 19 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/INameResolver.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs 5 | { 6 | /// Defines a resolver for %name% variables in attribute values. 7 | public interface INameResolver 8 | { 9 | /// 10 | /// Resolve a %name% to a value. Resolution is not recursive. 11 | /// 12 | /// The name to resolve (without the %... %) 13 | /// The value to which the name resolves, if the name is supported; otherwise . 14 | string Resolve(string name); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IPropertyAccessorFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | internal interface IPropertyAccessorFactory 9 | { 10 | IPropertyGetter CreateGetter(PropertyInfo property); 11 | 12 | IPropertySetter CreateSetter(PropertyInfo property); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IPropertyGetter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | internal interface IPropertyGetter 7 | { 8 | TProperty GetValue(TReflected instance); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IPropertySetter.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | internal interface IPropertySetter 7 | { 8 | void SetValue(ref TReflected instance, TProperty value); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/IRetryStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | /// 9 | /// Defines a retry delay strategy for failed function invocations. 10 | /// 11 | public interface IRetryStrategy 12 | { 13 | /// 14 | /// Gets the maximum number of retries allowed. 15 | /// 16 | int MaxRetryCount { get; } 17 | 18 | /// 19 | /// Gets the next delay that should be used before the next retry. 20 | /// 21 | /// Context for the failed invocation. 22 | /// A representing the delay. 23 | TimeSpan GetNextDelay(RetryContext context); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/ITypeLocator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Microsoft.Azure.WebJobs 8 | { 9 | /// Defines a locator that identifies types that may contain functions for to execute. 10 | public interface ITypeLocator 11 | { 12 | /// Retrieves types that may contain functions for to execute. 13 | /// Types that may contain functions for to execute. 14 | IReadOnlyList GetTypes(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Indexers/IFunctionDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Executors; 5 | using Microsoft.Azure.WebJobs.Host.Listeners; 6 | using Microsoft.Azure.WebJobs.Host.Protocols; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Indexers 9 | { 10 | public interface IFunctionDefinition 11 | { 12 | FunctionDescriptor Descriptor { get; } 13 | 14 | IFunctionInstanceFactory InstanceFactory { get; } 15 | 16 | IListenerFactory ListenerFactory { get; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Indexers/IFunctionIndex.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Reflection; 6 | using Microsoft.Azure.WebJobs.Host.Protocols; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Indexers 9 | { 10 | internal interface IFunctionIndex : IFunctionIndexLookup 11 | { 12 | IEnumerable ReadAll(); 13 | 14 | IEnumerable ReadAllDescriptors(); 15 | 16 | IEnumerable ReadAllMethods(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Indexers/IFunctionIndexCollector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | using Microsoft.Azure.WebJobs.Host.Protocols; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Indexers 8 | { 9 | internal interface IFunctionIndexCollector 10 | { 11 | void Add(IFunctionDefinition function, FunctionDescriptor descriptor, MethodInfo method); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Indexers/IFunctionIndexLookup.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Indexers 7 | { 8 | public interface IFunctionIndexLookup 9 | { 10 | IFunctionDefinition Lookup(string functionId); 11 | 12 | IFunctionDefinition Lookup(MethodInfo method); 13 | 14 | // This uses the function's short name ("Class.Method"), which can also be overriden 15 | // by the FunctionName attribute. 16 | IFunctionDefinition LookupByName(string name); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Indexers/IFunctionIndexProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Indexers 8 | { 9 | internal interface IFunctionIndexProvider 10 | { 11 | Task GetAsync(CancellationToken cancellationToken); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Listeners/IListenerDecorator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Listeners 5 | { 6 | /// 7 | /// Custom decorator interface called during listener creation to 8 | /// allow function listeners to be customized. 9 | /// 10 | public interface IListenerDecorator 11 | { 12 | /// 13 | /// Creates a listener. 14 | /// 15 | /// The listener context. 16 | /// The listener to use. This may be a new wrapped listener, or the original 17 | /// listener. 18 | IListener Decorate(ListenerDecoratorContext context); 19 | } 20 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Listeners/IListenerFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Listeners 8 | { 9 | /// 10 | /// Interface defining methods used to create s for 11 | /// trigger parameter bindings. 12 | /// 13 | public interface IListenerFactory 14 | { 15 | /// 16 | /// Creates a listener. 17 | /// 18 | /// A . 19 | /// The listener. 20 | Task CreateAsync(CancellationToken token); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Listeners/ISharedContextProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Listeners 5 | { 6 | /// 7 | /// Interface for providing host level state persistence. 8 | /// A new instance of the provider is created when a host 9 | /// is constructed. 10 | /// 11 | internal interface ISharedContextProvider 12 | { 13 | bool TryGetValue(string key, out object value); 14 | 15 | void SetValue(string key, object value); 16 | 17 | TValue GetOrCreateInstance(IFactory factory); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Listeners/ISharedListener.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Listeners 9 | { 10 | internal interface ISharedListener : IDisposable 11 | { 12 | void EnsureAllCanceled(); 13 | 14 | Task EnsureAllStartedAsync(CancellationToken cancellationToken); 15 | 16 | Task EnsureAllStoppedAsync(CancellationToken cancellationToken); 17 | 18 | void EnsureAllDisposed(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Listeners/ITriggerExecutor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Executors; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Listeners 9 | { 10 | internal interface ITriggerExecutor 11 | { 12 | Task ExecuteAsync(TTriggerValue value, CancellationToken cancellationToken); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Listeners/NullListener.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Listeners 8 | { 9 | internal sealed class NullListener : IListener 10 | { 11 | public Task StartAsync(CancellationToken cancellationToken) 12 | { 13 | return Task.FromResult(0); 14 | } 15 | 16 | public Task StopAsync(CancellationToken cancellationToken) 17 | { 18 | return Task.FromResult(0); 19 | } 20 | 21 | public void Cancel() 22 | { 23 | } 24 | 25 | public void Dispose() 26 | { 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Listeners/NullListenerFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Diagnostics.CodeAnalysis; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Listeners 9 | { 10 | internal class NullListenerFactory : IListenerFactory 11 | { 12 | [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")] 13 | public Task CreateAsync(CancellationToken cancellationToken) 14 | { 15 | IListener listener = new NullListener(); 16 | return Task.FromResult(listener); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IEventCollectorFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Loggers 5 | { 6 | // $$$ Also Need to register FastTableLoggerProvider so that the log messages get properly created. 7 | public interface IEventCollectorFactory 8 | { 9 | IAsyncCollector Create(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IEventCollectorProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Loggers 5 | { 6 | public interface IEventCollectorProvider 7 | { 8 | IAsyncCollector Create(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IFunctionInstanceLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Protocols; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Loggers 7 | { 8 | // This is a DI interface. 9 | internal interface IFunctionInstanceLogger 10 | { 11 | string LogFunctionStarted(FunctionStartedMessage message); 12 | 13 | void LogFunctionCompleted(FunctionCompletedMessage message); 14 | 15 | void DeleteLogFunctionStarted(string startedMessageId); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IFunctionInstanceLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Loggers 8 | { 9 | internal interface IFunctionInstanceLoggerProvider 10 | { 11 | Task GetAsync(CancellationToken cancellationToken); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IFunctionOutput.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.IO; 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | using Microsoft.Azure.WebJobs.Host.Timers; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host.Loggers 11 | { 12 | internal interface IFunctionOutput : IDisposable 13 | { 14 | IRecurrentCommand UpdateCommand { get; } 15 | 16 | // Get a text writer for logging. A user function can get this via model binding to a 'TextWriter'. 17 | // The logging provider determines the backing storage for this. 18 | TextWriter Output { get; } 19 | 20 | // Copy the output contents the logEntry. 21 | Task SaveAndCloseAsync(FunctionInstanceLogEntry logEntry, CancellationToken cancellationToken); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IFunctionOutputDefinition.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using Microsoft.Azure.WebJobs.Host.Bindings; 6 | using Microsoft.Azure.WebJobs.Host.Protocols; 7 | using Microsoft.Azure.WebJobs.Host.Timers; 8 | using Microsoft.Extensions.Logging; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host.Loggers 11 | { 12 | internal interface IFunctionOutputDefinition 13 | { 14 | LocalBlobDescriptor OutputBlob { get; } 15 | 16 | LocalBlobDescriptor ParameterLogBlob { get; } 17 | 18 | IFunctionOutput CreateOutput(); 19 | 20 | IRecurrentCommand CreateParameterLogUpdateCommand(IReadOnlyDictionary watches, ILogger logger); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IFunctionOutputLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Executors; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Loggers 9 | { 10 | internal interface IFunctionOutputLogger 11 | { 12 | Task CreateAsync(IFunctionInstance instance, CancellationToken cancellationToken); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IFunctionOutputLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Loggers 8 | { 9 | internal interface IFunctionOutputLoggerProvider 10 | { 11 | Task GetAsync(CancellationToken cancellationToken); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IFunctionParameterLog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Azure.WebJobs.Host.Timers; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Loggers 8 | { 9 | internal interface IFunctionParameterLog : IDisposable 10 | { 11 | IRecurrentCommand UpdateCommand { get; } 12 | 13 | void Close(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IHostInstanceLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Protocols; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Loggers 9 | { 10 | internal interface IHostInstanceLogger 11 | { 12 | Task LogHostStartedAsync(HostStartedMessage message, CancellationToken cancellationToken); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/IHostInstanceLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Loggers 8 | { 9 | internal interface IHostInstanceLoggerProvider 10 | { 11 | Task GetAsync(CancellationToken cancellationToken); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/Logger/Aggregator/FunctionResultAggregate.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Logging 7 | { 8 | internal class FunctionResultAggregate 9 | { 10 | public string Name { get; set; } 11 | public DateTimeOffset Timestamp { get; set; } 12 | public TimeSpan AverageDuration { get; set; } 13 | public TimeSpan MaxDuration { get; set; } 14 | public TimeSpan MinDuration { get; set; } 15 | public int Successes { get; set; } 16 | public int Failures { get; set; } 17 | public int Count => Successes + Failures; 18 | public double SuccessRate => Math.Round((Successes / (double)Count) * 100, 2); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/Logger/FunctionOutputLogger/FunctionOutputLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.Logging; 5 | 6 | namespace Microsoft.Azure.WebJobs.Logging 7 | { 8 | internal class FunctionOutputLoggerProvider : ILoggerProvider 9 | { 10 | public ILogger CreateLogger(string categoryName) 11 | { 12 | return new FunctionOutputLogger(categoryName); 13 | } 14 | 15 | public void Dispose() 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/NullFunctionOutputLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Executors; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Loggers 9 | { 10 | internal class NullFunctionOutputLogger : IFunctionOutputLogger 11 | { 12 | public Task CreateAsync(IFunctionInstance instance, CancellationToken cancellationToken) 13 | { 14 | return Task.FromResult(NullFunctionOutputDefinition.Instance); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Loggers/NullHostInstanceLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Protocols; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Loggers 9 | { 10 | internal class NullHostInstanceLogger : IHostInstanceLogger 11 | { 12 | public Task LogHostStartedAsync(HostStartedMessage message, CancellationToken cancellationToken) 13 | { 14 | return Task.FromResult(0); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/NativeMethods.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Runtime.InteropServices; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host 8 | { 9 | internal static class NativeMethods 10 | { 11 | [DllImport("kernel32.dll")] 12 | public static extern IntPtr GetCurrentProcess(); 13 | 14 | [DllImport("kernel32.dll", SetLastError = true)] 15 | [return: MarshalAs(UnmanagedType.Bool)] 16 | public static extern bool TerminateProcess(IntPtr hProcess, uint uExitCode); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/AbortHostInstanceMessage.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a request to abort the host instance. 11 | [JsonTypeName("Abort")] 12 | #if PUBLICPROTOCOL 13 | public class AbortHostInstanceMessage : HostMessage 14 | #else 15 | internal class AbortHostInstanceMessage : HostMessage 16 | #endif 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/BinderParameterDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a parameter bound to an IBinder. 11 | [JsonTypeName("IBinder")] 12 | #if PUBLICPROTOCOL 13 | public class BinderParameterDescriptor : ParameterDescriptor 14 | #else 15 | internal class BinderParameterDescriptor : ParameterDescriptor 16 | #endif 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/BinderParameterLog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | 6 | #if PUBLICPROTOCOL 7 | namespace Microsoft.Azure.WebJobs.Protocols 8 | #else 9 | namespace Microsoft.Azure.WebJobs.Host.Protocols 10 | #endif 11 | { 12 | /// Represents a function parameter log for a runtime binder parameter. 13 | [JsonTypeName("IBinder")] 14 | #if PUBLICPROTOCOL 15 | public class BinderParameterLog : ParameterLog 16 | #else 17 | internal class BinderParameterLog : ParameterLog 18 | #endif 19 | { 20 | /// Gets or sets the items bound. 21 | public IEnumerable Items { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/BindingDataParameterDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a parameter bound to binding data. 11 | [JsonTypeName("BindingData")] 12 | #if PUBLICPROTOCOL 13 | public class BindingDataParameterDescriptor : ParameterDescriptor 14 | #else 15 | internal class BindingDataParameterDescriptor : ParameterDescriptor 16 | #endif 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/BlobMetadataKeys.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Provides well-known blob metadata keys. 11 | #if PUBLICPROTOCOL 12 | public static class BlobMetadataKeys 13 | #else 14 | internal static class BlobMetadataKeys 15 | #endif 16 | { 17 | /// 18 | /// Gets the name of the blob metadata key used to store ID of the function instance that wrote the blob. 19 | /// 20 | public static readonly string ParentId = "AzureWebJobsParentId"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/CallerSuppliedParameterDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a parameter bound to a caller-supplied value. 11 | [JsonTypeName("CallerSupplied")] 12 | #if PUBLICPROTOCOL 13 | public class CallerSuppliedParameterDescriptor : ParameterDescriptor 14 | #else 15 | internal class CallerSuppliedParameterDescriptor : ParameterDescriptor 16 | #endif 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/CancellationTokenParameterDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a parameter bound to a cancellation token. 11 | [JsonTypeName("CancellationToken")] 12 | #if PUBLICPROTOCOL 13 | public class CancellationTokenParameterDescriptor : ParameterDescriptor 14 | #else 15 | internal class CancellationTokenParameterDescriptor : ParameterDescriptor 16 | #endif 17 | { 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/CloudStorageAccountParameterDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a parameter bound to an Azure Storage account. 11 | [JsonTypeName("CloudStorageAccount")] 12 | #if PUBLICPROTOCOL 13 | public class CloudStorageAccountParameterDescriptor : ParameterDescriptor 14 | #else 15 | internal class CloudStorageAccountParameterDescriptor : ParameterDescriptor 16 | #endif 17 | { 18 | /// Gets or sets the name of the storage account. 19 | public string AccountName { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/ConsoleOutputParameterDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.IO; 5 | 6 | #if PUBLICPROTOCOL 7 | namespace Microsoft.Azure.WebJobs.Protocols 8 | #else 9 | namespace Microsoft.Azure.WebJobs.Host.Protocols 10 | #endif 11 | { 12 | /// Represents a parameter bound to a for console output. 13 | [JsonTypeName("ConsoleOutput")] 14 | #if PUBLICPROTOCOL 15 | public class ConsoleOutputParameterDescriptor : ParameterDescriptor 16 | #else 17 | internal class ConsoleOutputParameterDescriptor : ParameterDescriptor 18 | #endif 19 | { 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/DictionaryExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | #if PUBLICPROTOCOL 8 | namespace Microsoft.Azure.WebJobs.Protocols 9 | #else 10 | namespace Microsoft.Azure.WebJobs.Host.Protocols 11 | #endif 12 | { 13 | internal static class DictionaryExtensions 14 | { 15 | public static void RemoveIfContainsKey(this IDictionary dictionary, TKey key) 16 | { 17 | if (dictionary == null) 18 | { 19 | throw new ArgumentNullException("dictionary"); 20 | } 21 | 22 | if (dictionary.ContainsKey(key)) 23 | { 24 | dictionary.Remove(key); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/ExecutionReason.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Newtonsoft.Json; 5 | using Newtonsoft.Json.Converters; 6 | 7 | #if PUBLICPROTOCOL 8 | namespace Microsoft.Azure.WebJobs.Protocols 9 | #else 10 | namespace Microsoft.Azure.WebJobs.Host.Protocols 11 | #endif 12 | { 13 | /// Defines constants for reasons a function is executed. 14 | [JsonConverter(typeof(StringEnumConverter))] 15 | public enum ExecutionReason 16 | { 17 | /// Indicates a function executed because of an automatic trigger. 18 | AutomaticTrigger, 19 | 20 | /// Indicates a function executed because of a programmatic host call. 21 | HostCall, 22 | 23 | /// Indicates a function executed because of a request from a dashboard user. 24 | Dashboard 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/LocalBlobDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a blob in the same storage account as the entity that references it. 11 | #if PUBLICPROTOCOL 12 | public class LocalBlobDescriptor 13 | #else 14 | internal class LocalBlobDescriptor 15 | #endif 16 | { 17 | /// Gets or sets the container name. 18 | public string ContainerName { get; set; } 19 | 20 | /// Gets or sets the blob name. 21 | public string BlobName { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/NullHeartbeatCommand.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | #if PUBLICPROTOCOL 8 | namespace Microsoft.Azure.WebJobs.Protocols 9 | #else 10 | namespace Microsoft.Azure.WebJobs.Host.Protocols 11 | #endif 12 | { 13 | /// Represents a null object implementation of . 14 | #if PUBLICPROTOCOL 15 | public class NullHeartbeatCommand : IHeartbeatCommand 16 | #else 17 | internal class NullHeartbeatCommand : IHeartbeatCommand 18 | #endif 19 | { 20 | /// 21 | public Task BeatAsync(CancellationToken cancellationToken) 22 | { 23 | return Task.FromResult(0); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/TextParameterLog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a function parameter log stored as text. 11 | [JsonTypeName("Text")] 12 | #if PUBLICPROTOCOL 13 | public class TextParameterLog : ParameterLog 14 | #else 15 | internal class TextParameterLog : ParameterLog 16 | #endif 17 | { 18 | /// Gets or sets the log contents. 19 | public string Value { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/WebJobTypes.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Newtonsoft.Json; 5 | using Newtonsoft.Json.Converters; 6 | 7 | #if PUBLICPROTOCOL 8 | namespace Microsoft.Azure.WebJobs.Protocols 9 | #else 10 | namespace Microsoft.Azure.WebJobs.Host.Protocols 11 | #endif 12 | { 13 | /// Represents the WebJob type. 14 | [JsonConverter(typeof(StringEnumConverter))] 15 | #if PUBLICPROTOCOL 16 | public enum WebJobTypes 17 | #else 18 | internal enum WebJobTypes 19 | #endif 20 | { 21 | /// The WebJob runs when triggered. 22 | Triggered, 23 | 24 | /// The WebJob runs continuously. 25 | Continuous 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Protocols/WriteBlobParameterLog.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #if PUBLICPROTOCOL 5 | namespace Microsoft.Azure.WebJobs.Protocols 6 | #else 7 | namespace Microsoft.Azure.WebJobs.Host.Protocols 8 | #endif 9 | { 10 | /// Represents a function parameter log for a write-only blob parameter. 11 | [JsonTypeName("WriteBlob")] 12 | #if PUBLICPROTOCOL 13 | public class WriteBlobParameterLog : ParameterLog 14 | #else 15 | internal class WriteBlobParameterLog : ParameterLog 16 | #endif 17 | { 18 | /// Gets or sets a value indicating whether the blob was written at all. 19 | public bool WasWritten { get; set; } 20 | 21 | /// When the blob was written, gets or sets the number of bytes written. 22 | public long? BytesWritten { get; set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/README.md: -------------------------------------------------------------------------------- 1 | # Microsoft.Azure.WebJobs.Host 2 | 3 | This package contains the runtime host components of the WebJobs SDK. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 4 | 5 | ## Commonly used types 6 | 7 | - `WebJobsHostBuilderExtensions` 8 | - `JobHost` 9 | - `IExtensionConfigProvider` 10 | 11 | ## Example usage 12 | 13 | The below example demonstrates configuration and startup of a job host running in a console application. 14 | 15 | ``` CSharp 16 | using System.Threading.Tasks; 17 | using Microsoft.Extensions.Hosting; 18 | 19 | class Program 20 | { 21 | public static async Task Main(string[] args) 22 | { 23 | var builder = Host.CreateDefaultBuilder(args) 24 | .ConfigureWebJobs(b => 25 | { 26 | b.AddAzureStorageCoreServices(); 27 | b.AddAzureStorageQueues(); 28 | }); 29 | 30 | using var host = builder.Build(); 31 | await host.RunAsync(); 32 | } 33 | } 34 | ``` -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/ConcurrencyThrottleStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #nullable enable 5 | 6 | using System.Collections.Generic; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Scale 9 | { 10 | /// 11 | /// Represents an throttle result. 12 | /// 13 | public class ConcurrencyThrottleStatus 14 | { 15 | /// 16 | /// Gets or sets current throttle state. 17 | /// 18 | public ThrottleState State { get; set; } 19 | 20 | /// 21 | /// Gets or sets the collection of currently enabled throttles. 22 | /// 23 | public ICollection? EnabledThrottles { get; set; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/HostHealthState.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Enumeration of the possible host health status states. 8 | /// 9 | public enum HostHealthState 10 | { 11 | /// 12 | /// Not enough information to determine the state. 13 | /// 14 | Unknown, 15 | 16 | /// 17 | /// The host is under pressure and is currently overloaded. 18 | /// 19 | Overloaded, 20 | 21 | /// 22 | /// The host is currently in a healthy state. 23 | /// 24 | Ok 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/HostProcessStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Scale 7 | { 8 | /// 9 | /// Represents the health status of the host process. 10 | /// 11 | public class HostProcessStatus 12 | { 13 | /// 14 | /// Gets the current health status of the host. 15 | /// 16 | public HostHealthState State { get; set; } 17 | 18 | /// 19 | /// Gets the collection of currently exceeded limits. 20 | /// 21 | public ICollection ExceededLimits { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/IConcurrencyThrottleManager.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Provides aggregated access to all registered instances. 8 | /// 9 | public interface IConcurrencyThrottleManager 10 | { 11 | /// 12 | /// Gets a an aggregate throttle status by querying all registered . 13 | /// instances. 14 | /// 15 | /// The current . 16 | ConcurrencyThrottleAggregateStatus GetStatus(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/IScaleMonitorProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Provider interface for returning an instance. 8 | /// 9 | /// 10 | /// Listeners can implement directly, but in some 11 | /// cases the decoupling afforded by this interface is needed. 12 | /// 13 | public interface IScaleMonitorProvider 14 | { 15 | /// 16 | /// Gets the instance. 17 | /// 18 | /// The instance. 19 | IScaleMonitor GetMonitor(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/IScaleStatusProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Scale 8 | { 9 | /// 10 | /// Interface for providing aggregate scale status across all functions being monitored by the host. 11 | /// 12 | public interface IScaleStatusProvider 13 | { 14 | /// 15 | /// Gets the scale status for all functions being monitored by the host. 16 | /// 17 | /// The . 18 | /// A task that returns the . 19 | Task GetScaleStatusAsync(ScaleStatusContext context); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/ITargetScalerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Provider interface for returning an instance. 8 | /// 9 | /// 10 | /// Listeners can implement directly, but in some 11 | /// cases the decoupling afforded by this interface is needed. 12 | /// 13 | public interface ITargetScalerProvider 14 | { 15 | /// 16 | /// Gets the instance. 17 | /// 18 | /// The instance. 19 | ITargetScaler GetTargetScaler(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/NullConcurrencyStatusRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | #nullable enable 5 | 6 | using System.Threading; 7 | using System.Threading.Tasks; 8 | 9 | namespace Microsoft.Azure.WebJobs.Host.Scale 10 | { 11 | internal class NullConcurrencyStatusRepository : IConcurrencyStatusRepository 12 | { 13 | public Task ReadAsync(CancellationToken cancellationToken) 14 | { 15 | return Task.FromResult(null); 16 | } 17 | 18 | public Task WriteAsync(HostConcurrencySnapshot snapshot, CancellationToken cancellationToken) 19 | { 20 | return Task.CompletedTask; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/NullScaleMetricsRepository.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Scale 8 | { 9 | internal class NullScaleMetricsRepository : IScaleMetricsRepository 10 | { 11 | private IDictionary> _emptyMetrics = new Dictionary>(); 12 | 13 | public Task WriteMetricsAsync(IDictionary monitorMetrics) 14 | { 15 | return Task.CompletedTask; 16 | } 17 | 18 | public Task>> ReadMetricsAsync(IEnumerable monitors) 19 | { 20 | return Task.FromResult((IDictionary>)_emptyMetrics); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/ScaleMetrics.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Scale 7 | { 8 | /// 9 | /// Base class for all scale metrics types, returned by . 10 | /// 11 | public class ScaleMetrics 12 | { 13 | public ScaleMetrics() 14 | { 15 | Timestamp = DateTime.UtcNow; 16 | } 17 | 18 | /// 19 | /// Gets or sets the UTC timestamp of when the sample was taken. 20 | /// 21 | public DateTime Timestamp { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/ScaleStatus.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Represents the current scale status for an . 8 | /// 9 | public class ScaleStatus 10 | { 11 | /// 12 | /// Gets or sets the current scale decision. 13 | /// 14 | public ScaleVote Vote { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/ScaleVote.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Represents a scale decision made by an . 8 | /// 9 | public enum ScaleVote 10 | { 11 | None = 0, 12 | ScaleOut = 1, 13 | ScaleIn = -1 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/TargetScalerContext.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Context used by to decide 8 | /// scale result. 9 | /// 10 | public class TargetScalerContext 11 | { 12 | /// 13 | /// The current concurrency for the target function. 14 | /// 15 | /// 16 | /// When not specified, the scaler will determine the concurrency based on configuration. 17 | /// 18 | public int? InstanceConcurrency { get; set; } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/TargetScalerDescriptor.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Metadata descriptor for an . 8 | /// 9 | public class TargetScalerDescriptor 10 | { 11 | public TargetScalerDescriptor(string functionId) 12 | { 13 | FunctionId = functionId; 14 | } 15 | 16 | /// 17 | /// Gets the ID of the function associated with this scaler. 18 | /// 19 | public string FunctionId { get; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/TargetScalerResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Represents the scale result of a target scaler. 8 | /// 9 | public class TargetScalerResult 10 | { 11 | /// 12 | /// Gets or sets the target worker count. 13 | /// 14 | public int TargetWorkerCount { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Scale/ThrottleState.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.Scale 5 | { 6 | /// 7 | /// Enumeration of possible states a can be in. 8 | /// 9 | public enum ThrottleState 10 | { 11 | /// 12 | /// The throttle provider doesn't have enough data yet to make a throttle determination. 13 | /// 14 | Unknown, 15 | 16 | /// 17 | /// The throttle is enabled. 18 | /// 19 | Enabled, 20 | 21 | /// 22 | /// The throttle is disabled. 23 | /// 24 | Disabled 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/SharedListenerAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | /// 9 | /// Attribute applied to a implementation when the binding uses 10 | /// a shared listener for all functions. 11 | /// 12 | [AttributeUsage(AttributeTargets.Class)] 13 | public class SharedListenerAttribute : Attribute 14 | { 15 | public SharedListenerAttribute(string sharedListenerId) 16 | { 17 | SharedListenerId = sharedListenerId; 18 | } 19 | 20 | /// 21 | /// Gets the shared ID used for all functions. 22 | /// 23 | public string SharedListenerId { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Singleton/IDistributedLock.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | /// 9 | /// Handle for a lock returned by 10 | /// 11 | [Obsolete("Not ready for public consumption.")] 12 | public interface IDistributedLock 13 | { 14 | /// 15 | /// The Lock identity. 16 | /// 17 | string LockId { get; } 18 | } 19 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/SupportsRetryAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host 7 | { 8 | /// 9 | /// Attribute applied to a implementation to declare that the trigger supports . 10 | /// 11 | [AttributeUsage(AttributeTargets.Class)] 12 | public class SupportsRetryAttribute : Attribute 13 | { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/DefaultWebJobsExceptionHandlerFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.Hosting; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace Microsoft.Azure.WebJobs.Host.Timers 10 | { 11 | public class DefaultWebJobsExceptionHandlerFactory : IWebJobsExceptionHandlerFactory 12 | { 13 | public IWebJobsExceptionHandler Create(IHost jobHost) => new WebJobsExceptionHandler(jobHost); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/IDelayStrategy.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Timers 7 | { 8 | internal interface IDelayStrategy 9 | { 10 | TimeSpan GetNextDelay(bool executionSucceeded); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/ITaskSeriesCommand.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Timers 8 | { 9 | internal interface ITaskSeriesCommand 10 | { 11 | Task ExecuteAsync(CancellationToken cancellationToken); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/ITaskSeriesTimer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Threading; 6 | using System.Threading.Tasks; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Timers 9 | { 10 | internal interface ITaskSeriesTimer : IDisposable 11 | { 12 | void Start(); 13 | 14 | Task StopAsync(CancellationToken cancellationToken); 15 | 16 | void Cancel(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/IWebJobsExceptionHandlerFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Extensions.Hosting; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | 9 | namespace Microsoft.Azure.WebJobs.Host.Timers 10 | { 11 | public interface IWebJobsExceptionHandlerFactory 12 | { 13 | IWebJobsExceptionHandler Create(IHost jobHost); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/NullRecurrentCommand.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Timers 8 | { 9 | internal class NullRecurrentCommand : IRecurrentCommand 10 | { 11 | public Task TryExecuteAsync(CancellationToken cancellationToken) 12 | { 13 | return Task.FromResult(true); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/RandomExtensions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Timers 7 | { 8 | internal static class RandomExtensions 9 | { 10 | public static double Next(this Random random, double minValue, double maxValue) 11 | { 12 | if (random == null) 13 | { 14 | throw new ArgumentNullException("random"); 15 | } 16 | 17 | return ((maxValue - minValue) * random.NextDouble()) + minValue; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Timers/TaskSeriesCommandResult.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Timers 7 | { 8 | internal struct TaskSeriesCommandResult 9 | { 10 | private readonly Task _wait; 11 | 12 | public TaskSeriesCommandResult(Task wait) 13 | { 14 | _wait = wait; 15 | } 16 | 17 | /// 18 | /// Wait for this task to complete before calling again. 19 | /// 20 | public Task Wait 21 | { 22 | get { return _wait; } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Triggers/ITriggerBindingProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading.Tasks; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Triggers 7 | { 8 | /// 9 | /// Defines a provider of s 10 | /// 11 | public interface ITriggerBindingProvider 12 | { 13 | /// 14 | /// Try to bind using the specified context. 15 | /// 16 | /// The binding context. 17 | /// A if successful, null otherwise. 18 | Task TryCreateAsync(TriggerBindingProviderContext context); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Triggers/ITriggerData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using Microsoft.Azure.WebJobs.Host.Bindings; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.Triggers 8 | { 9 | /// 10 | /// Defines an interface for representing data returned after a trigger 11 | /// parameter value is bound. 12 | /// 13 | public interface ITriggerData 14 | { 15 | /// 16 | /// Gets the for the bound parameter value. 17 | /// 18 | IValueProvider ValueProvider { get; } 19 | 20 | /// 21 | /// Gets the collection of binding data for the bound parameter value. 22 | /// 23 | IReadOnlyDictionary BindingData { get; } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Triggers/ITriggeredFunctionBinding.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Generic; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Bindings; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.Triggers 9 | { 10 | internal interface ITriggeredFunctionBinding : IFunctionBinding 11 | { 12 | Task> BindAsync(ValueBindingContext context, TTriggerValue value); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/Triggers/ITriggeredFunctionInstanceFactory.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Executors; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.Triggers 7 | { 8 | internal interface ITriggeredFunctionInstanceFactory : IFunctionInstanceFactory 9 | { 10 | IFunctionInstance Create(FunctionInstanceFactoryContext context); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Host/WebSitesKnownKeyNames.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host 5 | { 6 | internal static class WebSitesKnownKeyNames 7 | { 8 | public const string JobDataPath = "WEBJOBS_DATA_PATH"; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Constants/ApplicationInsightsDiagnosticConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights 5 | { 6 | public static class ApplicationInsightsDiagnosticConstants 7 | { 8 | public const string ApplicationInsightsDiagnosticSourcePrefix = "Microsoft.Azure.WebJobs.Logging.ApplicationInsights."; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Constants/ApplicationInsightsScopeKeys.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights 5 | { 6 | internal static class ApplicationInsightsScopeKeys 7 | { 8 | internal const string HttpRequest = "MS_HttpRequest"; 9 | 10 | // HTTP context is set automatically by ASP.NET, this isn't ours. 11 | internal const string HttpContext = "MS_HttpContext"; 12 | 13 | // This is set by Functions 14 | internal const string FunctionsHttpResponse = "MS_AzureFunctionsHttpResponse"; 15 | 16 | internal const string ForwardedForHeaderName = "X-Forwarded-For"; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Constants/LoggingConstants.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights 5 | { 6 | internal static class LoggingConstants 7 | { 8 | public const string ZeroIpAddress = "0.0.0.0"; 9 | public const string Unknown = "[Unknown]"; 10 | public const string ClientIpKey = "ClientIp"; 11 | public const string HostInstanceIdKey = "HostInstanceId"; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Directory.Version.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 3.0.42 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/Initializers/NullTelemetryInitializer.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.ApplicationInsights.Channel; 5 | using Microsoft.ApplicationInsights.Extensibility; 6 | 7 | namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights 8 | { 9 | internal class NullTelemetryInitializer : ITelemetryInitializer 10 | { 11 | public static NullTelemetryInitializer Instance { get; } = new NullTelemetryInitializer(); 12 | public void Initialize(ITelemetry telemetry) 13 | { 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/NullTelemetryModule.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.ApplicationInsights.Extensibility; 5 | 6 | namespace Microsoft.Azure.WebJobs.Logging.ApplicationInsights 7 | { 8 | /// 9 | /// Noop telemetry module that is added instead of another one, which is disabled by settings. 10 | /// 11 | internal class NullTelemetryModule : ITelemetryModule 12 | { 13 | public static NullTelemetryModule Instance { get; } = new NullTelemetryModule(); 14 | 15 | private NullTelemetryModule() 16 | { 17 | } 18 | 19 | public void Initialize(TelemetryConfiguration configuration) 20 | { 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging.ApplicationInsights/ProviderAliasUtilities.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Linq; 6 | using System.Reflection; 7 | 8 | namespace Microsoft.Extensions.Logging 9 | { 10 | internal static class ProviderAliasUtilities 11 | { 12 | internal static string GetAlias(Type providerType) 13 | { 14 | var attribute = providerType.GetCustomAttributes(inherit: false).FirstOrDefault(); 15 | return attribute?.Alias; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging/Directory.Version.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4.0.1 4 | 5 | 6 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1014:MarkAssembliesWithClsCompliant")] -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging/Internal/IEntityWithEpoch.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Logging 7 | { 8 | // Get the "epoch" that this TableEntity is associated with. 9 | // Each epoch gets its own Azure Table. This is to cooperate with deleting. 10 | // See https://azure.microsoft.com/en-us/documentation/articles/storage-table-design-guide/#high-volume-delete-pattern 11 | internal interface IEntityWithEpoch 12 | { 13 | DateTime GetEpoch(); 14 | } 15 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging/README.md: -------------------------------------------------------------------------------- 1 | # Microsoft.Azure.WebJobs.Host.Logging 2 | 3 | This package provides logging related Types and capabilities to the WebJobs SDK. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 4 | 5 | ## Commonly used types 6 | 7 | - `LogFactory` 8 | - `ILogReader` 9 | - `ILogWriter` -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Logging/WebJobs.Logging.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | Microsoft.Azure.WebJobs.Logging 6 | This package provides logging related Types and capabilities to the WebJobs SDK. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 7 | Microsoft.Azure.WebJobs.Logging 8 | Microsoft.Azure.WebJobs.Logging 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Rpc.Core/README.md: -------------------------------------------------------------------------------- 1 | # Microsoft.Azure.WebJobs.Rpc.Core 2 | 3 | This package provides core RPC Types and capabilities to the WebJobs SDK. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Rpc.Core/WebJobs.Rpc.Core.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net6.0 5 | latest 6 | Microsoft.Azure.WebJobs.Rpc.Core 7 | This package provides core RPC Types and capabilities to the WebJobs SDK. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 8 | Microsoft.Azure.WebJobs.Rpc.Core 9 | Microsoft.Azure.WebJobs.Rpc.Core 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs.Shared/WebJobs.Shared.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | 10 | netstandard2.0 11 | Microsoft.Azure.WebJobs 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs/AppSettingAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Description 7 | { 8 | /// 9 | /// Place this on binding attributes properties to tell the binders that that the property 10 | /// should be automatically resolved as an app setting 11 | /// 12 | [AttributeUsage(AttributeTargets.Property)] 13 | public sealed class AppSettingAttribute : Attribute 14 | { 15 | /// 16 | /// Creates a new instance. 17 | /// 18 | public AppSettingAttribute() 19 | { 20 | } 21 | 22 | /// 23 | /// The default app setting name to use, if none specified 24 | /// 25 | public string Default { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs/BindingAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Description 7 | { 8 | /// 9 | /// Place this on an attribute to note that it's a binding attribute. 10 | /// An extension should then claim this and bind it. 11 | /// 12 | [AttributeUsage(AttributeTargets.Class)] 13 | public sealed class BindingAttribute : Attribute 14 | { 15 | /// 16 | /// Indicates that a trigger binding is capable of handling return values 17 | /// from a function. 18 | /// 19 | /// $$$ Review this 20 | [Obsolete("Will be redesigned in a future release.")] 21 | public bool TriggerHandlesReturnValue { get; set; } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs/ConnectionStringAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Description 7 | { 8 | /// 9 | /// Place this on binding attributes properties to tell the binders that that the property 10 | /// should be automatically resolved as a connection string. 11 | /// 12 | [AttributeUsage(AttributeTargets.Property)] 13 | public sealed class ConnectionStringAttribute : Attribute 14 | { 15 | /// 16 | /// Creates a new instance. 17 | /// 18 | public ConnectionStringAttribute() 19 | { 20 | } 21 | 22 | /// 23 | /// The default connection string name to use, if none specified 24 | /// 25 | public string Default { get; set; } 26 | } 27 | } -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs/ICollector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs 5 | { 6 | /// 7 | /// Defines a collector (an insert-only collection). 8 | /// 9 | /// The type of items to collect. 10 | public interface ICollector 11 | { 12 | /// 13 | /// Adds an item to the . 14 | /// 15 | /// The item to be added. 16 | void Add(T item); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs/IConnectionProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs 5 | { 6 | /// 7 | /// Interface for providing a connection string name. 8 | /// 9 | public interface IConnectionProvider 10 | { 11 | /// 12 | /// Gets or sets the app setting name that contains the connection string. 13 | /// 14 | string Connection { get; set; } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs/README.md: -------------------------------------------------------------------------------- 1 | # Microsoft.Azure.WebJobs.Core 2 | 3 | This package provides the core Types and Attribute definitions for the WebJobs SDK. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 4 | 5 | ## Commonly used types 6 | 7 | - `TimeoutAttribute` 8 | - `SingletonAttribute` 9 | - `FunctionNameAttribute` 10 | - `ExtensionAttribute` 11 | 12 | ## Example usage 13 | 14 | The below example shows a QueueTrigger function with a timeout defined. 15 | 16 | ``` CSharp 17 | using Microsoft.Azure.WebJobs; 18 | 19 | [TimeoutAttribute("00:15:00")] 20 | public void ProcessWorkItem([QueueTrigger("test")] WorkItem workItem, ILogger logger) 21 | { 22 | logger.LogInformation($"Processed work item {workItem.ID}"); 23 | } 24 | ``` -------------------------------------------------------------------------------- /src/Microsoft.Azure.WebJobs/WebJobs.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netstandard2.0 5 | Microsoft.Azure.WebJobs.Core 6 | This package provides the core Types and Attribute definitions for the WebJobs SDK. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. 7 | Microsoft.Azure.WebJobs 8 | Microsoft.Azure.WebJobs 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Extensions.Rpc.UnitTests/Usings.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | global using Moq; 5 | global using Xunit; 6 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Extensions.Rpc.UnitTests/protos/test.proto: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | syntax = "proto3"; 4 | 5 | option csharp_namespace = "Microsoft.Azure.WebJobs.Extensions.Rpc"; 6 | 7 | service TestService { 8 | rpc Test (TestRequest) returns (TestReply) {} 9 | } 10 | 11 | message TestRequest { 12 | string input = 1; 13 | } 14 | 15 | message TestReply { 16 | string output = 1; 17 | } 18 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.EndToEndTests/CustomObject.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Linq; 7 | using System.Text; 8 | using System.Threading.Tasks; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host.EndToEndTests 11 | { 12 | public class CustomObject 13 | { 14 | public string Text { get; set; } 15 | 16 | public int Number { get; set; } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.EndToEndTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | using Xunit; 6 | 7 | [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.EndToEndTests/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Disable_DisabledJob": "1" 3 | } 4 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.FunctionalTests/FunctionIndexCollector.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Reflection; 7 | using Microsoft.Azure.WebJobs.Host.Indexers; 8 | using Microsoft.Azure.WebJobs.Host.Protocols; 9 | 10 | namespace Microsoft.Azure.WebJobs.Host 11 | { 12 | internal class TestIndexCollector : IFunctionIndexCollector 13 | { 14 | public List Functions = new List(); 15 | 16 | public void Add(IFunctionDefinition function, FunctionDescriptor descriptor, MethodInfo method) 17 | { 18 | Functions.Add(descriptor); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.FunctionalTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | using Xunit; 6 | 7 | [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.FunctionalTests/TestDoubles/FakeFunctionInstanceLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Threading; 5 | using System.Threading.Tasks; 6 | using Microsoft.Azure.WebJobs.Host.Loggers; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.FunctionalTests.TestDoubles 9 | { 10 | internal class FakeFunctionInstanceLoggerProvider : IFunctionInstanceLoggerProvider 11 | { 12 | private readonly IFunctionInstanceLogger _logger; 13 | 14 | public FakeFunctionInstanceLoggerProvider(IFunctionInstanceLogger logger) 15 | { 16 | _logger = logger; 17 | } 18 | 19 | public Task GetAsync(CancellationToken cancellationToken) 20 | { 21 | return Task.FromResult(_logger); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.FunctionalTests/TestDoubles/StrictEncodings.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Text; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.FunctionalTests.TestDoubles 7 | { 8 | internal static class StrictEncodings 9 | { 10 | private static UTF8Encoding _utf8 = new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, 11 | throwOnInvalidBytes: true); 12 | 13 | public static UTF8Encoding Utf8 14 | { 15 | get { return _utf8; } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.FunctionalTests/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "DisableSetting0": "0", 3 | "DisableSetting1": "1", 4 | "DisableSettingTrue": "true", 5 | "DisableSettingFalse": "false", 6 | "AzureWebJobs.DisabledByAppSetting_Method.Disabled": "true", 7 | "AzureWebJobs.DisabledByAppSetting_FunctionNameAttribute.Disabled": "true", 8 | "AzureWebJobs_DisabledByAppSetting_Method_Linux_Disabled": "true", 9 | "AzureWebJobs_DisabledByAppSetting_FunctionNameAttribute_Linux_Disabled": "true" 10 | } 11 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/Directory.Version.props: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/Fakes/FakeActivator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.TestCommon 8 | { 9 | 10 | public class FakeActivator : IJobActivator 11 | { 12 | public Dictionary _instances = new Dictionary(); 13 | 14 | public FakeActivator(params object[] objs) 15 | { 16 | foreach (var obj in objs) 17 | { 18 | Add(obj); 19 | } 20 | } 21 | 22 | public void Add(object o) 23 | { 24 | _instances[o.GetType()] = o; 25 | } 26 | 27 | public T CreateInstance() 28 | { 29 | return (T)_instances[typeof(T)]; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/Fakes/FakeTypeLocator.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Collections.Generic; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.TestCommon 8 | { 9 | public class FakeTypeLocator : ITypeLocator 10 | { 11 | private readonly Type[] _types; 12 | 13 | public FakeTypeLocator(params Type[] types) 14 | { 15 | _types = types; 16 | } 17 | 18 | public IReadOnlyList GetTypes() 19 | { 20 | return _types; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/Fakes/NullFunctionInstanceLogger.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Microsoft.Azure.WebJobs.Host.Loggers; 5 | using Microsoft.Azure.WebJobs.Host.Protocols; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.TestCommon 8 | { 9 | public class NullFunctionInstanceLogger : IFunctionInstanceLogger 10 | { 11 | string IFunctionInstanceLogger.LogFunctionStarted(FunctionStartedMessage message) 12 | { 13 | return string.Empty; 14 | } 15 | 16 | void IFunctionInstanceLogger.LogFunctionCompleted(FunctionCompletedMessage message) 17 | { 18 | } 19 | 20 | void IFunctionInstanceLogger.DeleteLogFunctionStarted(string startedMessageId) 21 | { 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/InvariantCultureFixture.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using System.Globalization; 6 | using System.Threading; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.TestCommon 9 | { 10 | public class InvariantCultureFixture : IDisposable 11 | { 12 | private readonly CultureInfo _originalCultureInfo; 13 | 14 | public InvariantCultureFixture() 15 | { 16 | _originalCultureInfo = Thread.CurrentThread.CurrentCulture; 17 | Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; 18 | } 19 | 20 | public void Dispose() 21 | { 22 | Thread.CurrentThread.CurrentCulture = _originalCultureInfo; 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/QueueServiceClientProvider.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using Azure.Storage.Queues; 5 | using Microsoft.Azure.WebJobs.Host.Storage; 6 | using Microsoft.Extensions.Azure; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.TestCommon 9 | { 10 | /// 11 | /// Provider to create QueueServiceClient objects. This is used only for tests and is intended to only honor connection strings. 12 | /// 13 | internal class QueueServiceClientProvider : StorageClientProvider 14 | { 15 | public QueueServiceClientProvider(AzureComponentFactory componentFactory, AzureEventSourceLogForwarder logForwarder) 16 | : base(componentFactory, logForwarder) { } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/README.md: -------------------------------------------------------------------------------- 1 | # Microsoft.Azure.WebJobs.Host.TestCommon 2 | 3 | This package contains helpers and Types useful for WebJobs SDK testing. For more information, please visit https://go.microsoft.com/fwlink/?linkid=2279708. -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/RandomNameResolver.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | 6 | namespace Microsoft.Azure.WebJobs.Host.TestCommon 7 | { 8 | public class RandomNameResolver : INameResolver 9 | { 10 | // Convert to lowercase because many Azure services expect only lowercase 11 | private readonly string _randomString = Guid.NewGuid().ToString("N").ToLower(); 12 | 13 | public virtual string Resolve(string name) 14 | { 15 | if (name == "rnd") 16 | { 17 | return _randomString; 18 | } 19 | 20 | return null; 21 | } 22 | 23 | public string ResolveInString(string input) 24 | { 25 | return input.Replace("%rnd%", _randomString); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.TestCommon/TestTraits.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | namespace Microsoft.Azure.WebJobs.Host.TestCommon 5 | { 6 | public static class TestTraits 7 | { 8 | public const string CategoryTraitName = "Category"; 9 | 10 | public const string DynamicConcurrency = "DynamicConcurrency"; 11 | 12 | public const string ScaleMonitoring = "ScaleMonitoring"; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/Common/BindingPathAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Azure.WebJobs.Description; 6 | using Microsoft.Azure.WebJobs.Host.Config; 7 | 8 | namespace Microsoft.Azure.WebJobs.Host.UnitTests.Common 9 | { 10 | // Sample attribute for binding to the {sys.methodname} 11 | [Binding] 12 | public class BindingPathAttribute : Attribute 13 | { 14 | [AutoResolve(Default = "{sys.methodname}")] 15 | public string Path { get; set; } 16 | 17 | 18 | public class Extension : IExtensionConfigProvider 19 | { 20 | public void Initialize(ExtensionConfigContext context) 21 | { 22 | var rule = context.AddBindingRule(); 23 | rule.BindToInput(attr => attr.Path); 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/FakeQueue/FakeQeueueTriggerAttribute.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System; 5 | using Microsoft.Azure.WebJobs.Description; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.UnitTests 8 | { 9 | [Binding] 10 | public class FakeQueueTriggerAttribute : Attribute 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/FakeQueue/FakeQueueData.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | 5 | namespace Microsoft.Azure.WebJobs.Host.UnitTests 6 | { 7 | // Fake queue message. Equivalent of CloudQueueMessage or EventData 8 | public class FakeQueueData 9 | { 10 | // This corresponds to string & poco conversion. 11 | public string Message { get; set; } 12 | 13 | // Advanced property not captured with JSON serialization. 14 | public string ExtraPropertery { get; set; } 15 | 16 | // For testing passing bytes. 17 | public byte Byte { get; set; } 18 | } 19 | } -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/FakeQueue/FakeQueueDataBatch.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | 5 | namespace Microsoft.Azure.WebJobs.Host.UnitTests 6 | { 7 | // The TTriggerValue for "Fake queues". 8 | // this is the internal-native type that triggering fake queue messages bind to. 9 | // From this core type, binders will bind it to the various permutations. 10 | public class FakeQueueDataBatch 11 | { 12 | public FakeQueueData[] Events; 13 | } 14 | } -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.NamingRules", "SA1302:Interface names should begin with I", Justification = "", Scope = "type", Target = "~T:Microsoft.Azure.WebJobs.Host.UnitTests.Indexers.PublicInterface")] -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/Loggers/TestTelemetryChannel.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Collections.Concurrent; 5 | using Microsoft.ApplicationInsights.Channel; 6 | 7 | namespace Microsoft.Azure.WebJobs.Host.UnitTests.Loggers 8 | { 9 | internal class TestTelemetryChannel : ITelemetryChannel 10 | { 11 | public ConcurrentBag Telemetries = new ConcurrentBag(); 12 | 13 | public bool? DeveloperMode { get; set; } 14 | 15 | public string EndpointAddress { get; set; } 16 | 17 | public void Dispose() 18 | { 19 | } 20 | 21 | public void Flush() 22 | { 23 | } 24 | 25 | public void Send(ITelemetry item) 26 | { 27 | Telemetries.Add(item); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) .NET Foundation. All rights reserved. 2 | // Licensed under the MIT License. See License.txt in the project root for license information. 3 | 4 | using System.Reflection; 5 | using Xunit; 6 | 7 | [assembly: CollectionBehavior(CollectionBehavior.CollectionPerAssembly)] 8 | -------------------------------------------------------------------------------- /test/Microsoft.Azure.WebJobs.Host.UnitTests/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "DisableSetting0": "0", 3 | "DisableSetting1": "1", 4 | "DisableSettingTrue": "true", 5 | "DisableSettingFalse": "false", 6 | "AzureWebJobs.DisabledByAppSetting_NoAttribute.Disabled": "true" 7 | } 8 | -------------------------------------------------------------------------------- /test/TestProjects/FSharpFunctions/FSharpFunctions.fsproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net8.0 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /test/TestProjects/FSharpFunctions/Library.fs: -------------------------------------------------------------------------------- 1 | namespace FSharpFunctions 2 | 3 | open FSharp.Control.Tasks.ContextInsensitive 4 | open Microsoft.Azure.WebJobs 5 | 6 | module TestFunction = 7 | [] 8 | let TaskTest() = task { 9 | printf "hello" 10 | } --------------------------------------------------------------------------------