| Crates.io | dms_core |
| lib.rs | dms_core |
| version | 0.1.2 |
| created_at | 2025-11-29 15:47:49.580979+00 |
| updated_at | 2025-12-13 11:20:37.3177+00 |
| description | Dunimd Middleware Service - A high-performance Rust middleware framework with modular architecture |
| homepage | |
| repository | https://gitee.com/dunimd/dms |
| max_upload_size | |
| id | 1956870 |
| size | 2,281,275 |
English | 简体中文
DMS (Dunimd Middleware Service) — A high-performance Rust middleware framework that unifies backend infrastructure. Built for enterprise-scale with modular architecture, built-in observability, and distributed systems support.
DMS adopts a highly modular architecture with 12 core modules, enabling on-demand composition and seamless extension:
| Module | Description |
|---|---|
| auth | Authentication & authorization (JWT, OAuth, permissions) |
| cache | Multi-backend cache abstraction (Memory, Redis, Hybrid) |
| config | Multi-source configuration management with hot reload |
| core | Runtime, error handling, and service context |
| device | Device control, discovery, and intelligent scheduling |
| fs | Secure file system operations and management |
| gateway | API gateway with load balancing, rate limiting, and circuit breaking |
| hooks | Lifecycle event hooks (Startup, Shutdown, etc.) |
| log | Structured logging with tracing context integration |
| observability | Metrics, tracing, and Grafana integration |
| queue | Distributed queue abstraction (Kafka, RabbitMQ, Redis, Memory) |
| service_mesh | Service discovery, health checking, and traffic management |
Add DMS to your project's Cargo.toml:
[dependencies]
dms_core = { git = "https://gitee.com/dunimd/dms" }
Or use cargo add:
cargo add DMS --git https://gitee.com/dunimd/dms
use dms_core::prelude::*;
#[tokio::main]
async fn main() -> DMSResult<()> {
// Build service runtime
let app = DMSAppBuilder::new()
.with_config("config.yaml")?
.with_logging(DMSLogConfig::default())?
.with_observability(DMSObservabilityConfig::default())?
.build()?;
// Run business logic
app.run(|ctx: &DMSServiceContext| async move {
ctx.logger().info("service", "DMS service started")?;
// Your business code here
Ok(())
}).await
}
use dms_core::observability::*;
#[traced(name = "user_service")]
async fn get_user(ctx: &DMSServiceContext, user_id: u64) -> DMSResult<User> {
// Automatically record traces and metrics
let user = fetch_user_from_db(user_id).await?;
Ok(user)
}
# config.yaml
service:
name: "my-service"
version: "1.0.0"
logging:
level: "info"
format: "json"
file_enabled: true
console_enabled: true
observability:
metrics_enabled: true
tracing_enabled: true
prometheus_port: 9090
resource:
providers: ["cpu", "gpu", "memory"]
scheduling_policy: "priority_based"
DMS supports multiple configuration sources in order of priority (highest to lowest):
DMS_)# Run all tests
cargo test
# Run specific test module
cargo test cache
# Run with verbose output
cargo test -- --nocapture
Q: How to add a new module?
A: Implement the DMSModule trait and register it via DMSAppBuilder::with_module.
Q: How to configure logging level?
A: Set logging.level in the configuration file, supporting DEBUG/INFO/WARN/ERROR levels.
Q: How to enable metrics export?
A: Set observability.metrics_enabled: true and configure prometheus_port in the configuration file.
Q: How to extend configuration sources?
A: Implement a custom configuration loader and register it with DMSConfigManager.
Q: How to handle asynchronous tasks?
A: Use DMSAppBuilder::with_async_module to add async modules, the framework handles async lifecycle automatically.
Welcome to submit Issues and PRs!
This project uses Apache License 2.0 open source agreement, see LICENSE file.
Open source packages and their agreement information used by this project:
| 📦 Package | 📜 License |
|---|---|
| serde | Apache 2.0 |
| serde_json | MIT |
| serde_yaml | MIT |
| tokio | MIT |
| prometheus | Apache 2.0 |
| redis | MIT |
| hyper | MIT |
| lapin | Apache 2.0 |
| futures | MIT |
| yaml-rust | MIT |
| toml | MIT |
| etcd-client | MIT |
| sysinfo | MIT |
| async-trait | MIT |
| dashmap | MIT |
| chrono | MIT |
| uuid | Apache 2.0 |
| rand | MIT |
| notify | MIT |
| jsonwebtoken | MIT |
| reqwest | MIT |
| urlencoding | MIT |
| parking_lot | MIT |
| log | MIT |
| pyo3 | Apache 2.0 |
| tempfile | MIT |