CosmosDBv4TriggerOptions interface

Properties

connection

An app setting (or environment variable) with the Cosmos DB connection string

containerName

The name of the container being monitored

createLeaseContainerIfNotExists

Checks for existence and automatically creates the leases container. Default is false

databaseName

The name of the Azure Cosmos DB database with the container being monitored

feedPollDelay

The time (in milliseconds) for the delay between polling a partition for new changes on the feed, after all current changes are drained. Default is 5,000 milliseconds, or 5 seconds.

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).

leaseConnection

The name of an app setting that contains the connection string to the service which holds the lease container. If not set it will connect to the service defined by connection

leaseContainerName

The name of the container to store leases. If not set, it will use "leases"

leaseContainerPrefix

When set, the value is added as a prefix to the leases created in the Lease container for this function. Using a prefix allows two separate Azure Functions to share the same Lease container by using different prefixes.

leaseDatabaseName

The name of the database that holds the container to store leases. If not set, it will use the value of databaseName

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).

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).

leasesContainerThroughput

When createLeaseContainerIfNotExists is set to true, defines the amount of Request Units to assign to the created lease container

maxItemsPerInvocation

When set, this property sets the maximum number of items received per Function call. If operations in the monitored container are performed through stored procedures, transaction scope is preserved when reading items from the change feed. As a result, the number of items received could be higher than the specified value so that the items changed by the same transaction are returned as part of one atomic batch.

preferredLocations

Defines preferred locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. Values should be comma-separated. For example, East US,South Central US,North Europe

startFromBeginning

This option tells the Trigger to read changes from the beginning of the container's change history instead of starting at the current time. Reading from the beginning only works the first time the trigger starts, as in subsequent runs, the checkpoints are already stored. Setting this option to true when there are leases already created has no effect.

startFromTime

Gets or sets the date and time from which to initialize the change feed read operation. The recommended format is ISO 8601 with the UTC designator, such as 2021-02-16T14:19:29Z. This is only used to set the initial trigger state. After the trigger has a lease state, changing this value has no effect.

Property Details

connection

An app setting (or environment variable) with the Cosmos DB connection string

connection: string

Property Value

string

containerName

The name of the container being monitored

containerName: string

Property Value

string

createLeaseContainerIfNotExists

Checks for existence and automatically creates the leases container. Default is false

createLeaseContainerIfNotExists?: boolean

Property Value

boolean

databaseName

The name of the Azure Cosmos DB database with the container being monitored

databaseName: string

Property Value

string

feedPollDelay

The time (in milliseconds) for the delay between polling a partition for new changes on the feed, after all current changes are drained. Default is 5,000 milliseconds, or 5 seconds.

feedPollDelay?: number

Property Value

number

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).

leaseAcquireInterval?: number

Property Value

number

leaseConnection

The name of an app setting that contains the connection string to the service which holds the lease container. If not set it will connect to the service defined by connection

leaseConnection?: string

Property Value

string

leaseContainerName

The name of the container to store leases. If not set, it will use "leases"

leaseContainerName?: string

Property Value

string

leaseContainerPrefix

When set, the value is added as a prefix to the leases created in the Lease container for this function. Using a prefix allows two separate Azure Functions to share the same Lease container by using different prefixes.

leaseContainerPrefix?: string

Property Value

string

leaseDatabaseName

The name of the database that holds the container to store leases. If not set, it will use the value of databaseName

leaseDatabaseName?: string

Property Value

string

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).

leaseExpirationInterval?: number

Property Value

number

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).

leaseRenewInterval?: number

Property Value

number

leasesContainerThroughput

When createLeaseContainerIfNotExists is set to true, defines the amount of Request Units to assign to the created lease container

leasesContainerThroughput?: number

Property Value

number

maxItemsPerInvocation

When set, this property sets the maximum number of items received per Function call. If operations in the monitored container are performed through stored procedures, transaction scope is preserved when reading items from the change feed. As a result, the number of items received could be higher than the specified value so that the items changed by the same transaction are returned as part of one atomic batch.

maxItemsPerInvocation?: number

Property Value

number

preferredLocations

Defines preferred locations (regions) for geo-replicated database accounts in the Azure Cosmos DB service. Values should be comma-separated. For example, East US,South Central US,North Europe

preferredLocations?: string

Property Value

string

startFromBeginning

This option tells the Trigger to read changes from the beginning of the container's change history instead of starting at the current time. Reading from the beginning only works the first time the trigger starts, as in subsequent runs, the checkpoints are already stored. Setting this option to true when there are leases already created has no effect.

startFromBeginning?: boolean

Property Value

boolean

startFromTime

Gets or sets the date and time from which to initialize the change feed read operation. The recommended format is ISO 8601 with the UTC designator, such as 2021-02-16T14:19:29Z. This is only used to set the initial trigger state. After the trigger has a lease state, changing this value has no effect.

startFromTime?: string

Property Value

string