다음을 통해 공유


CosmosDBTrigger Interface

public interface CosmosDBTrigger

CosmosDBTrigger(name = "database", databaseName = "ToDoList", collectionName = "Items", leaseCollectionName = "leases", createLeaseCollectionIfNotExists = true, connectionStringSetting = "AzureCosmosDBConnection") List<Map<String, String>> items, final ExecutionContext context ) { context.getLogger().info(items.size() + " item(s) is/are inserted."); if (!items.isEmpty()) { context.getLogger().info("The ID of the first item is: " + items.get(0).get("id")); } }

Method Summary

Modifier and Type Method and Description
int checkpointDocumentCount()

Customizes the amount of documents between lease checkpoints. Default is always after a Function call.

int checkpointInterval()

Customizes the amount of milliseconds between lease checkpoints. Default is always after a Function call.

String collectionName()

Defines the collection name of the CosmosDB to which to bind.

String connectionStringSetting()

Defines the app setting name that contains the CosmosDB connection string.

boolean createLeaseCollectionIfNotExists()

Defines whether to create a new lease collection if not exists.

String databaseName()

Defines the database name of the CosmosDB to which to bind.

String dataType()

Defines how Functions runtime should treat the parameter value. Possible values are:

    <li>
    
      <p>"": get the value as a string, and try to deserialize to actual parameter type like POJO </p>
    
    </li>
    
    <li>
    
      <p>string: always get the value as a string </p>
    
    </li>
    
    <li>
    
      <p>binary: get the value as a binary data, and try to deserialize to actual parameter type byte[] </p>
    
    </li>
    

int feedPollDelay()

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

int leaseAcquireInterval()

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

String leaseCollectionName()

Defines the lease collection name of the CosmosDB to which to bind.

String leaseCollectionPrefix()

Defines a prefix to be used within a Leases collection for this Trigger. Useful when sharing the same Lease collection among multiple Triggers.

String leaseConnectionStringSetting()

Defines Connection string for the service containing the lease collection.

String leaseDatabaseName()

Defines Name of the database containing the lease collection.

int leaseExpirationInterval()

Customizes the interval in milliseconds 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 Trigger instance. Default is 60000 (60 seconds).

int leaseRenewInterval()

Customizes the renew interval in milliseconds for all leases for partitions currently held by the Trigger. Default is 17000 (17 seconds).

int leasesCollectionThroughput()

defines the throughput of the created collection..

int maxItemsPerInvocation()

Customizes the maximum amount of items received in an invocation

String name()

The variable name used in function.json.

String preferredLocations()

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

boolean startFromBeginning()

Gets or sets whether change feed in the Azure Cosmos DB service should start from beginning (true) or from current (false). By default it's start from current (false).

Method Details

checkpointDocumentCount

public int checkpointDocumentCount() default -1

Customizes the amount of documents between lease checkpoints. Default is always after a Function call.

Returns:

CheckpointDocumentCount

checkpointInterval

public int checkpointInterval() default -1

Customizes the amount of milliseconds between lease checkpoints. Default is always after a Function call.

Returns:

checkpointInterval

collectionName

public String collectionName()

Defines the collection name of the CosmosDB to which to bind.

Returns:

The collection name string.

connectionStringSetting

public String connectionStringSetting()

Defines the app setting name that contains the CosmosDB connection string.

Returns:

The app setting name of the connection string.

createLeaseCollectionIfNotExists

public boolean createLeaseCollectionIfNotExists() default false

Defines whether to create a new lease collection if not exists.

Returns:

configuration whether to create a new lease collection if not exists.

databaseName

public String databaseName()

Defines the database name of the CosmosDB to which to bind.

Returns:

The database name string.

dataType

public String dataType() default ""

Defines how Functions runtime should treat the parameter value. Possible values are:

    <li>
    
      <p>"": get the value as a string, and try to deserialize to actual parameter type like POJO </p>
    
    </li>
    
    <li>
    
      <p>string: always get the value as a string </p>
    
    </li>
    
    <li>
    
      <p>binary: get the value as a binary data, and try to deserialize to actual parameter type byte[] </p>
    
    </li>
    

Returns:

The dataType which will be used by the Functions runtime.

feedPollDelay

public int feedPollDelay() default 5000

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

Returns:

feedPollDelay

leaseAcquireInterval

public int leaseAcquireInterval() default 13000

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

Returns:

interval in milliseconds

leaseCollectionName

public String leaseCollectionName() default ""

Defines the lease collection name of the CosmosDB to which to bind.

Returns:

The lease collection name string.

leaseCollectionPrefix

public String leaseCollectionPrefix() default ""

Defines a prefix to be used within a Leases collection for this Trigger. Useful when sharing the same Lease collection among multiple Triggers.

Returns:

LeaseCollectionPrefix

leaseConnectionStringSetting

public String leaseConnectionStringSetting() default ""

Defines Connection string for the service containing the lease collection.

Returns:

Connection string for the lease collection.

leaseDatabaseName

public String leaseDatabaseName() default ""

Defines Name of the database containing the lease collection.

Returns:

Name of the database for lease collection.

leaseExpirationInterval

public int leaseExpirationInterval() default 60000

Customizes the interval in milliseconds 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 Trigger instance. Default is 60000 (60 seconds).

Returns:

interval in milliseconds for which the lease is taken

leaseRenewInterval

public int leaseRenewInterval() default 17000

Customizes the renew interval in milliseconds for all leases for partitions currently held by the Trigger. Default is 17000 (17 seconds).

Returns:

renew interval in milliseconds for all leases

leasesCollectionThroughput

public int leasesCollectionThroughput() default -1

defines the throughput of the created collection..

Returns:

throughput

maxItemsPerInvocation

public int maxItemsPerInvocation() default -1

Customizes the maximum amount of items received in an invocation

Returns:

maximum amount of items received

name

public String name()

The variable name used in function.json.

Returns:

The variable name used in function.json.

preferredLocations

public String preferredLocations() default ""

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

Returns:

preferred locations (regions) for geo-replicated database accounts

startFromBeginning

public boolean startFromBeginning() default false

Gets or sets whether change feed in the Azure Cosmos DB service should start from beginning (true) or from current (false). By default it's start from current (false).

Returns:

Configuration whether change feed should start from beginning

Applies to