• Guides
  • Api Reference
  • FAQ
  • Api Reference
  • FunctionMonkey.Abstractions.Builders
  • ICosmosDbFunctionBuilder
Show / Hide Table of Contents
  • FunctionMonkey
    • AbstractPluginFunctions
    • ClaimMappingCompilationException
    • ConfigurationException
    • DeserializationException
    • PluginFunctions
    • Runtime
    • RuntimeInstance
    • TypeLoadingException
  • FunctionMonkey.Abstractions
    • HttpResponse
    • IClaimsPrincipalAuthorization
    • ICommandClaimsBinder
    • ICommandingConfigurator
    • ICommandTransformer
    • IContextProvider
    • IContextSetter
    • IFunctionAppConfiguration
    • IFunctionAppHost
    • IFunctionCompilerMetadata
    • IMediatorDecorator
    • IMediatorResultTypeExtractor
    • IMediatorTypeSafetyEnforcer
    • IOutputBindingConverter
    • ISerializer
    • ITimerCommandFactory<TCommand>
    • ITokenValidator
    • TokenValidationResult
  • FunctionMonkey.Abstractions.Builders
    • AuthorizationTypeEnum
    • IAuthorizationBuilder
    • IClaimsMappingBuilder
    • IClientCompilerOptionsBuilder
    • ICompilerOptionsBuilder
    • ICosmosDbFunctionBuilder
    • ICosmosDbFunctionOptionBuilder<TCommand>
    • IEventHubFunctionBuilder
    • IEventHubFunctionOptionBuilder<TCommand>
    • IFunctionAppHostBuilder
    • IFunctionBuilder
    • IFunctionHostBuilder
    • IFunctionOptions<TParentBuilder, TFunctionOptionsBuilder>
    • IFunctionOptionsBuilder
    • IHttpFunctionBuilder
    • IHttpFunctionConfigurationBuilder<TCommand>
    • IHttpFunctionOptionsBuilder<TCommand>
    • IHttpRouteFunctionBuilder
    • IHttpRouteOptionsBuilder
    • IOpenApiBuilder
    • IOpenApiDocumentFilter
    • IOpenApiDocumentFilterContext
    • IOpenApiOperationFilter
    • IOpenApiOperationFilterContext
    • IOpenApiParameterFilter
    • IOpenApiParameterFilterContext
    • IOpenApiSchemaFilter
    • IOpenApiSchemaFilterContext
    • IOutputBindingBuilder<TFunctionTypeBuilder>
    • ISerializationBuilder
    • IServiceBusFunctionBuilder
    • IServiceBusFunctionOptionBuilder<TCommand>
    • ISignalRFunctionBuilder
    • ISignalRFunctionConfigurationBuilder<TCommand>
    • IStorageFunctionBuilder
    • IStorageFunctionOptionBuilder<TCommand>
    • ITimerFunctionBuilder
    • ITimerFunctionOptionsBuilder<TCommand>
  • FunctionMonkey.Abstractions.Builders.Model
    • AbstractFunctionDefinition
    • AbstractOutputBinding
    • BridgedFunction
    • ConnectionStringSettingNames
    • HeaderBindingConfiguration
  • FunctionMonkey.Abstractions.Contexts
    • BlobContext
    • EventHubContext
    • ExecutionContext
    • HttpContext
    • ServiceBusContext
    • StorageQueueContext
  • FunctionMonkey.Abstractions.Extensions
    • TypeExtensions
  • FunctionMonkey.Abstractions.Http
    • AbstractClaimsMappingDefinition
    • CommandPropertyClaimsMappingDefinition
    • IHttpResponseHandler
    • OpenApiConfiguration
    • SharedClaimsMappingDefinition
  • FunctionMonkey.Abstractions.SignalR
    • GroupActionEnum
    • SignalRGroupAction
    • SignalRMessage
  • FunctionMonkey.Abstractions.Validation
    • IValidator
  • FunctionMonkey.AspNetCore
    • AuthenticationBuilderExtensions
    • AuthenticationOptions
    • FunctionMonkeyAuthHandler
    • IWebHostBuilderExtensions
    • JsonSecurityPropertyContractResolver
    • TokenValidatedContext
    • TokenValidationDefaults
  • FunctionMonkey.Builders
    • ClientCompilerOptionsBuilder
    • CosmosDbFunctionOptionBuilder<TCommandOuter>
    • FunctionBuilder
    • HttpFunctionOptionsBuilder<TCommand>
    • SerializationBuilder
    • StorageFunctionOptionBuilder<TCommandOuter>
  • FunctionMonkey.Commanding.Abstractions
    • ICommandWithNoHandler
    • IgnorePropertyAttribute
    • IStreamCommand
    • SignalRNegotiateResponse
  • FunctionMonkey.Commanding.Abstractions.Validation
    • SeverityEnum
    • ValidationError
    • ValidationException
    • ValidationObjectException
    • ValidationResult
    • ValidationResult<TResult>
  • FunctionMonkey.Commanding.Cosmos.Abstractions
    • ICosmosDbDocumentBatchCommand
    • ICosmosDbDocumentCommand
    • ICosmosDbErrorHandler
  • FunctionMonkey.Extensions
    • ServiceCollectionExtensions
    • Utils
  • FunctionMonkey.FluentValidation
    • IFunctionHostBuilderExtensions
    • IOpenApiBuilderExtensions
    • IServiceCollectionExtensions
  • FunctionMonkey.FluentValidation.OpenApi
    • OpenApiFluentValidationHelper
    • OpenApiFluentValidationRule
    • OpenApiFluentValidationRuleContext
  • FunctionMonkey.Infrastructure
    • DefaultMediatorTypeSafetyEnforcer
  • FunctionMonkey.MediatR
    • IFunctionHostBuilderExtensions
    • MediatRResultTypeExtractor
    • MediatRTypeSafetyEnforcer
  • FunctionMonkey.Serialization
    • CamelCaseJsonSerializer
    • DefaultCaseJsonSerializer
    • JsonSecurityPropertyContractResolver
    • NamingStrategyJsonSerializer
    • SecurityPropertyDefaultValueConverter
    • SnakeCaseJsonSerializer
  • FunctionMonkey.SignalR
    • AzureSignalRAuthClient
    • Converter
  • FunctionMonkey.Testing
    • AbstractAcceptanceTest
    • AcceptanceTestScaffold
    • HttpResponseExtensions
    • TestException
    • ValidatingDispatcher
    • ValidationException
  • FunctionMonkey.Testing.Mocks
    • CommandClaimsBinderMock
    • ContextManagerMock
  • FunctionMonkey.TokenValidator
    • IAuthorizationBuilderExtensions
  • FunctionMonkey.TokenValidator.Implementation
    • TokenValidator
  • SimpleJson
    • IJsonSerializerStrategy
    • JsonArray
    • JsonObject
    • PocoJsonSerializerStrategy
    • SimpleJson

Interface ICosmosDbFunctionBuilder

Namespace: FunctionMonkey.Abstractions.Builders
Assembly: FunctionMonkey.Abstractions.dll
Syntax
public interface ICosmosDbFunctionBuilder

Methods

| Improve this Doc View Source

ChangeFeedFunction<TCommand>(String, String, String, String, Boolean, Boolean, Boolean, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Boolean, String)

Associate a function with the specified collection and database

Declaration
ICosmosDbFunctionOptionBuilder<TCommand> ChangeFeedFunction<TCommand>(string collectionName, string databaseName, string leaseCollectionName = "leases", string leaseDatabaseName = null, bool createLeaseCollectionIfNotExists = false, bool startFromBeginning = false, bool convertToPascalCase = false, string leaseCollectionPrefix = null, int? maxItemsPerInvocation = null, int? feedPollDelay = null, int? leaseAcquireInterval = null, int? leaseExpirationInterval = null, int? leaseRenewInterval = null, int? checkpointFrequency = null, int? leasesCollectionThroughput = null, bool trackRemainingWork = false, string remainingWorkCronExpression = "*/5 * * * * *")
Parameters
Type Name Description
System.String collectionName

The Cosmos collection name

System.String databaseName

The Cosmos database name

System.String leaseCollectionName

The cosmos collection to use for leases - defaults to leases

System.String leaseDatabaseName

The cosmos database to use for leases - defaults to the database name

System.Boolean createLeaseCollectionIfNotExists

Creates the lease collection if it doesn't exist, defaults to false

System.Boolean startFromBeginning

Start from the beginning of the change feed, defaults to false

System.Boolean convertToPascalCase

Is the Cosmos document in camel case. Defaults to true in which case C# property names will be converted to camel case. Note that due to limitations in the current Functions / Cosmos Change Feed Processor this involves serializing to a memory stream and then deserializing.

If this limitation continues then I will seek to optimize this by compiling camel case model classes and mapping them to pascal case C# classes via Roslyn.

Alternatively you can use the JsonProperty attribute on all your properties. Messy I know.

Due to the potential expense this defaults to false.

System.String leaseCollectionPrefix

When set, it adds a prefix to the leases created in the Lease collection for this Function

System.Nullable<System.Int32> maxItemsPerInvocation

When set, it customizes the maximum amount of items received per Function call.

System.Nullable<System.Int32> feedPollDelay

When set, it defines, in milliseconds, the delay in between polling a partition for new changes on the feed, after all current changes are drained. Default is 5000 (5 seconds).

System.Nullable<System.Int32> leaseAcquireInterval

When set, it defines, in milliseconds, the interval to kick off a task to compute if partitions are distributed evenly among known host instances. Default is 13000 (13 seconds).

System.Nullable<System.Int32> leaseExpirationInterval

When set, it defines, in milliseconds, the interval for which the lease is taken on a lease representing a partition. If the lease is not renewed within this interval, it will cause it to expire and ownership of the partition will move to another instance. Default is 60000 (60 seconds)

System.Nullable<System.Int32> leaseRenewInterval

When set, it defines, in milliseconds, the renew interval for all leases for partitions currently held by an instance. Default is 17000 (17 seconds).

System.Nullable<System.Int32> checkpointFrequency

When set, it defines, in milliseconds, the interval between lease checkpoints. Default is always after a successful Function call.

System.Nullable<System.Int32> leasesCollectionThroughput

Defines the amount of Request Units to assign when the leases collection is created. This setting is only used When createLeaseCollectionIfNotExists is set to true. This parameter is automatically set when the binding is created using the portal.

System.Boolean trackRemainingWork

If true (default value) this will create a timer function that will output a remaining work estimate to the log - the metric name will be of the form {functionName}RemainingWork

System.String remainingWorkCronExpression

The frequency that the monitor timer runs - defaults to once per every 5 seconds

Returns
Type Description
ICosmosDbFunctionOptionBuilder<TCommand>
Type Parameters
Name Description
TCommand
| Improve this Doc View Source

ChangeFeedFunction<TCommand, TCosmosDbErrorHandler>(String, String, String, String, Boolean, Boolean, Boolean, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Boolean, String)

Associate a function with the specified collection and database

Declaration
ICosmosDbFunctionOptionBuilder<TCommand> ChangeFeedFunction<TCommand, TCosmosDbErrorHandler>(string collectionName, string databaseName, string leaseCollectionName = "leases", string leaseDatabaseName = null, bool createLeaseCollectionIfNotExists = false, bool startFromBeginning = false, bool convertToPascalCase = false, string leaseCollectionPrefix = null, int? maxItemsPerInvocation = null, int? feedPollDelay = null, int? leaseAcquireInterval = null, int? leaseExpirationInterval = null, int? leaseRenewInterval = null, int? checkpointFrequency = null, int? leasesCollectionThroughput = null, bool trackRemainingWork = false, string remainingWorkCronExpression = "*/5 * * * * *")
    where TCosmosDbErrorHandler : ICosmosDbErrorHandler
Parameters
Type Name Description
System.String collectionName

The Cosmos collection name

System.String databaseName

The Cosmos database name

System.String leaseCollectionName

The cosmos collection to use for leases - defaults to leases

System.String leaseDatabaseName

The cosmos database to use for leases - defaults to the database name

System.Boolean createLeaseCollectionIfNotExists

Creates the lease collection if it doesn't exist, defaults to false

System.Boolean startFromBeginning

Start from the beginning of the change feed, defaults to false

System.Boolean convertToPascalCase

Is the Cosmos document in camel case. Defaults to true in which case C# property names will be converted to camel case. Note that due to limitations in the current Functions / Cosmos Change Feed Processor this involves serializing to a memory stream and then deserializing.

If this limitation continues then I will seek to optimize this by compiling camel case model classes and mapping them to pascal case C# classes via Roslyn.

Alternatively you can use the JsonProperty attribute on all your properties. Messy I know.

Due to the potential expense this defaults to false.

System.String leaseCollectionPrefix

When set, it adds a prefix to the leases created in the Lease collection for this Function

System.Nullable<System.Int32> maxItemsPerInvocation

When set, it customizes the maximum amount of items received per Function call.

System.Nullable<System.Int32> feedPollDelay

When set, it defines, in milliseconds, the delay in between polling a partition for new changes on the feed, after all current changes are drained. Default is 5000 (5 seconds).

System.Nullable<System.Int32> leaseAcquireInterval

When set, it defines, in milliseconds, the interval to kick off a task to compute if partitions are distributed evenly among known host instances. Default is 13000 (13 seconds).

System.Nullable<System.Int32> leaseExpirationInterval

When set, it defines, in milliseconds, the interval for which the lease is taken on a lease representing a partition. If the lease is not renewed within this interval, it will cause it to expire and ownership of the partition will move to another instance. Default is 60000 (60 seconds)

System.Nullable<System.Int32> leaseRenewInterval

When set, it defines, in milliseconds, the renew interval for all leases for partitions currently held by an instance. Default is 17000 (17 seconds).

System.Nullable<System.Int32> checkpointFrequency

When set, it defines, in milliseconds, the interval between lease checkpoints. Default is always after a successful Function call.

System.Nullable<System.Int32> leasesCollectionThroughput

Defines the amount of Request Units to assign when the leases collection is created. This setting is only used When createLeaseCollectionIfNotExists is set to true. This parameter is automatically set when the binding is created using the portal.

System.Boolean trackRemainingWork

If true (default value) this will create a timer function that will output a remaining work estimate to the log - the metric name will be of the form {functionName}RemainingWork

System.String remainingWorkCronExpression

The frequency that the monitor timer runs - defaults to once per every 5 seconds

Returns
Type Description
ICosmosDbFunctionOptionBuilder<TCommand>
Type Parameters
Name Description
TCommand
TCosmosDbErrorHandler

A type that provides error handling for document processing

Extension Methods

OpenApiFluentValidationHelper.IsNumeric(Object)
OpenApiFluentValidationHelper.NumericToInt(Object)
OpenApiFluentValidationHelper.NumericToDouble(Object)
OpenApiFluentValidationHelper.NumericToDecimal(Object)
  • Improve this Doc
  • View Source
  • 0 Comments
In This Article
  • Methods
    • ChangeFeedFunction<TCommand>(String, String, String, String, Boolean, Boolean, Boolean, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Boolean, String)
    • ChangeFeedFunction<TCommand, TCosmosDbErrorHandler>(String, String, String, String, Boolean, Boolean, Boolean, String, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Nullable<Int32>, Boolean, String)
  • Extension Methods
Back to top Copyright © 2018 James Randall