Intro to Tower and the Service Trait - Stefan Baumgartner - Rust Linz, July 2022

Learn how to compose services with the Rust Service Trait, a standardized way to create and compose services, and explore examples of using the `Timeout`, `Lambda`, and `HTTP` parsers to manage complexity in your architecture.

Key takeaways
  • The Service Trait allows you to compose multiple services together in a tower-like structure.
  • This allows you to reuse services in complex architecture, making it easier to manage complexity.
  • The Service Trait provides a standardized way to create and compose services using the Service trait.
  • Services can be composed in a chain-like structure, allowing you to add or remove services as needed.
  • The Service Trait is not specific to a particular serverless architecture, it can be used in any HTTP server.
  • The Timeout layer is a service that can be used to add a timeout to a request.
  • The Lambda event parser is a service that can be used to parse a Lambda event and convert it into a service.
  • The HTTP parser is a service that can be used to parse an HTTP request and convert it into a service.
  • You can create a service that is abstract and use it to create multiple services that can be used in different environments.
  • You can also create a service that is specific to a particular serverless architecture, such as AWS Lambda or Azure Functions.
  • The tower service is a service that can be used to create a tower of services, allowing you to compose multiple services together.
  • The Timeout service is a service that can be used to add a timeout to a request, allowing you to specify a timeout duration.
  • The Timeout service is also used to handle errors and exceptions, allowing you to catch and handle errors in a centralized way.
  • The Response service is a service that can be used to handle the response from a request, allowing you to specify a response format and body.
  • The Response service is also used to handle errors and exceptions, allowing you to catch and handle errors in a centralized way.