[−][src]Struct azure_functions::bindings::CosmosDbTrigger
Represents a Cosmos DB trigger binding.
The following binding attributes are supported:
Name | Description |
---|---|
name | The name of the parameter being bound. |
connection | The name of an app setting that contains the connection string used to connect to the Azure Cosmos DB account being monitored. |
database_name | The name of the Azure Cosmos DB database with the collection being monitored. |
collection_name | The name of the collection being monitored. |
lease_connection | The 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_name | The 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_collection | When set to true, the leases collection is automatically created when it doesn't already exist. The default value is false. |
lease_collection_throughput | Defines 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_prefix | When 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_delay | When 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_interval | 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). |
lease_expiration_interval | 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). |
lease_renew_interval | When set, it defines, in milliseconds, the renew interval for all leases for partitions currently held by an instance. Default is 17000 (17 seconds). |
checkpoint_frequency | When set, it defines, in milliseconds, the interval between lease checkpoints. Default is always after each Function call. |
max_items_per_invocation | When set, it customizes the maximum amount of items received per Function call. |
start_from_beginning | When 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
Auto Trait Implementations
impl Send for CosmosDbTrigger
impl Sync for CosmosDbTrigger
impl Unpin for CosmosDbTrigger
impl UnwindSafe for CosmosDbTrigger
impl RefUnwindSafe for CosmosDbTrigger
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> IntoRequest<T> for T
[src]
fn into_request(self) -> Request<T>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,