#aws #sqs #lambda

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

#585 in Web programming

Download history 778/week @ 2023-08-16 495/week @ 2023-08-23 384/week @ 2023-08-30 273/week @ 2023-09-06 299/week @ 2023-09-13 529/week @ 2023-09-20 449/week @ 2023-09-27 406/week @ 2023-10-04 490/week @ 2023-10-11 211/week @ 2023-10-18 577/week @ 2023-10-25 301/week @ 2023-11-01 372/week @ 2023-11-08 304/week @ 2023-11-15 186/week @ 2023-11-22 342/week @ 2023-11-29

1,310 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();
 }

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–16MB
~193K SLoC