Files
tencent-im-util/src/main/resources/app.yml
T
yixiongandClaude d22fdcfaad feat: 初始化腾讯IM分发工具骨架,含回调分发链路与历史消息补拉
- 应用骨架: Solon + MyBatis-Plus + PostgreSQL + Redis + Sa-Token
- 核心链路: 回调网关 → 消息落库(幂等) → 分发队列(FOR UPDATE SKIP LOCKED) → worker消费/重试/死信
- 多租户隔离: 前缀法账号映射, 所有业务表带 tenant_id
- 管理后台: FreeMarker 渲染, 租户/授权/队列/用量管理页面
- 历史消息补拉: 水位线驱动, getRoamMsg/getGroupMsg 增量拉取, 兜底回调丢失
- msg_key 统一算法(回调/补拉共享, 跨路径去重)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-08 20:28:32 +08:00

120 lines
3.6 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
server.port: 8080
server:
contextPath: /imutil
solon.app:
name: 'tencent-im-util'
group: 'imutil'
# 日志
solon.logging.logger:
"root":
level: INFO
solon.logging.appender:
console:
charset: GBK
pattern: "%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) %magenta(${PID:-}) --- %-15([%15.15thread]) %-56(%cyan(%-40.40logger{39}%L)) : %msg%n"
file:
charset: UTF-8
pattern: "%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level ${PID:-} --- %-15([%15.15thread]) %-56(%-40.40logger{39}%L)) : %msg%n"
#=====================================数据库配置(PostgreSQL
solon.dataSources:
db1!:
class: "com.zaxxer.hikari.HikariDataSource"
jdbcUrl: jdbc:postgresql://192.168.10.118:5432/tencen_im?currentSchema=public&reWriteBatchedInserts=true
driverClassName: org.postgresql.Driver
username: postgres
password: Aa135790!123
maximumPoolSize: 20
minimumIdle: 5
# MyBatis-Plus 配置
mybatis.db1:
typeAliases:
- "com.imutil.entity"
mappers:
- "com.imutil.mapper"
configuration:
logImpl: org.apache.ibatis.logging.nologging.NoLoggingImpl
globalConfig:
banner: false
# Sa-Token 配置
sa-token:
authFlag: true
token-name: imutil-token
timeout: -1
activity-timeout: -1
allow-concurrent-login: true
is-share: true
token-style: uuid
is-log: false
is-print: off
# Redis 配置
imutil.redis:
host: 10.10.10.228
port: 6379
password: "Aa135790!123"
database: 11
timeout: 2000 # 连接超时 ms
connectTimeout: 2000
# 腾讯 IM 配置(密钥仅本工具持有,禁止下发到业务系统)
imutil.tencent:
sdkAppId: 1600138798 # 主应用 SDKAppID(待填)
secretKey: "21c1616e59b4698355fa9707b24d4406c99d69be3cd5e4b95022c050ec86f935" # 主应用 SecretKey(待填)
adminUserId: "administrator" # IM 管理员账号
apiHost: "console.tim.qq.com" # IM REST API 域名
usersigExpireDays: 7 # UserSig 有效期(天)
callbackToken: "" # 回调鉴权 Token(控制台回调URL配置),为空则跳过签名校验(仅联调)
# 管理后台配置(首次启动若 admin_user 表为空,用此账号初始化)
imutil.admin:
defaultUsername: admin
defaultPassword: admin123 # 默认密码,登录后请尽快修改
# 分发工作线程配置
imutil.dispatch:
workerCount: 4 # 分发工作线程数
fetchBatch: 50 # 每轮抢占条数
pollIntervalMs: 1000 # 空闲轮询间隔
maxRetry: 5 # 最大重试次数
retryBaseMs: 2000 # 重试基础间隔(指数退避 base
lockTimeoutMin: 3 # processing 超时阈值(分钟),超时由巡检重置
# 补拉配置(历史消息兜底,由 pullCheckJob 驱动)
imutil.pull:
convsPerRound: 20 # 每轮补拉会话数
maxMsgPerConv: 20 # 每会话每轮拉取条数上限
lookbackMinutes: 30 # C2C 拉取时间窗(最近N分钟)
# 限流配置(按租户令牌桶)
imutil.ratelimit:
defaultImQps: 50 # 默认每租户 IM API QPS
globalImQps: 200 # 全局 IM API QPS 上限(腾讯限制的 80% 安全边际)
# 定时任务配置
solon.scheduling.job:
# 死信/卡死 processing 巡检:每 1 分钟
dispatchRecoverJob:
fixedDelay: 60000
zone: "+08"
enable: true
# 历史消息补拉巡检:每 5 分钟
pullCheckJob:
fixedDelay: 300000
zone: "+08"
enable: true
# 分区自动建表:每天凌晨 0:10
partitionCreateJob:
cron: "0 10 0 * * ?"
zone: "+08"
enable: true
# 用量统计聚合:每小时 03 分跑上一小时窗口(避开整点边界)
usageStatJob:
cron: "0 3 * * * ?"
zone: "+08"
enable: true