Skip to content

配置项参考

本文档列出 Pragmatic DDD 各模块的配置项。

1. 本地事件管理器配置

前缀:event.local

类型默认值说明
scheduler-threadsint2调度线程数(延迟投递)
core-pool-sizeintmax(4, processors)核心线程数
max-pool-sizeintmax(8, processors*2)最大线程数
queue-capacityint1000任务队列容量
keep-alive-secondslong60空闲线程存活秒数
delivery-delay-msint1000延迟投递间隔(毫秒)
max-retry-timesint3最大重试次数
retry-delay-msint1500重试间隔(毫秒)

2. RocketMQ 配置

前缀:rocketmq

类型默认值说明
name-serverString-NameServer 地址(Remoting)
proxy-addrString-gRPC Proxy 地址(5.x)
producer-groupStringDEFAULT_PRODUCER_GROUPProducer 组名
consumer-groupStringPRAGMATIC_DDD_RMQ_CONSUMERConsumer 组名
retry-times-when-send-failedint3发送失败重试次数
send-msg-timeoutint3000发送超时(毫秒)
compress-msg-body-over-howmuchint4096压缩阈值(字节)
default-delay-levelint3默认延迟级别
max-reconsume-timesint16消费最大重试次数

3. Outbox Relay 配置

前缀:outbox(通过 OutboxRelayConfig.bind(IConfigurationSource) 绑定)

类型默认值说明
poll-intervalDuration5min轮询间隔
graceDuration30s宽限时间(超过此时间的 PENDING 才会被认领)
batch-sizeint200每次认领批量
max-attemptsint10最大重试次数

也可通过构造器直接传入(record 参数顺序:(pollInterval, grace, batchSize, maxAttempts));不配置时使用 OutboxRelayConfig.defaultConfig() 的内置默认值。

4. MyBatis TypeHandler 配置

TypeHandler 通过 TypeHandlerContext(record)装配,非配置文件:

组件说明
EnumValueResolver枚举解析注册表
JsonSerializerJSON 序列化器
JdbcJsonValueJDBC 驱动适配
enumRulesMap<Class<?>, EnumRule> 枚举策略
voTypesCollection<Class<?>> VO 类型
collectionsCollectionElementTypeConfig 集合配置