#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

#2 in #sqs

Download history 268/week @ 2024-01-08 82/week @ 2024-01-15 14/week @ 2024-01-22 106/week @ 2024-01-29 125/week @ 2024-02-05 66/week @ 2024-02-12 94/week @ 2024-02-19 133/week @ 2024-02-26 128/week @ 2024-03-04 325/week @ 2024-03-11 96/week @ 2024-03-18 149/week @ 2024-03-25 90/week @ 2024-04-01 93/week @ 2024-04-08 115/week @ 2024-04-15 92/week @ 2024-04-22

395 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–18MB
~202K SLoC