A minimalistic AWS Lambda runtime. It was written based on the official lambda_runtime
and
was designed to be used along with the trustworthy aws_lambda_event
crate.
The main goal of μ-rs is to provide an easy-to-use api for AWS Serverless Developers, leveraging enterprise-grade semantics in the powerful Rust ecosystem.
Disclaimer: This crate has been developed on the best effort from its authors. Although quite useful as being presented, it still on its early stages of development.
Although initially this library used to depend on the (official) lambda_runtime
crate, ever
since the 0.2.0 it's not being the case anymore. The current codebase was deeply inspired on
the official one though, having its code base deeply simplified. It is still possible to
see a resemblances between these two crates, though. In the case this library proves useful,
it can be back-ported to the upstream repository.
Set up the dependency.
[dependencies]
mu_runtime="0.2.0"
Start listen to events on your Lambda functions.
// Sample lambda function that listen for SQS events.
use aws_lambda_events::event::sqs::SqsEvent;
use mu_runtime;
#[tokio::main]
async fn main() -> mu_runtime::RuntimeResult {
mu_runtime::listen_events(|sqs_events, ctx| {
handle_sqs_messages(sqs_events)
}).await
}
async fn handle_sqs_messages(sqs_events: SqsEvent) -> Result<(), mu_runtime::Error> {
println!("Received {} events", sqs_events.records.len());
Ok(())
}
We welcome you to use the GitHub issue tracker to report bugs or suggest features.
When filing an issue, please check existing open, or recently closed, issues to make sure somebody else hasn't already reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:
- A reproducible test case or series of steps
- The version of our code being used
- Any modifications you've made relevant to the bug
- Anything unusual about your environment or deployment
Contributions via pull requests are much appreciated. Before sending us a pull request, please ensure that:
- You are working against the latest source on the master branch.
- You check existing open, and recently merged, pull requests to make sure someone else hasn't addressed the problem already.
- You open an issue to discuss any significant work - we would hate for your time to be wasted.
To send us a pull request, please:
- Fork the repository.
- Modify the source; please focus on the specific change you are contributing. If you also reformat all the code, it will be hard for us to focus on your change.
- Ensure local tests pass.
- Commit to your fork using clear commit messages.
- Send us a pull request, answering any default questions in the pull request interface.
- Pay attention to any automated CI failures reported in the pull request, and stay involved in the conversation.
GitHub provides additional document on forking a repository and creating a pull request.
Looking at the existing issues is a great way to find something to contribute on. As our projects, by default, use the default GitHub issue labels ((enhancement/bug/duplicate/help wanted/invalid/question/wontfix), looking at any 'help wanted' issues is a great place to start.
This is release under the Apache License 2 terms.