#aws-lambda #amazon-sqs #lambda #events #aws #lambda-sqs #sqs-event

lambda_sqs

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

31 releases

new 0.2.29 Apr 27, 2025
0.2.27 Mar 22, 2025
0.2.18 Dec 28, 2024
0.2.15 Nov 23, 2024
0.2.0 Sep 22, 2021

#296 in Web programming

Download history 216/week @ 2025-01-04 207/week @ 2025-01-11 337/week @ 2025-01-18 182/week @ 2025-01-25 272/week @ 2025-02-01 121/week @ 2025-02-08 133/week @ 2025-02-15 303/week @ 2025-02-22 425/week @ 2025-03-01 328/week @ 2025-03-08 246/week @ 2025-03-15 218/week @ 2025-03-22 110/week @ 2025-03-29 116/week @ 2025-04-05 167/week @ 2025-04-12 54/week @ 2025-04-19

482 downloads per month

MIT/Apache

16KB
57 lines

Rust library lambda_sqs

Crates.io MIT licensed Build Status Rust 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.29"

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

~8–17MB
~217K SLoC