Crate lambda_sqs[][src]

Expand description

lambda_sqs

Specialised lambda_runtime to accept and process events from SQS.

SQS Events

SQS dispatches events to the a lambda function in batches (often, it seems to my surprise). This crate provides a lambda_runtime implementation which expects to receive a batch of messages in the SqsEvent type and provides a method to transform the batch of events to a vector of your Struct.

Example

use lambda_sqs::{handler_fn, Context, Error};
use lambda_sqs::SqsEvent;

#[tokio::main]
async fn main() -> Result<(), Error> {
    lambda_sqs::run(handler_fn(my_handler)).await?;

    Ok(())
}

async fn my_handler(e: SqsEvent, c: Context) -> Result<(), Error> {
    let events: Vec<YourStruct> = e.into_t();

Structs

Configuration derived from environment variables.

The Lambda function execution context. The values in this struct are populated using the Lambda environment variables and the headers returned by the poll request to the Runtime APIs.

A Handler implemented by a closure.

Type that accepts a batch of messages from SQS

Traits

A trait describing an asynchronous function A to B.

Functions

Returns a new HandlerFn with the given closure.

Starts the Lambda Rust runtime and begins polling for events on the Lambda Runtime APIs.

Type Definitions

Error type that lambdas may result in