lambda_sqs

Crates.iolambda_sqs
lib.rslambda_sqs
version0.2.13
sourcesrc
created_at2021-09-16 16:28:36.228708
updated_at2024-11-09 04:05:30.351677
descriptionHandles an SQS event and provides a vec of your type for processing.
homepage
repositoryhttps://github.com/jerus-org/lambda_sqs
max_upload_size
id452336
size27,131
Jeremiah Russell (jerusdp)

documentation

https://docs.rs/lambda-sqs

README

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.13"

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.

Commit count: 205

cargo fmt