How s1000f/jsonrpc-handler-kotlin works
Main Components
a. Core Components:
• JSON-RPC Dispatcher System
• Method Mapping System
• Request/Response Handler
• Data Transfer Objects (DTOs)
• Parser System
b. Integration Points:
• HTTP Server Integration (Ktor/Spring Boot examples)
• External JSON Parser (Jackson)
┌─────────────────────────────────────────────────────┐
• HTTP Server Layer │
• (Ktor/Spring Boot Integration) │
• ┤
• JSON-RPC Handler Core │
• ┌─────────────┐ ┌──────────┐ ┌──────────┐ │
• Dispatcher │←───│ Context │────→│ Parser │ │
• ┘ │ Builder │ │(Jackson) │ │
• ↕ └──────────┘ └──────────┘ │
• ┌─────────────┐ │
• Method │ │
• Mapper │ │
• ┘ │
• ↕ │
• ┌─────────────┐ ┌──────────┐ │
• RPC │────→│ DTO │ │
• Methods │ │ Layer │ │
• ┘ └──────────┘ │
• ┘
Component Details
a. Dispatcher System:
• AbstractDispatcher and JsonrpcHandler
• Connection to ContextBuilder
• Relationship with JsonParser interface
b. Method Mapping:
• MethodMapper and RouteMapper
• Connection to RpcMethod implementations
• AbstractHandlerMapper relationship
c. DTO Layer:
• Request/Response objects
• ErrorCode and PresetError relationships
• RpcContext and ContextHolder
Important Relationships to Highlight
• How external HTTP requests flow through the system
• Method resolution process
• Demonstrate error handling paths
• Parameter validation flow
Implementation Notes
• The library's role as a middleware component
• Protocol-agnostic nature (works with any transport)
• Extensibility through custom RpcMethod implementations
• Type-safe parameter handling
• Clear separation between protocol handling and business logic
Integration Examples
• Ktor integration example
• Spring Boot integration example
• Custom method implementation pattern