ProSA Hyper processor for HTTP client/server build on Hyper, a Tokio implementation of HTTP.
To include it in your project, add the crate to your dependencies:
cargo add prosa-hyperTo build your ProSA application afterward, use cargo-prosa or build manually.
The server configuration is straightforward. You only need to set a ListenerSetting to configure.
http_server:
listener:
url: https://0.0.0.0:443
ssl:
store:
path: "cert_path/"
cert: cert.pem
key: key.pem
passphrase: MySuperPassphraseIf you have some slow services, you can set the service_timeout parameter (800 ms by default).
The client exposes a service if it is available. For backends, you need to use TargetSetting. All backends will be load-balanced with ProSA's internal service load balancing.
http_client:
service_name: "service_name"
min_socket: 1
max_socket: 20
backends:
- url: http://backend01:8080If you have a slow backend response, you can set the http_timeout parameter (5 seconds by default).
To get help on the processor command-line arguments, run:
cargo run --example server -- -hIf you run it without any parameters, it'll start an HTTPS server using the configuration in examples/config.yml:
cargo run --example serverThe server provides the following targets:
- / returns the ProSA name
- /test contacts an internal service named SRV_TEST (requires starting the stub processor)
- metrics exposes Prometheus metrics as configured
To get help on the processor command-line arguments, run:
cargo run --example client -- -hIf you run it without any parameters, it will start an HTTPS client connecting to the HTTP server example using the same configuration in examples/config.yml:
cargo run --example client