- 准备好契约(/resources/contracts)和接口定义(/resource/schemas)
- 配置application.properties, 选择所需要的模式(默认Standalone)
- 启动MockServerMain (如为Platform模式需要先启动ContractService)
- Rest查询/apis/mappings获取TCP端口列表
- 指向对应端口进行正常挡板使用
Remark:
- 可外部覆盖的配置:
- platformMode(true/false)
- contractService.baseHttpPath(路径信息如'http://localhost:8081', platformMode时必须配置)
- 如若没有配置则默认使用application.properties中的值
- 为每对生产者-消费者启动挡板服务。Startup diff MockServerThread, each thread serve for provider-consumer pair and via diff port
- 能通过REST API查询TCP挡板服务端口。Port mapping could be get via HTTP GET via API, API doc could be found at root or http://localhost:8082/api.html
- 支持Standalone单机模式,启动时文本获取契约信息,没有动态更新。When standalone mode, contract & schema would be load from file base and no dynamic update
- REST API辅助工具:根据契约生成定长请求报文,根据接口定义解释定长报文。Also provided utils, said could generate request msg base on contract, and parse message base on schema.
- 支持Platform平台模式,启动时从ContractService获取契约信息。 When non-standalone mode, contract & schema would be load from contract service HTTP, dynamic update is not implement yet.
- Platform平台模式下,接收ContractService动态更新. Support dynamic update in platform mode
- 预定义常用正则Validator。 Pre-define Regex Validator
- 预定义一个FuncValidator(如DateTime)。Pre-define a FuncValidator
- Platform模式下Rest请求ContractService需要添加重试机制. Enhance retry logic in platform mode
- 挡板服务启动时支持白名单、黑名单配置. Enhance with white list and black list config
Note: Async communication between threads which using Guava EventBus is not shown in above diagram