CS Architecture
ContextService Architecture
Horizontal Division
Horizontally divided into three modules: Restful, Scheduler, Service
Restful Responsibilities:
1. Encapsulate the request as httpjob and submit it to the Scheduler
Scheduler Responsibilities:
1. Find the corresponding service through the ServiceName of the httpjob protocol to execute the job
Service Responsibilities:
1. The module that actually executes the request logic, encapsulates the ResponseProtocol, and wakes up the wait thread in Restful
Vertical Division
Vertically divided into 4 modules: Listener, History, ContextId, Context:
Listener responsibilities:
- Responsible for the registration and binding of the client side (write to the database and register in the CallbackEngine)
- Heartbeat interface, return Array[ListenerCallback] through CallbackEngine
History Responsibilities:
Create and remove history, operate Persistence for DB persistence
ContextId Responsibilities:
Mainly docking with Persistence for ContextId creation, update and removal, etc.
Context responsibility:
- For removal, reset and other methods, first operate Persistence for DB persistence, and update ContextCache
- Encapsulate the query condition and go to the ContextSearch module to obtain the corresponding ContextKeyValue data
The steps for requesting access are as follows: 
UML Class Diagram

Scheduler thread model
Need to ensure that Restful’s thread pool is not filled

The sequence diagram is as follows: 
