你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

CosmosDBTrigger 接口

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 () + “ 项 (s) is/are inserted”。) ;if (!items.isEmpty () ) { context.getLogger () .info (“第一项的 ID 为:” + items.get (0) .get (“id”) ) ; } }

方法摘要

修饰符和类型 方法和描述
int checkpointDocumentCount()

自定义租用检查点之间的文档量。 默认值始终在函数调用之后。

int checkpointInterval()

自定义租用检查点之间的毫秒数。 默认值始终在函数调用之后。

String collectionName()

定义要绑定到的 CosmosDB 的集合名称。

String connectionStringSetting()

定义包含 CosmosDB 连接字符串的应用设置名称。

boolean createLeaseCollectionIfNotExists()

定义是否创建新的租用集合(如果不存在)。

String databaseName()

定义要绑定到的 CosmosDB 的数据库名称。

String dataType()

定义 Functions 运行时应如何处理参数值。 可能的值为:

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

在所有当前更改都耗尽后,自定义在源上轮询分区以获取新更改之间的延迟(以毫秒为单位)。 默认为 5000(5 秒)。

int leaseAcquireInterval()

自定义间隔(以毫秒为单位),以启动任务以计算分区是否在已知主机实例之间均匀分布。 默认为 13000(13 秒)。

String leaseCollectionName()

定义要绑定到的 CosmosDB 的租约集合名称。

String leaseCollectionPrefix()

定义此触发器的 Leases 集合中使用的前缀。 在多个触发器之间共享同一租约集合时很有用。

String leaseConnectionStringSetting()

定义包含租约集合的服务的连接字符串。

String leaseDatabaseName()

定义包含租约集合的数据库的名称。

int leaseExpirationInterval()

自定义对表示分区的租约进行租约的间隔(以毫秒为单位)。 如果未在此时间间隔内续订租约,则会导致租约过期,并且分区的所有权将转移到另一个 Trigger 实例。 默认为 60000(60 秒)。

int leaseRenewInterval()

自定义触发器当前保留的分区的所有租约的续订间隔(以毫秒为单位)。 默认为 17000(17 秒)。

int leasesCollectionThroughput()

定义所创建集合的吞吐量。

int maxItemsPerInvocation()

自定义在调用中接收的最大项数

String name()

function.json 中使用的变量名称。

String preferredLocations()

定义 Azure Cosmos DB 服务中异地复制数据库帐户) 的首选位置 (区域。 值应以逗号分隔。 例如,PreferredLocations = “美国东部,美国中南部,北欧”

boolean startFromBeginning()

获取或设置 Azure Cosmos DB 服务中的更改源应从 (true) 开始,还是从当前 (false) 开始。 默认情况下,它从当前 (false) 开始。

方法详细信息

checkpointDocumentCount

public int checkpointDocumentCount() default -1

自定义租用检查点之间的文档量。 默认值始终在函数调用之后。

返回:

CheckpointDocumentCount

checkpointInterval

public int checkpointInterval() default -1

自定义租用检查点之间的毫秒数。 默认值始终在函数调用之后。

返回:

checkpointInterval

collectionName

public String collectionName()

定义要绑定到的 CosmosDB 的集合名称。

返回:

集合名称字符串。

connectionStringSetting

public String connectionStringSetting()

定义包含 CosmosDB 连接字符串的应用设置名称。

返回:

连接字符串的应用设置名称。

createLeaseCollectionIfNotExists

public boolean createLeaseCollectionIfNotExists() default false

定义是否创建新的租用集合(如果不存在)。

返回:

配置是否创建新的租约集合(如果不存在)。

databaseName

public String databaseName()

定义要绑定到的 CosmosDB 的数据库名称。

返回:

数据库名称字符串。

dataType

public String dataType() default ""

定义 Functions 运行时应如何处理参数值。 可能的值为:

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

返回:

将由 Functions 运行时使用的 dataType。

feedPollDelay

public int feedPollDelay() default 5000

在所有当前更改都耗尽后,自定义在源上轮询分区以获取新更改之间的延迟(以毫秒为单位)。 默认为 5000(5 秒)。

返回:

feedPollDelay

leaseAcquireInterval

public int leaseAcquireInterval() default 13000

自定义间隔(以毫秒为单位),以启动任务以计算分区是否在已知主机实例之间均匀分布。 默认为 13000(13 秒)。

返回:

间隔(以毫秒为单位)

leaseCollectionName

public String leaseCollectionName() default ""

定义要绑定到的 CosmosDB 的租约集合名称。

返回:

租约集合名称字符串。

leaseCollectionPrefix

public String leaseCollectionPrefix() default ""

定义此触发器的 Leases 集合中使用的前缀。 在多个触发器之间共享同一租约集合时很有用。

返回:

LeaseCollectionPrefix

leaseConnectionStringSetting

public String leaseConnectionStringSetting() default ""

定义包含租约集合的服务的连接字符串。

返回:

租约集合的连接字符串。

leaseDatabaseName

public String leaseDatabaseName() default ""

定义包含租约集合的数据库的名称。

返回:

租约集合的数据库的名称。

leaseExpirationInterval

public int leaseExpirationInterval() default 60000

自定义对表示分区的租约进行租约的间隔(以毫秒为单位)。 如果未在此时间间隔内续订租约,则会导致租约过期,并且分区的所有权将转移到另一个 Trigger 实例。 默认为 60000(60 秒)。

返回:

租用的间隔(以毫秒为单位)

leaseRenewInterval

public int leaseRenewInterval() default 17000

自定义触发器当前保留的分区的所有租约的续订间隔(以毫秒为单位)。 默认为 17000(17 秒)。

返回:

所有租约的续订间隔(以毫秒为单位)

leasesCollectionThroughput

public int leasesCollectionThroughput() default -1

定义所创建集合的吞吐量。

返回:

throughput

maxItemsPerInvocation

public int maxItemsPerInvocation() default -1

自定义在调用中接收的最大项数

返回:

收到的项目的最大数量

name

public String name()

function.json 中使用的变量名称。

返回:

function.json 中使用的变量名称。

preferredLocations

public String preferredLocations() default ""

定义 Azure Cosmos DB 服务中异地复制数据库帐户) 的首选位置 (区域。 值应以逗号分隔。 例如,PreferredLocations = “美国东部,美国中南部,北欧”

返回:

异地复制数据库帐户 (区域) 的首选位置

startFromBeginning

public boolean startFromBeginning() default false

获取或设置 Azure Cosmos DB 服务中的更改源应从 (true) 开始,还是从当前 (false) 开始。 默认情况下,它从当前 (false) 开始。

返回:

配置更改源是否应从头开始

适用于