#aws-lambda #amazon-sqs #lambda #aws

lambda_sqs

Handles an SQS event and provides a vec of your type for processing

6 releases

0.2.4 Jan 22, 2023
0.2.3 May 14, 2022
0.2.1 Jan 24, 2022
0.2.0 Sep 22, 2021
0.1.0 Sep 16, 2021

#744 in Web programming

Download history 136/week @ 2023-12-15 89/week @ 2023-12-22 316/week @ 2023-12-29 330/week @ 2024-01-05 115/week @ 2024-01-12 21/week @ 2024-01-19 49/week @ 2024-01-26 107/week @ 2024-02-02 112/week @ 2024-02-09 106/week @ 2024-02-16 116/week @ 2024-02-23 141/week @ 2024-03-01 299/week @ 2024-03-08 111/week @ 2024-03-15 173/week @ 2024-03-22 99/week @ 2024-03-29

700 downloads per month

MIT/Apache

9KB
60 lines

Rust library lambda_sqs

Crates.io MIT licensed Build Status Rust 1.56+ FOSSA Status Docs BuyMeaCoffee GitHubSponsors

Specialised lambda_runtime to accept and process events from SQS.

SQS Events

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

Usage

To use the crate add the dependency in Cargo.toml.

[dependencies]
lambda_sqs = " 0.2.4"

Example

use your_module::YourStruct;
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(())
}
pub async fn my_handler(e: SqsEvent, c: Context) -> Result<(), Error> {
    let events: Vec<YourStruct> = e.into_t();
#   // Process events
#   Ok(())
 }

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~6–17MB
~198K SLoC