[][src]Struct azure_functions::bindings::CosmosDbTrigger

pub struct CosmosDbTrigger {
    pub documents: Vec<Value>,
}

Represents a Cosmos DB trigger binding.

The following binding attributes are supported:

NameDescription
nameThe name of the parameter being bound.
connectionThe name of an app setting that contains the connection string used to connect to the Azure Cosmos DB account being monitored.
database_nameThe name of the Azure Cosmos DB database with the collection being monitored.
collection_nameThe name of the collection being monitored.
lease_connectionThe name of an app setting that contains the connection string to the service which holds the lease collection. When not set, the connection value is used.
lease_database_nameThe name of the database that holds the collection used to store leases. When not set, the value of the database_name setting is used.
create_lease_collectionWhen set to true, the leases collection is automatically created when it doesn't already exist. The default value is false.
lease_collection_throughputDefines the amount of Request Units to assign when the leases collection is created (optional). This setting is only used when create_lease_collection is set to true.
lease_collection_prefixWhen set, it adds a prefix to the leases created in the Lease collection for this Function, effectively allowing two separate Azure Functions to share the same Lease collection by using different prefixes.
feed_poll_delayWhen 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).
lease_acquire_intervalWhen 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).
lease_expiration_intervalWhen 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).
lease_renew_intervalWhen set, it defines, in milliseconds, the renew interval for all leases for partitions currently held by an instance. Default is 17000 (17 seconds).
checkpoint_frequencyWhen set, it defines, in milliseconds, the interval between lease checkpoints. Default is always after each Function call.
max_items_per_invocationWhen set, it customizes the maximum amount of items received per Function call.
start_from_beginningWhen set, it tells the Trigger to start reading changes from the beginning of the history of the collection instead of the current time. This only works the first time the Trigger starts, as in subsequent runs, the checkpoints are already stored. Setting this to true when there are leases already created has no effect.

Examples

An example of logging all Cosmos DB documents that triggered the function:

use azure_functions::{
    bindings::CosmosDbTrigger,
    func,
};
use log::info;

#[func]
#[binding(
    name = "trigger",
    connection = "myconnection",
    database_name = "mydb",
    collection_name = "mycollection"
)]
pub fn log_documents(trigger: CosmosDbTrigger) {
    for document in trigger.documents {
        info!("{}", document);
    }
}

Fields

documents: Vec<Value>

The Cosmos DB documents that triggered the function.

Trait Implementations

impl Debug for CosmosDbTrigger[src]

Auto Trait Implementations

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> IntoRequest<T> for T[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,