feat: add 4 new crates (queue, tracing, http, cli) + enhancements to existing crates
New crates: - mytheclipse-queue: unified job queue with WorkerPool, retry/backoff, DLQ Backends: in-memory (default), Redis, NATS, PostgreSQL - mytheclipse-tracing: tracing subscriber layers with env filter + OTLP/Jaeger export - mytheclipse-http: HTTP client/server with timeout + tracing, axum server - mytheclipse-cli: CLI framework with clap derive, built-in subcommands Enhancements to existing crates: - mytheclipse-core: SemaphorePool, LeaderElection, HealthRegistry/HealthCheck - mytheclipse-cache: AutoRefreshCache (bg refresh on miss), CacheMetrics - mytheclipse-config: ConfigSchema for JSON Schema generation - mytheclipse-storage: MultipartUploadDriver trait - mytheclipse-crypto: PASETO v4.local token support All features compile with --all-features; tests + clippy pass clean.
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
# mytheclipse-http
|
||||
|
||||
HTTP client/server abstraction with built-in mytheclipse resilience primitives
|
||||
(retry, circuit breaker, timeout, rate limit).
|
||||
|
||||
## Features
|
||||
|
||||
| Feature | Default | Backend | Description |
|
||||
| :--- | :---: | :--- | :--- |
|
||||
| `client` | yes | `reqwest` | HTTP client with timeout + tracing. |
|
||||
| `server-axum` | no | `axum` | Axum-based server with health/metrics. |
|
||||
| `server-hyper` | no | `hyper` | Low-level hyper server. |
|
||||
|
||||
## Usage
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
mytheclipse-http = "0.2"
|
||||
```
|
||||
|
||||
### Client with timeout
|
||||
|
||||
```rust
|
||||
use mytheclipse_http::HttpClient;
|
||||
use std::time::Duration;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> Result<(), reqwest::Error> {
|
||||
let client = HttpClient::new().with_timeout(Duration::from_secs(10));
|
||||
let resp = client.get("https://httpbin.org/get").await?;
|
||||
println!("status: {}", resp.status());
|
||||
Ok(())
|
||||
}
|
||||
```
|
||||
|
||||
### Server (axum)
|
||||
|
||||
```toml
|
||||
[dependencies]
|
||||
mytheclipse-http = { version = "0.2", features = ["server-axum"] }
|
||||
```
|
||||
|
||||
```rust
|
||||
use mytheclipse_http::HttpServer;
|
||||
use std::net::SocketAddr;
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() {
|
||||
let server = HttpServer::new("0.0.0.0:3000".parse().unwrap());
|
||||
server.run().await;
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user