Core Concepts
Application Service
An application service is a C# interface annotated with [ServiceRoute]. It defines the public contract of a microservice — the methods available to other services and external HTTP clients. In Silky, an application service is analogous to a Controller in MVC.
Naming convention: IXxxxAppService (interface), XxxxAppService (implementation).
Service Entry
A service entry is generated for every method defined on an application service interface. It is analogous to an Action in MVC. Each service entry has:
- A unique Service Entry ID for RPC routing
- An optional WebAPI endpoint (HTTP route + verb) for external access
- Configurable governance parameters (timeout, retry, circuit breaker, etc.)
Service Entry ID
The unique identifier for a service entry, generated as:
FullyQualifiedMethodName + ParameterNames + _ + HttpVerb
Example: Demo.Contracts.IOrderAppService.GetAsync.id_Get
RPC (Remote Procedure Call)
Silky uses DotNetty TCP-based binary RPC for inter-service communication. The interface proxy pattern makes remote calls look identical to local method calls.
Dynamic Proxy
Generated at runtime via Autofac dynamic proxy (Autofac.Extras.DynamicProxy). When you inject a remote service interface, Silky provides a proxy that transparently routes the call to the correct remote instance.
Service Governance
A set of policies applied to service-to-service calls to ensure reliability and performance:
- Load Balancing: Distributes requests across healthy instances
- Circuit Breaking: Prevents cascading failures by fast-failing unhealthy routes
- Retry / Failover: Retries on infrastructure errors
- Timeout: Caps maximum wait time for a response
- Rate Limiting: Caps concurrent requests per instance
Registry Center
A service registry (Zookeeper / Nacos / Consul) that stores service metadata and endpoint addresses. Service providers register with the registry at startup; consumers query it to discover available instances.
Service Metadata
Data registered by a service provider in the registry center, including:
hostName: Provider host nameservices: Application service definitions and their service entriesendpoints: Network addresses of the running instancetimeStamp: Last update time
RPC Context (RpcContext)
A request-scoped dictionary of metadata propagated through the entire call chain (HTTP → Gateway → Service A → Service B → ...). Contains user identity, TraceId, tenant ID, and custom attachments.
TCC (Try-Confirm-Cancel)
A distributed transaction pattern where each participant exposes three methods:
- Try: Reserve resources without committing
- Confirm: Commit using the reserved resources
- Cancel: Release reserved resources on failure
Module (SilkyModule)
The basic unit of framework extensibility. Each module encapsulates a cohesive set of services and configuration. Modules declare their dependencies via [DependsOn], and the framework initializes them in topological order.
Host Types
| Type | Description |
|---|---|
GeneralHost | RPC-only microservice, no external HTTP |
WebHost | RPC + external HTTP, typically a business service |
WebSocketHost | RPC + WebSocket server-push |
GatewayHost | HTTP gateway — routes external requests to internal services |
Fallback
A degraded implementation of a service interface, activated automatically when the normal RPC call fails (circuit open, timeout, etc.).
Cache Interception
An AOP-based mechanism that checks the distributed cache before executing an RPC call. On a cache hit, data is returned directly without network IO.
