feat: microservice architecture
This commit is contained in:
@@ -75,23 +75,30 @@ graph TD
|
||||
|
||||
## Module to Core Integration
|
||||
|
||||
Modules integrate with core services through well-defined interfaces and dependency injection.
|
||||
Modules (services) integrate with core services through service client interfaces. All communication uses gRPC or HTTP.
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
subgraph "Feature Module"
|
||||
subgraph "Feature Service (e.g., Blog)"
|
||||
ModuleHandler[Module Handler]
|
||||
ModuleService[Module Service]
|
||||
ModuleRepo[Module Repository]
|
||||
end
|
||||
|
||||
subgraph "Service Clients"
|
||||
AuthClient[Auth Service Client]
|
||||
AuthzClient[Authz Service Client]
|
||||
IdentityClient[Identity Service Client]
|
||||
AuditClient[Audit Service Client]
|
||||
end
|
||||
|
||||
subgraph "Core Services"
|
||||
AuthService[Auth Service]
|
||||
AuthzService[Authz Service]
|
||||
EventBusService[Event Bus]
|
||||
CacheService[Cache Service]
|
||||
AuditService[Audit Service]
|
||||
LoggerService[Logger Service]
|
||||
AuthService[Auth Service<br/>:8081]
|
||||
AuthzService[Authz Service<br/>:8083]
|
||||
IdentityService[Identity Service<br/>:8082]
|
||||
AuditService[Audit Service<br/>:8084]
|
||||
EventBusService[Event Bus<br/>Kafka]
|
||||
CacheService[Cache Service<br/>Redis]
|
||||
end
|
||||
|
||||
subgraph "Infrastructure"
|
||||
@@ -100,15 +107,20 @@ graph LR
|
||||
QueueClient[Message Queue]
|
||||
end
|
||||
|
||||
ModuleHandler --> AuthService
|
||||
ModuleHandler --> AuthzService
|
||||
ModuleHandler --> ModuleService
|
||||
|
||||
ModuleService -->|gRPC| AuthClient
|
||||
ModuleService -->|gRPC| AuthzClient
|
||||
ModuleService -->|gRPC| IdentityClient
|
||||
ModuleService -->|gRPC| AuditClient
|
||||
ModuleService --> ModuleRepo
|
||||
ModuleService --> EventBusService
|
||||
ModuleService --> CacheService
|
||||
ModuleService --> AuditService
|
||||
ModuleService --> LoggerService
|
||||
|
||||
AuthClient --> AuthService
|
||||
AuthzClient --> AuthzService
|
||||
IdentityClient --> IdentityService
|
||||
AuditClient --> AuditService
|
||||
|
||||
ModuleRepo --> DBClient
|
||||
CacheService --> CacheClient
|
||||
@@ -117,6 +129,7 @@ graph LR
|
||||
style ModuleService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff
|
||||
style AuthService fill:#4a90e2,stroke:#2e5c8a,stroke-width:2px,color:#fff
|
||||
style DBClient fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff
|
||||
style ServiceClients fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff
|
||||
```
|
||||
|
||||
## Service Interaction Patterns
|
||||
@@ -334,12 +347,14 @@ graph TB
|
||||
Audit --> Logger
|
||||
|
||||
ModuleLoader --> DI
|
||||
ModuleHandler --> Auth
|
||||
ModuleHandler --> Authz
|
||||
ModuleHandler --> ModuleService
|
||||
ModuleService --> ModuleRepo
|
||||
ModuleService -->|gRPC| Auth
|
||||
ModuleService -->|gRPC| Authz
|
||||
ModuleService -->|gRPC| Identity
|
||||
ModuleService -->|gRPC| Audit
|
||||
ModuleService --> EventBus
|
||||
ModuleService --> Cache
|
||||
ModuleService --> Audit
|
||||
ModuleRepo --> DB
|
||||
|
||||
Scheduler --> Cache
|
||||
@@ -418,33 +433,44 @@ graph TB
|
||||
style DB fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff
|
||||
```
|
||||
|
||||
### Cross-Module Communication
|
||||
### Cross-Service Communication
|
||||
|
||||
```mermaid
|
||||
graph LR
|
||||
subgraph "Module A"
|
||||
AService[Service A]
|
||||
subgraph "Blog Service"
|
||||
BlogService[Blog Service]
|
||||
end
|
||||
|
||||
subgraph "Module B"
|
||||
BService[Service B]
|
||||
subgraph "Analytics Service"
|
||||
AnalyticsService[Analytics Service]
|
||||
end
|
||||
|
||||
subgraph "Service Clients"
|
||||
AuthzClient[Authz Service Client]
|
||||
IdentityClient[Identity Service Client]
|
||||
end
|
||||
|
||||
subgraph "Core Services"
|
||||
EventBus[Event Bus]
|
||||
Authz[Authz Service]
|
||||
Cache[Cache]
|
||||
EventBus[Event Bus<br/>Kafka]
|
||||
AuthzService[Authz Service<br/>:8083]
|
||||
IdentityService[Identity Service<br/>:8082]
|
||||
Cache[Cache<br/>Redis]
|
||||
end
|
||||
|
||||
AService -->|Direct Call| Authz
|
||||
AService -->|Publish Event| EventBus
|
||||
EventBus -->|Subscribe| BService
|
||||
AService -->|Cache Access| Cache
|
||||
BService -->|Cache Access| Cache
|
||||
BlogService -->|gRPC| AuthzClient
|
||||
BlogService -->|gRPC| IdentityClient
|
||||
BlogService -->|Publish Event| EventBus
|
||||
EventBus -->|Subscribe| AnalyticsService
|
||||
BlogService -->|Cache Access| Cache
|
||||
AnalyticsService -->|Cache Access| Cache
|
||||
|
||||
style AService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff
|
||||
style BService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff
|
||||
AuthzClient --> AuthzService
|
||||
IdentityClient --> IdentityService
|
||||
|
||||
style BlogService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff
|
||||
style AnalyticsService fill:#7b68ee,stroke:#5a4fcf,stroke-width:2px,color:#fff
|
||||
style EventBus fill:#4a90e2,stroke:#2e5c8a,stroke-width:3px,color:#fff
|
||||
style ServiceClients fill:#50c878,stroke:#2e7d4e,stroke-width:2px,color:#fff
|
||||
```
|
||||
|
||||
## Next Steps
|
||||
|
||||
Reference in New Issue
Block a user