How to configure non-string values in CosmosDBTrigger (or any other Trigger) attribute

219 Views Asked by At

I have a function in a c# class library project that is triggered by a change in a cosmos database:

[FunctionName("SomeFunction")]
public async Task Run(
    [CosmosDBTrigger(
        databaseName: "%CosmosDatabaseName%",
        collectionName: "%CosmosCollectionName%",
        ConnectionStringSetting = "CosmosConnectionString",
        CreateLeaseCollectionIfNotExists = true,
        LeaseCollectionName = "_leases",
        FeedPollDelay = 20000,
        MaxItemsPerInvocation = 20,
        LeaseCollectionPrefix = "Leases_")]
    IReadOnlyList<Document> changedDocuments,
    ILogger log,
    [Blob("%BlobContainerName%", Connection = "BlobConn")]
    CloudBlobContainer destinationContainer)
{
    ...
}

I was able to figure out how to pull some of the values from settings.json (databaseName, collectionName, etc...), but not FeedPollDelay or MaxItemsPerInvocation (due to them being of type int).

I am aware that there is a function.json that is generated, but I have no clue on how to modify it (and MSDN seems to hint that you shouldn't do that).

0

There are 0 best solutions below