#aws-lambda #amazon-sqs #lambda #event-processing #aws

lambda_sqs

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

18 releases

new 0.2.16 Dec 7, 2024
0.2.15 Nov 23, 2024
0.2.11 Oct 26, 2024
0.2.6 Jul 27, 2024
0.2.0 Sep 22, 2021

#429 in Web programming

Download history 119/week @ 2024-08-16 141/week @ 2024-08-23 101/week @ 2024-08-30 9/week @ 2024-09-06 209/week @ 2024-09-13 85/week @ 2024-09-20 220/week @ 2024-09-27 70/week @ 2024-10-04 53/week @ 2024-10-11 222/week @ 2024-10-18 124/week @ 2024-10-25 531/week @ 2024-11-01 298/week @ 2024-11-08 212/week @ 2024-11-15 243/week @ 2024-11-22 102/week @ 2024-11-29

968 downloads per month

MIT/Apache

10KB
57 lines

Rust library lambda_sqs

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

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

~7–16MB
~208K SLoC